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
"processmonitor.sh 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)
---------processmonitor.sh--------
opcmon=$OVINSTALLDIR/bin/opcmon
policy=$1
process=$2
count=$(ps -ef | grep $process | grep -v grep | wc -l)
$opcmon $policy=$count
----------------------------------
3- Monitor Process using OSSPI.
Ref: Unix OS SPI Admin Guide http://support.openview.hp.com/selfsolve/document/KM14827/binary/UNIXOS-SPI_a35_AdminRef_pdf 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.
[Process]
/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_perl.sh osspi_procmon.pl OSSPI-cronproc cron" with "osspi_perl.sh osspi_procmon.pl PolicyName Processname"
3 comments:
Thank you for all the help you provide. I use OMW 8.16 and know very little about linux. I need to monitor a process and alert when it is not running and also when it is running again. Step #2 sounds like a match but what lines to edit in processmonitor.sh has me confused. If were to rename the file to gedit.sh and create a meausure ment threshold policy named geditmt then should the contents read like this?
---------gedit.sh--------
opcmon=$OVINSTALLDIR/bin/opcmon
policy=$geditmt
process=$gedit
count=$(ps -ef | grep $gedit | grep -v grep | wc -l)
$opcmon $geditmt=$count
Does this work? Sorry for asking what must seem as a very nube-like question.
thanks for reading
scott_r
using logfile method, however /tmp/processname is not getting updated. I am using OMU9.
Hi Mahmoud,
i am woking on weblogic spi with oMW 9 and agent 11.0.25.
Generating failure alerts everyday as The process 'wasspi_perl -S wasspi_wls_files wasspi_perl.log' terminated with a non-zero exit code. (OpC20-432)
The process 'wasspi_perl -S wasspi_wls_files Discovery.log' terminated with a non-zero exit code. (OpC20-432)
The process 'wasspi_perl -S wasspi_wls_files Collector.log' terminated with a non-zero exit code. (OpC20-432)
The process 'wasspi_perl -S wasspi_wls_files wlslog' terminated with a non-zero exit code. (OpC20-432)
I checked the script.that wa snot helped out.
Could you please help me out.
Post a Comment