Here is an exec we used to use to generate alerts via sendfile. While it is
no full-blown monitor, it is easy to update if you want to track something
specific over time. I'm sure a plumber will see lots of possible
improvements.
Bob.
/***********************************************************************
* 05/05/98 09:38 loop all users looking for high usage *
* 05/12/08 12:15 update for 21st century email *
***********************************************************************/
trace 'o'
parse arg mailto
if mailto = '' then mailto = '[EMAIL PROTECTED]'
initialize:
user. = ""
lastuser. = ""
cpumin. = 0
cpusec. = 0
cputime. = 0
lastcpu. = 0
lastelapsed. = 0
cpuwarn = 80
loop:
do forever
totallast = 0
totalelapsed = 0
'Q NAMES (FIFO'
file. = ""
lines = queued()
do count = 1 to lines
parse pull col1 ',' col2 ',' col3 ',' col4
if col1 <> "" then queue col1
if col2 <> "" then queue col2
if col3 <> "" then queue col3
if col4 <> "" then queue col4
end
'vmfclear'
say "VM CPU CPU CPU"
say "USERID Last Curr Total"
lines = queued()
do count = 1 to lines
parse pull userid .
user.userid = userid
'execio * CP ( STEM CPLINE. STRING INDICATE USER 'user.userid
parse value cpline.6 with . "TTIME=" cpumin.userid ":" cpusec.userid .
if lastuser.userid = user.userid then do
lastcpu.userid = cputime.userid
cputime.userid = (cpumin.userid*60)+cpusec.userid
end
else do
lastuser.userid = user.userid
cputime.userid = (cpumin.userid*60)+cpusec.userid
lastcpu.userid = cputime.userid
end
elapsed = cputime.userid - lastcpu.userid
if elapsed <> "0" then do
say left(user.userid,9) ||,
" 0:"right(lastelapsed.userid,2,"0")" 0:"right(elapsed,2,"0")"
"||,
cpumin.userid":"cpusec.userid
end
totallast = totallast + lastelapsed.userid
totalelapsed = totalelapsed + elapsed
lastelapsed.userid = elapsed
end
cmdtimer = time(e)
say " "
say "Total 0:"right(totallast,2,"0")" 0:"right(totalelapsed,2,"0")
say " "
say date(u) time()" Command Timer = "cmdtimer
say " "
if totalelapsed > cpuwarn then do
'exec sendfile cpuwarn listing a 'mailto' (smtp'
end
'execio * CP ( STEM CPLINE. STRING INDICAT LOAD'
if pos("100%",cpline.count) > 0 then alarm = "YES"
do count = 1 to 3
say cpline.count
if alarm = "YES" then "cp msg operator "CPLINE.COUNT
end
'cp sleep 60 sec'
if time(e) < 60 then leave
cmdtimer = time(r)
end
'vmfclear'
exit
**********************************************************************
-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of
Fargusson.Alan
Sent: Monday, May 12, 2008 11:43 AM
To: [email protected]
Subject: Query CPU usage.
I think someone posted a CP command to show what the CPU usage is of various
virtual machines, however I can't seem to find it.
I was told that the LPAR is using 100% of the CPU. Fortunately the LPAR has
an IFL that is not shared with any other LPAR. All of my Linux instances
are mostly idle, so I would like to see if anything is actually using CPU.
You don't need to suggest that we get a monitoring tool. We have one,
although I don't know how to use it.
____________________________________________________________________________
______________________
CONFIDENTIALITY NOTICE: This email from the State of California is for the
sole use of the intended recipient and may contain confidential and
privileged information. Any unauthorized review or use, including
disclosure or distribution, is prohibited. If you are not the intended
recipient, please contact the sender and destroy all copies of this email.
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions, send email
to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
This electronic transmission and any documents accompanying this electronic
transmission contain confidential information belonging to the sender. This
information may be legally privileged. The information is intended only for
the use of the individual or entity named above. If you are not the intended
recipient, you are hereby notified that any disclosure, copying, distribution,
or the taking of any action in reliance on or regarding the contents of this
electronically transmitted information is strictly prohibited.
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390