Skip to content

Commit 63b4963

Browse files
add pnp4nagios template
1 parent b9c7824 commit 63b4963

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

checkCassandraBalance.php

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
$colors = [ '164fbf','ff2e00','337c4f','164fbf','60e060','60c0c0','6060e0','e060e0','c0c0c0' ];
4+
5+
##########################################################################################
6+
#error_log("names: ". join(" ",array_keys($NAME) ) );
7+
#error_log("values: ". join(" ",array_values($NAME) ) );
8+
9+
10+
$nodes = count(array_keys($NAME))/2;
11+
12+
$opt[1] = "--vertical-label \"Load\" -l 0 --title \"cassandra $hostname / $servicedesc\" ";
13+
14+
$counter1=0;
15+
16+
for ( $i=1; $i<=$nodes; $i++) {
17+
if ( $counter1 == 0 ) {
18+
$def[1] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
19+
} else {
20+
$def[1] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
21+
}
22+
$color = $colors[$counter1];
23+
error_log("color ". $color);
24+
$def[1] .= "LINE$i:var$i#$color:\"$NAME[$i]\" " ;
25+
$def[1] .= "GPRINT:var$i:LAST:\"%6.2lf last\" " ;
26+
$def[1] .= "GPRINT:var$i:MAX:\"%6.2lf max\l\" " ;
27+
$counter1++;
28+
}
29+
30+
$opt[2] = "--vertical-label \"Owns\" -l 0 --title \"cassandra $hostname / $servicedesc\" ";
31+
32+
$counter2=0;
33+
34+
for ( $i=($nodes + 1); $i<=($nodes * 2); $i++) {
35+
if ( $counter2 == 0 ) {
36+
$def[2] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
37+
} else {
38+
$def[2] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
39+
}
40+
$color = $colors[$counter2];
41+
error_log("color ". $color);
42+
$def[2] .= "LINE$i:var$i#$color:\"$NAME[$i]\" " ;
43+
$def[2] .= "GPRINT:var$i:LAST:\"%6.2lf last\" " ;
44+
$def[2] .= "GPRINT:var$i:MAX:\"%6.2lf max\l\" " ;
45+
$counter2++;
46+
}
47+
?>

0 commit comments

Comments
 (0)