Page 1 of 2

On perfdata, / (forward slash) gets converted to _

Posted: Tue Dec 31, 2013 11:47 am
by linuxnag
Ok, I am sorry if this is an obvious question but I am stumped.

My custom plugin has output of:

Code: Select all

All filesystems optimal: "/ - 71%", "/boot - 14%", "/opt - 4%", "/tmp - 5%", "/cust - 1%", "/var - 4%" | /=71%;75;90;0 /boot=14%;75;90;0 /opt=4%;75;90;0 /tmp=5%;75;90;0 /cust=1%;75;90;0 /var=4%;75;90;0
On the performance graphs the "/" gets translated to underscore.
So the graph label is something like: Datasource: _

The Nagios plugin development guidelines, do not say that "/" is a bad character:

"label can contain any characters except the equals sign or single quote (')"

What am I doing wrong?

Thanks in advance

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 11:49 am
by abrist
I am not seeing this behavior over here.
1) Are you using pnp4ngaios and saving to rrds?
2) Can you post a copy of your custom script (in code wraps or attached)?

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 1:28 pm
by linuxnag
In order to see the data, all I did was:
on CC, "Services", for this service I checked:
"Process perf data " to "on".

Then nagios ran my script.

BTW, on the "Service Status Detail"
"Advanced" tab, I see this:

Code: Select all

Performance Data:
/=30%;75;90;0 /boot=8%;75;90;0 /opt=7%;75;90;0 /tmp=5%;75;90;0 /cust=1%;75;90;0 /var=10%;75;90;0
So, the "/" slashes do make it to NagiosXI

Here is the script:
check_all_localfs.sh

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 1:42 pm
by abrist
Interesting. My XI test box has multiple checks that return "/" in the perfdata without any issues. What does the xml for the check's rrd look like?

Code: Select all

cat /usr/local/nagios/share/perfdata/<remote hostname>/<check>.xml
replace <remote hostname> with teh host name of teh box in question and <check> with the name of the disk check.

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 2:09 pm
by linuxnag
This is the .xml file:
Note: The line numbers are added by me (vim).
They are not part of the file

Code: Select all

  1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2 <NAGIOS>
  3   <DATASOURCE>
  4     <TEMPLATE>check_nrpe</TEMPLATE>
  5     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
  6     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
  7     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
  8     <IS_MULTI>0</IS_MULTI>
  9     <DS>1</DS>
 10     <NAME>_</NAME>
 11     <LABEL>/</LABEL>
 12     <UNIT>%%</UNIT>
 13     <ACT>30</ACT>
 14     <WARN>75</WARN>
 15     <WARN_MIN></WARN_MIN>
 16     <WARN_MAX></WARN_MAX>
 17     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
 18     <CRIT>90</CRIT>
 19     <CRIT_MIN></CRIT_MIN>
 20     <CRIT_MAX></CRIT_MAX>
 21     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
 22     <MIN>0</MIN>
 23     <MAX></MAX>
 24   </DATASOURCE>
 25   <DATASOURCE>
 26     <TEMPLATE>check_nrpe</TEMPLATE>
 27     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
 28     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
 29     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
 30     <IS_MULTI>0</IS_MULTI>
 31     <DS>2</DS>
 32     <NAME>_boot</NAME>
 33     <LABEL>/boot</LABEL>
 34     <UNIT>%%</UNIT>
 35     <ACT>8</ACT>
 36     <WARN>75</WARN>
 37     <WARN_MIN></WARN_MIN>
 38     <WARN_MAX></WARN_MAX>
 39     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
 40     <CRIT>90</CRIT>
 41     <CRIT_MIN></CRIT_MIN>
 42     <CRIT_MAX></CRIT_MAX>
 43     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
 44     <MIN>0</MIN>
 45     <MAX></MAX>
 46   </DATASOURCE>
 47   <DATASOURCE>
 48     <TEMPLATE>check_nrpe</TEMPLATE>
 49     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
 50     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
 51     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
 52     <IS_MULTI>0</IS_MULTI>
 53     <DS>3</DS>
 54     <NAME>_opt</NAME>
 55     <LABEL>/opt</LABEL>
 56     <UNIT>%%</UNIT>
 57     <ACT>7</ACT>
 58     <WARN>75</WARN>
 59     <WARN_MIN></WARN_MIN>
 60     <WARN_MAX></WARN_MAX>
 61     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
 62     <CRIT>90</CRIT>
 63     <CRIT_MIN></CRIT_MIN>
 64     <CRIT_MAX></CRIT_MAX>
 65     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
 66     <MIN>0</MIN>
 67     <MAX></MAX>
 68   </DATASOURCE>
 69   <DATASOURCE>
 70     <TEMPLATE>check_nrpe</TEMPLATE>
 71     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
 72     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
 73     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
 74     <IS_MULTI>0</IS_MULTI>
 75     <DS>4</DS>
 76     <NAME>_tmp</NAME>
 77     <LABEL>/tmp</LABEL>
 78     <UNIT>%%</UNIT>
 79     <ACT>5</ACT>
 80     <WARN>75</WARN>
 81     <WARN_MIN></WARN_MIN>
 82     <WARN_MAX></WARN_MAX>
 83     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
 84     <CRIT>90</CRIT>
 85     <CRIT_MIN></CRIT_MIN>
 86     <CRIT_MAX></CRIT_MAX>
 87     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
 88     <MIN>0</MIN>
 89     <MAX></MAX>
 90   </DATASOURCE>
 91   <DATASOURCE>
 92     <TEMPLATE>check_nrpe</TEMPLATE>
 93     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
 94     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
 95     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
 96     <IS_MULTI>0</IS_MULTI>
 97     <DS>5</DS>
 98     <NAME>_cust</NAME>
 99     <LABEL>/cust</LABEL>
100     <UNIT>%%</UNIT>
101     <ACT>1</ACT>
102     <WARN>75</WARN>
103     <WARN_MIN></WARN_MIN>
104     <WARN_MAX></WARN_MAX>
105     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
106     <CRIT>90</CRIT>
107     <CRIT_MIN></CRIT_MIN>
108     <CRIT_MAX></CRIT_MAX>
109     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
110     <MIN>0</MIN>
111     <MAX></MAX>
112   </DATASOURCE>
113   <DATASOURCE>
114     <TEMPLATE>check_nrpe</TEMPLATE>
115     <RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</RRDFILE>
116     <RRD_STORAGE_TYPE>SINGLE</RRD_STORAGE_TYPE>
117     <RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
118     <IS_MULTI>0</IS_MULTI>
119     <DS>6</DS>
120     <NAME>_var</NAME>
121     <LABEL>/var</LABEL>
122     <UNIT>%%</UNIT>
123     <ACT>10</ACT>
124     <WARN>75</WARN>
125     <WARN_MIN></WARN_MIN>
126     <WARN_MAX></WARN_MAX>
127     <WARN_RANGE_TYPE></WARN_RANGE_TYPE>
128     <CRIT>90</CRIT>
129     <CRIT_MIN></CRIT_MIN>
130     <CRIT_MAX></CRIT_MAX>
131     <CRIT_RANGE_TYPE></CRIT_RANGE_TYPE>
132     <MIN>0</MIN>
133     <MAX></MAX>
134   </DATASOURCE>
135   <RRD>
136     <RC>0</RC>
137     <TXT>successful updated</TXT>
138   </RRD>
139   <NAGIOS_AUTH_HOSTNAME>vemd2-ool001.srv.hcvlny.cv.net</NAGIOS_AUTH_HOSTNAME>
140   <NAGIOS_AUTH_SERVICEDESC>NRPE Check Local FS</NAGIOS_AUTH_SERVICEDESC>
141   <NAGIOS_CHECK_COMMAND>check_nrpe!check_all_localfs!!!!!!!</NAGIOS_CHECK_COMMAND>
142   <NAGIOS_DATATYPE>SERVICEPERFDATA</NAGIOS_DATATYPE>
143   <NAGIOS_DISP_HOSTNAME>vemd2-ool001.srv.hcvlny.cv.net</NAGIOS_DISP_HOSTNAME>
144   <NAGIOS_DISP_SERVICEDESC>NRPE Check Local FS</NAGIOS_DISP_SERVICEDESC>
145   <NAGIOS_HOSTNAME>vemd2-ool001.srv.hcvlny.cv.net</NAGIOS_HOSTNAME>
146   <NAGIOS_HOSTSTATE>UP</NAGIOS_HOSTSTATE>
147   <NAGIOS_HOSTSTATETYPE>HARD</NAGIOS_HOSTSTATETYPE>
148   <NAGIOS_MULTI_PARENT></NAGIOS_MULTI_PARENT>
149   <NAGIOS_PERFDATA>/=30%;75;90;0 /boot=8%;75;90;0 /opt=7%;75;90;0 /tmp=5%;75;90;0 /cust=1%;75;90;0 /var=10%;75
150   <NAGIOS_RRDFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.rrd</NAG
151   <NAGIOS_SERVICECHECKCOMMAND>check_nrpe!check_all_localfs!!!!!!!</NAGIOS_SERVICECHECKCOMMAND>
152   <NAGIOS_SERVICEDESC>NRPE_Check_Local_FS</NAGIOS_SERVICEDESC>
153   <NAGIOS_SERVICEOUTPUT>[Stage] All filesystems optimal: / - 30%, /boot - 8%, /opt - 7%, /tmp - 5%, /cust - 1%
154   <NAGIOS_SERVICEPERFDATA>/=30%;75;90;0 /boot=8%;75;90;0 /opt=7%;75;90;0 /tmp=5%;75;90;0 /cust=1%;75;90;0 /var
155   <NAGIOS_SERVICESTATE>OK</NAGIOS_SERVICESTATE>
156   <NAGIOS_SERVICESTATETYPE>HARD</NAGIOS_SERVICESTATETYPE>
157   <NAGIOS_TIMET>1388689223</NAGIOS_TIMET>
158   <NAGIOS_XMLFILE>/usr/local/nagios/share/perfdata/vemd2-ool001.srv.hcvlny.cv.net/NRPE_Check_Local_FS.xml</NAG
159   <XML>
160    <VERSION>4</VERSION>
161   </XML>
162 </NAGIOS>

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 2:48 pm
by abrist
You could probably check the <NAME> value to what ever you desire. Our wizards usually do this for the user, but If you are using your own plugins, you may have to pay attention to the naming convention of the datasources.

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 3:15 pm
by linuxnag
If I manually change the .xml file, do I need to change it anywhere else?

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 3:48 pm
by abrist
Nope.

Re: On perfdata, / (forward slash) gets converted to _

Posted: Thu Jan 02, 2014 4:02 pm
by linuxnag
I am sorry but that's simply not the case.

From this dir:

Code: Select all

/usr/local/nagios/share/perfdata
I run:

Code: Select all

for ii in `find . -name NRPE_Check_Local_FS.xml`; do sed 's#<NAME>_#<NAME>/#g' $ii >/tmp/NN.chg; mv /tmp/NN.chg $ii;done
And I change all the .xml files.
A few minutes later, they go back to the "_" names.

It seems this .xml file is created dynamically.

So, where do I need to change it?

Re: On perfdata, / (forward slash) gets converted to _

Posted: Fri Jan 03, 2014 10:36 am
by abrist
Interesting. I have multiple xmls that I have changed and they stay changed. This may have something to do with the template, or maybe my graphs are not updating the xml - I will check this further. Is this a standard nrpe rrd template?

Lets try wrapping the performance output labels in single quotes in your script so output resembles:

Code: Select all

All filesystems optimal: "/ - 71%", "/boot - 14%", "/opt - 4%", "/tmp - 5%", "/cust - 1%", "/var - 4%" | '/'=71%;75;90;0 '/boot'=14%;75;90;0 '/opt'=4%;75;90;0 '/tmp'=5%;75;90;0 '/cust'=1%;75;90;0 '/var'=4%;75;90;0
https://www.nagios-plugins.org/doc/guid ... tml#AEN200