ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

logmon UNIX command profile that runs for several minutes is not returning output


Article ID: 33928


Updated On:


DX Unified Infrastructure Management (Nimsoft / UIM) NIMSOFT PROBES


The UNIX logmon command profile must be able to execute the command successfully from the "sh -c" UNIX command.

An example of a command that may fail when executed from the "sh -c" command is as follows:

sh -c fline=0;interval=10;timeref=`date +%s`;while [ `date +%s` -lt ` echo $timeref+30|bc` ] ;do while read -r line; do nline=`echo $line | awk '{print $12}'`; fline=`expr $fline + $nline`; done < /proc/diskstats; sleep ${interval}; done; echo $fline

On some Linux systems, this sh command will hang and never return to the prompt.

If the sh command hangs and never returns, the logmon probe will experience the same behavior.? In those cases, you can include the command that the logmon profile should execute in a shell script file.? Add execute permissions to the shell script and then provide the absolute path to the shell script file for the command in the logmon profile to monitor the outputs of the desired command.

Here is how you would do this for the command provided in the example above:

1.Create the file in the /opt/nimsoft/probes/system/logmon directory with the following contents:

#! /bin/sh
fline=0;interval=10;timeref=`date +%s`;while [ `date +%s` -lt `echo $timeref+30|bc` ] ;do while read -r line; do nline=`echo $line | awk '{print $12}'`; fline=`expr $fline + $nline`; done < /proc/diskstats; sleep ${interval}; done; echo $fline

2 Add execute permissions to the file:

 chmod +x /opt/nimsoft/probes/system/logmon/

3.Change the logmon profile and replace the command with the pathname to the shell script:


4. Save the change to the logmon configuration, apply the change and restart the probe.

The logmon probe will now monitor the outputs of the shell script.


Component: UIMLGM


Please Update This Required Field