
PNP templates problem
-
- Posts: 10
- Joined: Wed Jun 01, 2011 3:36 am
Re: PNP templates problem
Ok, I'll be back at work on friday - I'll send you all this than 

-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: PNP templates problem
Alrighty, good luck!
-
- Posts: 10
- Joined: Wed Jun 01, 2011 3:36 am
Re: PNP templates problem
Hi,
It took a little longer, but here is the live instance:
There are 2 services under localhost:
define service {
host_name localhost
service_description FS1 Used
use template1
check_command check_disks! -p / -p /store!!!!!!!
register 1
}
define service {
host_name localhost
service_description FS2 Used
use template1
check_command check_disks! -p / -p /store -p /boot!!!!!!!
register 1
}
First one check 2 file-systems, while second one checks 3 file-systems.
The PNP template file looks like this:
<?php
if(isset($DS[1])) {
$opt[1] = "--vertical-label \"MB\" -l0 --title \"$hostname - 1\" ";
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "AREA:var1#FF0000:\"Space used \" " ;
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
}
if(isset($DS[2])) {
$opt[2] = "--vertical-label \"MB\" -l0 --title \"$hostname - 2\" ";
$def[2] = "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
$def[2] .= "AREA:var2#00AA00:\"Space used \" " ;
$def[2] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
$def[2] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
$def[2] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
}
if(isset($DS[3])) {
$opt[3] = "--vertical-label \"MB\" -l0 --title \"$hostname - 3\" ";
$def[3] = "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
$def[3] .= "AREA:var3#0000BB:\"Space used \" " ;
$def[3] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
$def[3] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
$def[3] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
}
?>
Than - looking at the service's FS1 Used Performance graphs tab I get 2 graphs with one (last) empty placeholder. For FS2 Used - I get 3 performance graphs (as expected).
So the problem is this third empty placeholder for the firs service - it shouldn't appear since there is no DS[3] defined. (I can provide You with print screens of this - just let me know where to send them).
Michalux
It took a little longer, but here is the live instance:
There are 2 services under localhost:
define service {
host_name localhost
service_description FS1 Used
use template1
check_command check_disks! -p / -p /store!!!!!!!
register 1
}
define service {
host_name localhost
service_description FS2 Used
use template1
check_command check_disks! -p / -p /store -p /boot!!!!!!!
register 1
}
First one check 2 file-systems, while second one checks 3 file-systems.
The PNP template file looks like this:
<?php
if(isset($DS[1])) {
$opt[1] = "--vertical-label \"MB\" -l0 --title \"$hostname - 1\" ";
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "AREA:var1#FF0000:\"Space used \" " ;
$def[1] .= "GPRINT:var1:LAST:\"%6.2lf last\" " ;
$def[1] .= "GPRINT:var1:AVERAGE:\"%6.2lf avg\" " ;
$def[1] .= "GPRINT:var1:MAX:\"%6.2lf max\\n\" " ;
}
if(isset($DS[2])) {
$opt[2] = "--vertical-label \"MB\" -l0 --title \"$hostname - 2\" ";
$def[2] = "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
$def[2] .= "AREA:var2#00AA00:\"Space used \" " ;
$def[2] .= "GPRINT:var2:LAST:\"%6.2lf last\" " ;
$def[2] .= "GPRINT:var2:AVERAGE:\"%6.2lf avg\" " ;
$def[2] .= "GPRINT:var2:MAX:\"%6.2lf max\\n\" " ;
}
if(isset($DS[3])) {
$opt[3] = "--vertical-label \"MB\" -l0 --title \"$hostname - 3\" ";
$def[3] = "DEF:var3=$rrdfile:$DS[3]:AVERAGE " ;
$def[3] .= "AREA:var3#0000BB:\"Space used \" " ;
$def[3] .= "GPRINT:var3:LAST:\"%6.2lf last\" " ;
$def[3] .= "GPRINT:var3:AVERAGE:\"%6.2lf avg\" " ;
$def[3] .= "GPRINT:var3:MAX:\"%6.2lf max\\n\" " ;
}
?>
Than - looking at the service's FS1 Used Performance graphs tab I get 2 graphs with one (last) empty placeholder. For FS2 Used - I get 3 performance graphs (as expected).
So the problem is this third empty placeholder for the firs service - it shouldn't appear since there is no DS[3] defined. (I can provide You with print screens of this - just let me know where to send them).
Michalux
-
- Posts: 10
- Joined: Wed Jun 01, 2011 3:36 am
Re: PNP templates problem
Anyone can help with the pnp templates problem ??