- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- CPU Usage Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2010 10:53 PM
тАО08-16-2010 10:53 PM
can someone help me to find the script which will help me to monitor cpu usage for HP-UX 11.31 & 11.23, and if the usages go above 80% I will get a email atomically.
Thanks in advance.
Solved! Go to Solution.
- Tags:
- top
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2010 11:23 PM
тАО08-16-2010 11:23 PM
Re: CPU Usage Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2010 11:51 PM
тАО08-16-2010 11:51 PM
Re: CPU Usage Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 12:11 AM
тАО08-17-2010 12:11 AM
Re: CPU Usage Script
$ top -f /var/tmp/top.out -n 100 -d 1
$ awk '/^avg/ { print 100 - $6; exit}' /var/tmp/top.out
This prints the average % CPU utilization.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 12:36 AM
тАО08-17-2010 12:36 AM
Re: CPU Usage Script
Need script that sends me an email if CPUs average usage goes above 80%.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 12:42 AM
тАО08-17-2010 12:42 AM
Re: CPU Usage Script
Check this out: cpumem.sh
http://forums13.itrc.hp.com/service/forums/questionanswer.do?&threadId=1037077
I havce a latest version of it also , for v2 and v3, just try that out. It works with glance ,and keeps a log of cpu/mem/diskio ..,
How ever if you have implemented OVO , that will send cpu threshold alert.
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 01:56 AM
тАО08-17-2010 01:56 AM
Re: CPU Usage Script
Rgd,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 02:56 AM
тАО08-17-2010 02:56 AM
Re: CPU Usage Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 03:07 AM
тАО08-17-2010 03:07 AM
Re: CPU Usage Script
from sar output you can get email alert if cpu usage is more than 80% , you need have a script with loop, or may be using cron ,
# sar -u 5 20
- grep the cpu usage field
- using awk '{ if ( $NF > 80 ) print $0 }' >> logfile, analyse the log file again with a condition and if it is greater than 80 for sometime then send email, else OK.
That logic could be use ,
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-17-2010 03:24 AM
тАО08-17-2010 03:24 AM
Re: CPU Usage Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2010 09:10 PM
тАО08-18-2010 09:10 PM
Solutioncheck this out:
You can put the script in cron in 5 min interval , so that it will check every 5 min.
#!/usr/bin/sh
## Script to check cpu usage if reached 80% . cpu_alert_80_email.sc [v1] 08-18-2010
## Checks every 30 second per script execution.
######################################################################################################
HOST=`hostname`
sar -u 3 10 | grep -v idle | grep -v `hostname` |awk '{if ($NF<20) print $0 }'| awk /./ > result
if [ -s result ]
then
#result nonZero: Alert!! and Email:
echo "\n\n------------------------------------------------------------------------"
echo "ALERT!!!! CPU threshold reached and more than 80%"
echo "------------------------------------------------------------------------\n"
echo "Current cpu usage : "
echo "$HOST %usr %sys %wio %idle" >> result
echo "------------------------------------------------------------------------\n" >> result ; cat result
echo "Sending Email Alert........"
#cat result | mailx -s "CPU usage reached threshold: 80% on $HOST " youremail@domain.com
else
echo "Threshold not reached. [OK] "
ls -l result
fi
########################################################################################################
$ ./cpu_alert_80_email.sc
------------------------------------------------------------------------
ALERT!!!! CPU threshold reached and more than 80%
------------------------------------------------------------------------
Current cpu usage :
22:03:23 92 2 4 2
22:03:25 90 2 4 4
Average 91 2 4 3
hpux1120 %usr %sys %wio %idle
------------------------------------------------------------------------
Sending Email Alert........
$
Enjoy,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 10:58 PM
тАО08-25-2010 10:58 PM