Need CPU idle performance graph for MIN

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Need CPU idle performance graph for MIN

Post by bojha »

Hi All,

Could anyone please suggest me to achieve this. My performance graph for CPU idle for solaris server is showing for Last, Max and Average and we need to add the Statistics for MIN as well
Below is the environment we are using

Nagios Xi Version--- Nagios XI 2011R1.9

Service Definition

define service {
service_description CPU Stats
use xiwizard_generic_service
hostgroup_name EBPP Database Servers
display_name CPU Stats
check_command orcc_check_cpu_stats!80!95!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts scoates
contact_groups Unix Administration
register 1
}
Command Definition
define command {
command_name orcc_check_cpu_stats
command_line $USER1$/check_cpu_stats.sh -w 70,40,30 -c 90,60,40
}

and the plugin i am using is

check_cpu_stats.sh

Please have a look on attached the Performance graph and let me know for further information.

Thanks in advance

Bijay
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Need CPU idle performance graph for MIN

Post by scottwilkerson »

If you would like to do this system wide you can go to Admin -> graph Templates -> edit default.php and change to the following

Code: Select all

<?php
#
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
# Default Template used if no other template is found.
# Don`t delete this file ! 
# $Id: default.php 647 2009-08-08 15:02:08Z le_loup $
#
#
# Define some colors ..
#
define("_WARNRULE", '#FFFF00');
define("_CRITRULE", '#FF0000');
define("_AREA", '#EACC00');
define("_LINE", '#000000');
#
# Initial Logic ...
#

foreach ($DS as $i) {

	$maximum = "";
	$minimum = "";
	$critical = "";
	$warning = "";
	$vlabel = "";
	
	if ($WARN[$i] != "") {
		$warning = $WARN[$i];
	}
	if ($CRIT[$i] != "") {
		$critical = $CRIT[$i];
	}
	if ($MIN[$i] != "") {
		$lower = " --lower=" . $MIN[$i];
		$minimum = $MIN[$i];
	}
	if ($MAX[$i] != "") {
		$upper = " --upper=" . $MAX[$i];
		$maximum = $MAX[$i];
	}
	if ($UNIT[$i] == "%%") {
		$vlabel = "%";
	}
	else {
		$vlabel = $UNIT[$i];
	}

	$opt[$i] = '--vertical-label "' . $vlabel . '" --title "' . $hostname . ' / ' . $servicedesc . '"' . $lower;

	$def[$i] = "DEF:var1=$rrdfile:$DS[$i]:AVERAGE ";
	$def[$i] .= "AREA:var1" . _AREA . ":\"$NAME[$i] \" ";
	$def[$i] .= "LINE1:var1" . _LINE . ":\"\" ";
	$def[$i] .= "GPRINT:var1:LAST:\"%3.4lf $UNIT[$i] LAST \" ";
	$def[$i] .= "GPRINT:var1:MAX:\"%3.4lf $UNIT[$i] MAX \" ";
	$def[$i] .= "GPRINT:var1:MIN:\"%3.4lf $UNIT[$i] MIN \" ";
	$def[$i] .= "GPRINT:var1:AVERAGE:\"%3.4lf $UNIT[$i] AVERAGE \\n\" ";
	if ($warning != "") {
		$def[$i] .= "HRULE:" . $warning . _WARNRULE . ':"Warning on  ' . $warning . '\n" ';
	}
	if ($critical != "") {
		$def[$i] .= "HRULE:" . $critical . _CRITRULE . ':"Critical on ' . $critical . '\n" ';
	}
	$def[$i] .= 'COMMENT:"Default Template\r" ';
	$def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
}
?>
or you could make a copy of this named orcc_check_cpu_stats.php and upload it through the same page and it will only apply to checks using the command orcc_check_cpu_stats
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: Need CPU idle performance graph for MIN

Post by bojha »

Hi Scott,

I tried both the two ways and found the bellow errors.
Just describing what i did,
1. Created one new file named orcc_check_cpu_stats.php with the content you have given and when i tried to upload that template it is giving the error like
graph Template could not be installed - directory permissions may be incorrect.


2. Then I tried to edit the default.php with the content you have given only single line of code i added to the existing code for MIN below is the code

$def[$i] .= "GPRINT:var1:MIN:\"%3.4lf $UNIT[$i] MIN \" ";

The error i am getting is
Error Writing to file.

Please find attached for the error and suggest me what are the steps i need to follow for this error


Thanks in advance,

Bijay
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Need CPU idle performance graph for MIN

Post by scottwilkerson »

Hmm, somehow we don't have the correct permissions on that directory

lets run

Code: Select all

chmod -R g+w /usr/local/nagios/share/pnp/templates.dist /usr/local/nagios/share/pnp/templates.special/
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bojha
Posts: 55
Joined: Thu Jul 26, 2012 1:18 am

Re: Need CPU idle performance graph for MIN

Post by bojha »

Hi Scott,

lots many thanks for your suggestion finally it worked .

With Regards,

Bijay