Howdy,<br><br>I'm running Nagios Version 3.2.0 and I've got a very odd issue with Nagios PNP with stats collection.<br><br><br>We run about 30 instances of Clammy on the server being checked. I have a script which basically collects data about each instance of Clammy from a PS command, parses the data and outputs to Nagios.<br>
I pass specific dataset values via a pipe | to Perfdata and everything works great...as long as I don't try to get data on more than 2 instances of Clammy.<br><br>For example, here's the value of Performance Data when checking only 2 Clammys:<br>
<br>Clam_num=1;Scan_%=68.5;Scan_num=1943;Cache_%=31.5;Cache_num=895;Scan_per_sec=9.5; Clam_num=2;Scan_%=66.7;Scan_num=2552;Cache_%=33.3;Cache_num=1273;Scan_per_sec=12.8;<br><br>That works great, and PNP graphs the values just fine. However, if I make the check for 3 Clammys, I get the following output:<br>
<br>Clam_num=1;Scan_%=68.5;Scan_num=1943;Cache_%=31.5;Cache_num=895;Scan_per_sec=9.5; Clam_num=2;Scan_%=66.7;Scan_num=2552;Cache_%=33.3;Cache_num=1273;Scan_per_sec=12.8; Clam_num:3 Scan_%:67.3 Scan_num:6474 Cache_%:32.7 Cache_num:3143 Scan/sec:32.1 | Clam_num=3;Scan_%=67.3;Scan_num=6474;Cache_%=32.7;Cache_num=3143;Scan_per_sec=32.1;<br>
<br>As you can see, the parser suddenly decides that for Clam_num 3 it's going to insert both the status and performance data into the DS of what should only be performance data.<br><br>When I look at the XML file, the DS that should just contain the value "3" for Clam_num actually contains the entire string of: <br>
"Clam_num:3 Scan_%:67.3 Scan_num:6474 Cache_%:32.7 Cache_num:3143 Scan/sec:32.1 | Clam_num=3;Scan_%=67.3;Scan_num=6474;Cache_%=32.7;Cache_num=3143;Scan_per_sec=32.1;"<br><br>Even stranger, the DS values that follow resume correctly and contain what they should. e.g. The scan_% value for Clam 3 is correct, the Scan_num value is correct, etc.<br>
<br>Am I missing something here or is this the twilight zone?<br><br><br>PHP script on the Nagios box:<br><br>$ds_name[1] = " statistics"; $opt[1] = "-M --title \"Clam stat check for $hostname\" --height=250 --width=800 "; $def[1] = "";<br>
<br>$colors = array(<br><br> 'Clam_num' => '#F90303',<br> 'Scan_%' => '#FC4A4A',<br> 'Scan_num' => '#FC8A8A',<br> 'Cache_%' => '#FBBCBC',<br>
'Cache_num' => '#F906F5',<br> 'Scan_per_sec' => '#F87BF6',<br><br> );<br><br>$keys = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); foreach( $keys as $key){ $def[1] .= "DEF:var$key=$rrdfile:$DS[$key]:AVERAGE " ; $def[1] .= "LINE:var$key".$colors[$NAME[$key]].":\"$NAME[$key]\t\" " ; $def[1] .= "GPRINT:var$key:LAST:\"%1.0lf Max\" "; }<br>
<br>?><br><br><br>Check script that runs on the client and collects the data:<br><br>#!/bin/bash<br><br>ECHO=/bin/echo CUT=/usr/bin/cut GREP=/bin/grep SORT=/usr/bin/sort<br><br>F=/var/log/purewire.log rm /tmp/AVS_clam_*<br>
<br>pid_list=ps axu | $GREP clammy | $GREP -v grep | awk '{print $2}'<br><br>c=0 for x in $pid_list ; do<br><br> let c=c+1<br><br> entry=`$GREP "clammy\[$x\]" $F | $GREP "scan stats" | $SORT | tail -1`<br>
<br> ## AVSCAN data<br> AVSCAN=`$ECHO "$entry" | $CUT -s -d" " -f10`<br> Scan_p=`$ECHO $AVSCAN | $CUT -s -d"|" -f 2`<br> Scan_num=`$ECHO $AVSCAN | $CUT -s -d"|" -f 3 | $CUT -d">" -f 1`<br>
<br> ## CACHE data<br> CACHE=`$ECHO "$entry" | $CUT -s -d" " -f11`<br> Cache_p=`$ECHO $CACHE | $CUT -s -d"|" -f 2`<br> Cache_num=`$ECHO $CACHE | $CUT -s -d"|" -f 3 | $CUT -d">" -f 1`<br>
<br> ## Throughput data<br> TPUT=`$ECHO "$entry" | $CUT -s -d" " -f14`<br> Scan_sec=`$ECHO $TPUT | $CUT -s -d"|" -f 2`<br><br> let Tot=Scan_num+Cache_num<br><br>#echo "Scan %: $Scan_p Number Scanned: $Scan_num"<br>
#echo "Cache %: $Cache_p Cache hits: $Cache_num"<br>#echo "Scans per Sec: $Scan_sec Total Scanned: $Tot"<br><br> #echo $c,$Scan_p,$Scan_num,$Cache_p,$Cache_num,$Scan_sec<br> if [[ $c -le 3 ]]; then<br>
echo $c,$Scan_p,$Scan_num,$Cache_p,$Cache_num,$Scan_sec >> /tmp/AVS_clam_"$c"_stats<br> clammy=`awk -F"," '{ print "Clam_num:" $1 " Scan_%:" $2 " Scan_num:" $3 " Cache_%:" $4 " Cache_num:" $5 " Scan/sec:" $6 " | Clam_num=" $1 ";Scan_%=" $2 ";Scan_num=" $3 ";Cache_%=" $4 ";Cache_num=" $5 ";Scan_per_sec=" $6 ";"}' /tmp/AVS_clam_"$c"_stats`<br>
echo $clammy<br> else<br> exit<br> fi<br><br>done exit 0<br><br>