This is a discussion on Monitoring Process CPU Using `ps` ... Not Working? within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi All, I'm trying to monitor the amount of CPU consumed by our Sun Java System Directory Server slapd ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi All, I'm trying to monitor the amount of CPU consumed by our Sun Java System Directory Server slapd process on AIX 5.2. The command I'm using is: echo "`date +%H:%M:%S` `ps avg $PIDNUM | tail -1 | awk '{ print $6, $7, $11, $12 }'`" >> ${FILEA} Which produces output like this: 23:50:08 218336 218516 0.4 1.0 23:51:08 218336 218516 0.4 1.0 23:52:08 218336 218516 0.4 1.0 23:53:08 218336 218516 0.4 1.0 23:54:08 218336 218516 0.4 1.0 23:55:08 218336 218516 0.4 1.0 23:56:08 218336 218516 0.4 1.0 23:57:08 218336 218516 0.4 1.0 23:58:08 218336 218516 0.4 1.0 23:59:08 218336 218516 0.4 1.0 The strange thing I'm seeing is that since implementing this monitor over a week ago, the PCPU (Precent CPU) field has *never* deviated from 0.4%. This is on a production system, and I know that traffic varies at different times of the day. I can further validate this by using the monitor script bundled with Directory Server, which shows number of current connections, etc. So my question is should I be trusting the output of ps, or might there be something wrong? Cheers! Paul |
| |||
| Paul wrote: > I'm trying to monitor the amount of CPU consumed by our Sun Java System > Directory Server slapd process on AIX 5.2. The command I'm using is: > > echo "`date +%H:%M:%S` `ps avg $PIDNUM | tail -1 | awk '{ print $6, $7, > $11, $12 }'`" >> ${FILEA} > > Which produces output like this: > > 23:50:08 218336 218516 0.4 1.0 > 23:51:08 218336 218516 0.4 1.0 > Hi Paul, You can try the following commands instead, but I think it may end up giving you pretty much the same results. I have not seen growth in a daemon process that I have for EDI transfers nor to the qdaemon in the short time I monitored it. # echo "$(date +"%H:%M:%S) $(ps -p ${PIDNUM} -o "%p %c %C %x %z %t"|tail -1)" >> ${FILEA} The elapsed time will at least show you that the lines are not duplicated all the time and are in fact unique. Steve |
| ||||
| Paul wrote: > Hi All, > > I'm trying to monitor the amount of CPU consumed by our Sun Java System > Directory Server slapd process on AIX 5.2. The command I'm using is: > > echo "`date +%H:%M:%S` `ps avg $PIDNUM | tail -1 | awk '{ print $6, $7, > $11, $12 }'`" >> ${FILEA} > > Which produces output like this: > > 23:50:08 218336 218516 0.4 1.0 > 23:51:08 218336 218516 0.4 1.0 > 23:52:08 218336 218516 0.4 1.0 > 23:53:08 218336 218516 0.4 1.0 > 23:54:08 218336 218516 0.4 1.0 > 23:55:08 218336 218516 0.4 1.0 > 23:56:08 218336 218516 0.4 1.0 > 23:57:08 218336 218516 0.4 1.0 > 23:58:08 218336 218516 0.4 1.0 > 23:59:08 218336 218516 0.4 1.0 > > The strange thing I'm seeing is that since implementing this monitor > over a week ago, the PCPU (Precent CPU) field has *never* deviated from > 0.4%. This is on a production system, and I know that traffic varies at > different times of the day. I can further validate this by using the > monitor script bundled with Directory Server, which shows number of > current connections, etc. > > So my question is should I be trusting the output of ps, or might there > be something wrong? > > Cheers! > Paul Paul, I don't think the Percent CPU value is what you expect. It is NOT a snapshot of the percentage of CPU a process is using NOW... ....it is the percentage of CPU a process has used over the LIFE of the process. >From AIX 5.1 & 5.3 man page on "ps": %CPU (u and v flags) The percentage of time the process has used the CPU since the process started. The value is computed by dividing the time the process uses the CPU by the elapsed time of the process. In a multi-processor environment, the value is further divided by the number of available CPUs because several threads in the same process can run on different CPUs at the same time. (Because the time base over which this data is computed varies, the sum of all %CPU fields can exceed 100%.) -tony |