The CLI CPU monitor function currently in OpManager is depending on a specific output of the top command. Since we are using RedHat 2.1, 3 as well as version 4 I created a new command that will give me the amount of used CPU on all these versions:
sar -u 1 1 | grep Average | grep -o '[0-9|\.]*$' | grep -o '^[0-9]*'
You will need the sysstat package for this to work (up2date sysstat).
SNMP for monitoring CPU usage is not an option on RedHat, the OID used in OpManager for net-snmp is deprecated and does not give correct values. There is no alternative AFAIK (only load counters, all cpu counters give raw values and need calculation over a time period).
To activate the new command this I replaced the top command in HostResource.xml:
<CATEGORY ID="CPU Utilization" command="sar -u 1 1 | grep Average | grep -o '[0-9|\.]*$' | grep -o '^[0-9]*'" parseAll="false" description="Percentage of CPU used on a RH Enterprise Server is monitored periodically and displayed."> <ENTITY ID="CPUUtilization" applyThresholdOver="100-cpuTime" threshold="Th6" storeHistory="true" units="%" storeValue="100-cpuTime"> <PARSE line="1" token="1" name="cpuTime"/> </ENTITY> </CATEGORY>
The problem is that the commandline is quite long so it seems to get wrapped to the next line. So, for some servers I have to use the following to get the correct value: