Client Automation - Script to clean CAM queues which have proxy and a QLEN > 10
search cancel

Client Automation - Script to clean CAM queues which have proxy and a QLEN > 10

book

Article ID: 134907

calendar_today

Updated On:

Products

CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation CA Client Automation - Software Delivery CA Client Automation - Remote Control

Issue/Introduction

When cam.exe is very busy and responding slowly, it could be caused by a lot of CAM queues with proxy and with big QLEN (>10).
 
Example :
output of "camstat -n" command returns :
 
Host                  proto state  port  Qlen  m/sent  m/recv  retry  disc  RTO
--------------------- ----- ----- ----- ----- ------- ------- ------ ----- ----
x.y.244.71              udp   ---  4104   136    1755    1940  13862     1    1
a.b.182.222             prx 

a.b.192.188             udp   ---  4104    45    1550    1744  14159     0    1
x.y.245.160             prx 


In this example 2 CAM queues have a proxy queue (prx) and a big Qlen. A lot of retries are made by cam.


If there are a lot of queues like this, cam.exe could be overloaded by sending a lot of retries to machines which seem not available on network anymore.

 

Environment

Release : All Client Automation Release

Component : Client Automation

 

Resolution

In Addtional information section below there is a text of a script. Create a file camclean.bat with content of this text.

 

Script camclean.bat could be used to remove CAM queues with proxy and with big Qlen.

It could be copied on the machine with problem under C:\Program Files (x86)\CA\DSM\Bin

 

Then execute camclean.bat

This script removes the CAM queues with QLen greater or equal to 10 and which have a proxy queue.

 

This script generates a log file : C:\Program Files (x86)\CA\DSM\logs\camclean.log

This script could be executed regularly on the server (once a day for example).

To do this an Asset Job could be created for this script :



1- On DSM Explorer, create a new Asset Job of type "Command"



2- Give it a name and copy/paste the content of file camclean.txt


3- Click on "Set Scheduling" option.

In Conditions put "Run only once a Day".


 

4- Click Finish and assign this Asset Job to the machine with cam problem.


Everyday when AM Agent plugin is executed, machine will execute the camclean job and does the cleanup in CAM queues.

 

Additional Information

@echo OFF
SETLOCAL enabledelayedexpansion
SET VERSION=2.1


REM ------------------ Find DSM Log Directory ----------------
IF NOT %PROCESSOR_ARCHITECTURE% == x86 goto x64

:x32
set X64_PROCESS=
goto suite

:x64
SET X64_PROCESS=Wow6432Node\

:suite
FOR /F "tokens=2*" %%i IN ('reg query "HKLM\Software\%X64_PROCESS%ComputerAssociates\Unicenter ITRM" /v "InstallDirProduct" 2^>NUL ^| FIND "REG_SZ"') DO SET LOGDIR=%%j\LOGS

SET LOGFILE="%~n0.log"
SET BAKLOGFILE="%~n0.bak"
SET FULLLOGFILE="%LOGDIR%\%LOGFILE%"
SET MAXBYTESIZE=31457280


REM ------------------ Check date and size of log file ----------------
IF NOT EXIST %FULLLOGFILE% goto start

pushd "%LOGDIR%"

FOR /F "usebackq" %%A IN ('%LOGFILE%') DO (
set FILESIZE=%%~zA
set FILEDATETIME=%%~tA
)

IF %FILESIZE% GTR %MAXBYTESIZE% (
   IF EXIST %BAKLOGFILE% DEL /Q /F %BAKLOGFILE%
   REN %LOGFILE% %BAKLOGFILE%
)

popd

:start

echo -------------------------- START -------------------------- >> %FULLLOGFILE%
echo %DATE%-%TIME% - Start %0 >> %FULLLOGFILE%
echo %DATE%-%TIME% - VERSION = %VERSION% >> %FULLLOGFILE%
echo. >> %FULLLOGFILE%
echo %DATE%-%TIME% - CAMSTAT BEFORE  >> %FULLLOGFILE%

camstat -n -r | findstr "^[0-9]*\." > "%TEMP%\camclean.txt" 2>&1

type "%TEMP%\camclean.txt" >> %FULLLOGFILE%
echo.  >> %FULLLOGFILE%

SET NBLINE=0
for /f "usebackq" %%i in ("%TEMP%\camclean.txt") do set /a NBLINE=!NBLINE!+1

SET CURLINE=0
FOR /F "usebackq tokens=1,2,5" %%i IN ("%TEMP%\camclean.txt") DO call :process %%i %%j %%k

goto end

:process
SET /A CURLINE=!CURLINE!+1
SET IPADDR=%1                -
SET IPADDR=%IPADDR:~0,15%
SET CURLINE1=   !CURLINE!
SET CURLINE1=%CURLINE1:~-4%
echo %DATE%-%TIME% - %CURLINE1%/!NBLINE! - %IPADDR% %2  QLEN=%3 >> %FULLLOGFILE%

IF %2==prx (
  SET COMPUTER2=%1
  IF !QLEN! GEQ 10 ( 
    echo %DATE%-%TIME% - Execute "camq -n -c !COMPUTER1!" >> %FULLLOGFILE%
    camq -n -c !COMPUTER1! > nul 2>&1

    echo %DATE%-%TIME% - Execute "camq -n -d !COMPUTER1!" >> %FULLLOGFILE%
    camq -n -d !COMPUTER1! > nul 2>&1

    echo %DATE%-%TIME% - Execute "camq -n -c !COMPUTER2!" >> %FULLLOGFILE%
    camq -n -c !COMPUTER2! > nul 2>&1

    echo %DATE%-%TIME% - Execute "camq -n -d !COMPUTER2!" >> %FULLLOGFILE%
    camq -n -d !COMPUTER2! > nul 2>&1
  )
   goto :EOF
)

IF %3 GEQ 50 ( 
   echo %DATE%-%TIME% - Execute "camq -n -c %1" >> %FULLLOGFILE%
   camq -n -c %1 > nul 2>&1
)

SET COMPUTER1=%1
SET QLEN=%3
SET COMPUTER2=

goto :EOF


:end
echo. >> %FULLLOGFILE%
echo %DATE%-%TIME% - CAMSTART AFTER  >> %FULLLOGFILE%
camstat -n -r | findstr "^[0-9]*\." >> %FULLLOGFILE% 2>&1


echo -------------------------- END ---------------------------- >> %FULLLOGFILE%
echo.  >> %FULLLOGFILE%
echo.  >> %FULLLOGFILE%

:end2
IF EXIST "%TEMP%\camclean.txt" DEL /Q "%TEMP%\camclean.txt"
icacls %FULLLOGFILE% /T /C /grant Users:F >nul 2>&1
ENDLOCAL