Friday, March 4, 2011

Monitor Unix processes in HP OM

Monitor the processes by several ways.

1-Log File Monitor
Configure the policy with pre-processing enabled to execute your script that direct the output to a text file and based on pattern matching rules, fetch the number of the processes.

2-Threshold Monitoring Policy
Where you have to create Measurement Threshold monitoring to launch a script and send the number of process instances along with opcmona.

3-Use the OSSPI built-in monitoring script to reach your goal as stated in your original question.

1- Monitor process using log file policy

Create Log file monitor policy
Leave log file location as empty
Enabled pre-processing option and for the field of command to be executed put your script
ps -ef | grep processname | grep -v grep | wc -l > /tmp/processname
Type the /temp/processname on the file to be read field
Note: replace the "processname" with the process you are looking for.
Create rule to look for value 0 to send you alert and for <!0> to send you the process is working

2- Monitor process using Measurement Threshold policy

Create a Measurement Threshold policy and name it with the process name
Select program as source and type
" policyname processname"
Note: replace the policyname and process name to match the exact policy name and process name.

Create minimum rule if processes are less than 1 then alert to be generated to as process is down


Create the following script and distribute it to the nodes (best option to distribute it as instrumentation)
count=$(ps -ef | grep $process | grep -v grep | wc -l)
$opcmon $policy=$count

3- Monitor Process using OSSPI.

Ref: Unix OS SPI Admin Guide Page 86

The answer to your original question:
In OSSPI process monitor there is two files used for this:
1st one is created automatically called procmon.cfg and is created by "OSSPI-AutoDiscovery" policy and it is called discovery application
You can modify this file to add more processes but I am not sure if it will be overwritten by the re-discovery
2nd file is called procmon_local.cfg this can be manually created and it will not be overwritten by re-discovery, that's why you see everybody using it.

The file syntax is typical to procmon.cfg; also check the admin guide for more details.
/path/to/process *

Also you can add processes by tools available in the OSSPI Process Monitoring application group to edit the process monitor configuration file.

After you add your processes
You can create a copy of any OSSPI process monitor template like "OSSPI-cronproc" and give it a new name and ensure that the program name in this policy to replace policy name and process name to match your own " OSSPI-cronproc cron" with " PolicyName Processname"