- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How can i generate the alterts if CPU utilization ...
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
Forums
Discussions
Discussions
Discussions
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
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
06-17-2006 04:11 PM
06-17-2006 04:11 PM
I have sendmail configured on my server.
i need to generate the alterts on my email id if CPU utilization goes above 90%.
how can i do this?
please suggest
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2006 04:19 PM
06-17-2006 04:19 PM
SolutionYou may have to write a shell script for this, http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1008702
Or, you have to use tools such as Openview performance manager, http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=989506
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2006 04:39 PM
06-17-2006 04:39 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
sar -u 1 10 |awk '{print $5}' | if [ "$5" -le 10 ]; then
echo "High CPU Utilization" | mailx -s 'subject' praveen@domain.com
fi
Note: You want to read %idle less then 10%.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2006 11:53 PM
06-17-2006 11:53 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
If Openview isn't in the scope of your budget, check for BigBrother which is free for non-commercial use.
http://www.bb4.org/
Darrel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 07:57 PM
06-18-2006 07:57 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
If you have Glnace on your server I can send yu the script which sent by email an alert when 2 of the resources: memory, disc, cpu, swap are over a threshould.
Rgds,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 08:09 PM
06-18-2006 08:09 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
yes i have glance plus utility,
please send me the script
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 08:26 PM
06-18-2006 08:26 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
you have to set the varaiabile MaiAdd with your email address.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 08:34 PM
06-18-2006 08:34 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
LIMIT="90"
let VALUE=100-$(sar -s$(( $(date +%H)-1))|tail -1|awk '{print $5}')
if [ "$VALUE" -gt "$LIMIT" ]
then
mailx ...
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 08:38 PM
06-18-2006 08:38 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
thanks for sending me the scripts.
please let me know how to configure it and is there any need to make some entries in crontab?
please let me know the full steps to use this scripts
thanks for your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 09:02 PM
06-18-2006 09:02 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
set the variabile MaiAdd to your email a ddress and add in crontab to run every 10 minutes:
3,13,23,33,43,53 * * * * res-cop-alert.ksh 90 >/tmp/res-cop-alert.log 2>71
I suggest you to perform some runs manually to understand how the script works.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 09:07 PM
06-18-2006 09:07 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
You don't want to do this. Its perfectly normal for a system even with low usage, to jump over 90% CPU user once in a while.
You will find the alerts to be unhelpful.
What I recommend to do is use the code provided above to alert you when usage has been over 90% for a certain period of time.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 09:43 PM
06-18-2006 09:43 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
you are talking about which code?
can you please give me the full details to use that code.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 09:57 PM
06-18-2006 09:57 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
#cd /tmp
#ll
total 16
-rw-r--r-- 1 root sys 2306 Jun 19 04:43 277457.ksh
#mv 277457.ksh cpu_alert.ksh
# chmod 777 cpu_alert.ksh
#ll
total 16
-rwxrwxrwx 1 root sys 2306 Jun 19 04:43 cpu_alert.ksh
#ksh ./cpu_alert.ksh
./cpu_alert.ksh[3]: ^M: is not an identifier
logout root
#
#
what is this error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 10:02 PM
06-18-2006 10:02 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
dos2ux cpu_alert.ksh > /tmp/cpu_alert.ksh
mv /tmp/cpu_alert.ksh cpu_alert.ksh
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 10:12 PM
06-18-2006 10:12 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
#ll
total 16
-rwxrwxrwx 1 root sys 2306 Jun 19 04:43 cpu_alert.ksh
should i run these two commands, cpu_alert.ksh is in /tmp directory.
#dos2ux cpu_alert.ksh > /tmp/cpu_alert.ksh
#mv /tmp/cpu_alert.ksh cpu_alert.ksh
and now which command i need to use to run this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 10:17 PM
06-18-2006 10:17 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
You can just # chmod 555 cpu_alert.ksh and
# ./cpu_alert.ksh to run the script
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 10:35 PM
06-18-2006 10:35 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
total 16
-rwxrwxrwx 1 root sys 2306 Jun 19 04:43 cpu_alert.ksh
[/tmp]# dos2ux cpu_alert.ksh >/tmp/cpu_alert.ksh
[/tmp]# ll
total 0
-rwxrwxrwx 1 root sys 0 Jun 19 05:33 cpu_alert.ksh
why it is making this file of 0 bytes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 10:46 PM
06-18-2006 10:46 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
Do a # strings cpu_alert.ksh > /tmp/cpu_alert.ksh
It should work.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2006 11:11 PM
06-18-2006 11:11 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
tmp]# ll
total 32
-rw-r--r-- 1 root sys 2306 Jun 19 04:43 277457.ksh
-r-xr-xr-x 1 root sys 2306 Jun 19 06:09 cpu_alert.ksh
[/tmp]# strings cpu_alert.ksh >/tmp/cpu_alert.ksh
[/tmp]# ll
total 16
-rw-r--r-- 1 root sys 2306 Jun 19 04:43 277457.ksh
-r-xr-xr-x 1 root sys 0 Jun 19 06:10 cpu_alert.ksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2006 12:11 AM
06-19-2006 12:11 AM
Re: How can i generate the alterts if CPU utilization goes above 90%
If you are 'cd'ed to the '/tmp' directory and you do:
# dos2ux cpu_alert.ksh >/tmp/cpu_alert.ksh
Then, you are actually truncating the file before you begin filtering it! This nulls the file. That is the reason your file is now 0-byes long.
You should *change* the name of the output file to differ from its input file in this case.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2006 04:43 AM
06-19-2006 04:43 AM
Re: How can i generate the alterts if CPU utilization goes above 90%
#dos2ux cpu_alert.ksh >/tmp/cpualert.ksh
#./cpualert.ksh
*** Can't find server name for address 170.120.6.12: Query refused
*** Can't find server name for address 170.120.6.13: Query refused
*** Default servers are not available
./cpualert.ksh[57]: DebFlg: parameter not set
logout root
#
why i am getting this error?
everytime i am getting two more files in /tmp directory with name "root*****.err" & "root*****.out".
#cd /tmp
#ll
-rwxr-xr-x 1 root sys 2220 Jun 19 11:07 cpualert.ksh
-rw-r--r-- 1 root sys 233 Jun 19 11:41 gln_syntax_file
-rw-r--r-- 1 root sys 29 Jun 19 11:08 roota04239.err
-rw-r--r-- 1 root sys 37 Jun 19 11:08 roota04239.out
-rw-r--r-- 1 root sys 29 Jun 19 11:20 roota04599.err
-rw-r--r-- 1 root sys 74 Jun 19 11:20 roota04599.out
-rw-r--r-- 1 root sys 29 Jun 19 11:33 roota04977.err
-rw-r--r-- 1 root sys 74 Jun 19 11:33 roota04977.out
-rw-r--r-- 1 root sys 29 Jun 19 11:36 roota05039.err
-rw-r--r-- 1 root sys 74 Jun 19 11:36 roota05039.out
-rw-r--r-- 1 root sys 29 Jun 19 11:41 roota05141.err
-rw-r--r-- 1 root sys 74 Jun 19 11:41 roota05141.out
why are it not deleting the old files?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2006 04:44 PM
06-19-2006 04:44 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
a few comments:
1. You don't have to run the dos2ux command every time.
#dos2ux cpu_alert.ksh >/tmp/cpualert.ksh
2. Try to run the commands from the script individually to determine which command is causing the errors.
3. The deletion of th emporary files must be a logic in the script. So if there is no such commands in the script, these temporary files will be never deleted....
Hope this helps!
you may wish to post the content of the script here...
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2006 05:20 PM
06-19-2006 05:20 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
check above Arturo Galbiati's comment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2006 11:17 PM
06-19-2006 11:17 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2006 08:31 PM
08-06-2006 08:31 PM
Re: How can i generate the alterts if CPU utilization goes above 90%
sorry for late reply but I was in vacation.
The temporary files are deleted an the end oif teh script if all went fine, otherwise in case of error they remained on teh error to help you in debug. Please, could you post teh contnet of one of teh .err files?
In seems me that teh script failed.
Rgds,
Art