- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Nagios graph for CPU utilisation
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
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
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
01-04-2016 03:18 AM
01-04-2016 03:18 AM
Hi, Am trying to configure nagios graphs for cpu utilisation , but when am trying below .pl file am getting only %usr calculation , as a result of which my main aim of using Nagios is gone for toss.
It must actually show usr+sys .
#!/usr/bin/perl
#**************************************************************
#Plugin Nagios chequear uso CPU
# Configurar el en nrpe de hp-ux
# Integracion en nrpe, en la seccion del archivo nrpe.cfg, "The following examples use hardcoded command arguments...", incluir la linea:
# command[check_hpux_cpu]=/opt/nrpe/libexec/check_hpux_cpu.pl -w 80 -c 90
# Realizador: Jaime Andres Cardona
# Correo: ja_an_ca@hotmail.com
# Version: 1.0
# Fecha: 2011-Oct-26
use Getopt::Long;
&Getopt::Long::config('auto_abbrev');
my $numbarg = @ARGV;
($numbarg < 2) && &show_help;
my %STATUSCODE = ( 'UNKNOWN' => '-1',
'OK' => '0',
'WARNING' => '1',
'CRITICAL' => '2');
sub show_help {
printf("usage: ./check_hpux_cpu.pl -w # -c #\n
options:
-w warning threshold (%)
-c critical threshold (%)
");
exit($STATUSCODE{"UNKNOWN"});
}
$status = GetOptions( "warn=s", \$warn,
"crit=i", \$crit);
open(PS, "/usr/bin/vmstat 1 4 | egrep -v '[a-z,A-Z]|-' |egrep '[0-9]' |") || return 1;
while (<PS>) {
(undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$idle,undef) = split(/[\t \n]+/);
$tidle = $tidle + $idle;
}
$usage = $tidle / 4;
if ($usage >= $crit) {
printf("CRITICAL - CPU usage at $usage% | 'CPU Load'=$usage%;$warn;$crit;0;100\n");
exit($STATUSCODE{"CRITICAL"});
}
elsif ($usage >= $warn) {
printf("WARNING - CPU usage at $usage% | 'CPU Load'=$usage%;$warn;$crit;0;100\n");
exit($STATUSCODE{"WARNING"});
}
elsif ($usage < $warn) {
printf("OK - CPU usage at $usage% | 'CPU Load'=$usage%;$warn;$crit;0;100\n");
exit($STATUSCODE{"OK"});
}
else {
printf("UNKNOWN - unable to determin usage\n");
exit($STATUSCODE{"UNKNOWN"});
}
=================================================================
root #/opt/iexpress/nagios/libexec >vmstat 1 4
procs memory page faults cpu
r b w avm free re at pi po fr de sr in sy cs us sy id
5 6 0 23693444 24475061 0 0 9 0 0 0 0 23909 1509482 63321 15 10 74
5 6 0 23693444 24699477 0 0 1 0 0 0 0 21800 779633 13934 14 12 75
5 6 0 23693444 24781023 0 0 1 0 0 0 0 21439 762179 15067 10 8 82
5 6 0 23693444 24478642 0 0 1 0 0 0 0 21385 829326 16418 15 15 70
root #/opt/iexpress/nagios/libexec >/opt/iexpress/nagios/libexec/check_hpux_cpu.pl -w 80 -c 90
OK - CPU usage at 11.25% | 'CPU Load'=11.25%;80;90;0;100
Solved! Go to Solution.
- Tags:
- nagios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 12:07 AM