centreon-broker
centreon-broker copied to clipboard
Truncated perfdata in Centreon when using --change-perfdata
Originally posted as https://github.com/centreon/centreon-plugins/issues/564, was asked to enter it here.
Centreon Web version: 2.7.7 Centreon Engine version: 1.5.1 Centreon Broker version: 2.11.5 OS: CentOS: 6.8 check_snmp_printer: v3.14159
Initial issue: no graphs created for multiword perfdata because it wasn't escaped, fixed that by escaping $PERFDAT for the CONSUM ALL test in /usr/local/nagios/plugins/check_snmp_printer:
old line:
PERFDAT="$PERFDAT $MARKER_NAME=$CURRENT_CAPACITY;$WARNING;$CRITICAL;"
new line:
PERFDAT="$PERFDAT \'$MARKER_NAME\'=$CURRENT_CAPACITY;$WARNING;$CRITICAL;"
After this the perfdata markers are enclosed in single quotes and Centreon will build graphs.
Current issue: if I want to change the perfdata output, it works OK in a shell but Centreon eats the perfdata starting with the closing single quote and therefore graphing doesn't work:
$ ./centreon_plugins.pl --plugin hardware::printers::standard::rfc3805::plugin --mode markersupply-usage --hostname 1.2.3.4 --warning 15: --critical 10: --change-perfdata 'black,ABCD12E'
OK: Marker supply usages are ok. | 'ABCD12E'=18.00%;15:;10:;0;100
When putting it in a Centreon check:
$USER1$/centreon_plugins.pl --plugin hardware::printers::standard::rfc3805::plugin --snmp-timeout 3 --mode markersupply-usage --hostname '$HOSTADDRESS$' --warning '$ARG1$': --critical '$ARG2$': --change-perfdata "$ARG3$,$ARG4$"
$ mysql -NB centreon_storage -e "select services.perfdata from services where services.command_line like '%markersupply%';"
'ABCD12E
If I change the check to end on "$ARG3$,$ARG4$'", the perfata field will have 'ABCD12E' with a closing singlequote, but the =18.00%;15:;10:;0;100 part will still be missing. If I explicitly put 'black,ABCD12E' in the check instead of "$ARG3$,$ARG4$", again only a single starting quote and no key:value pairs behind it.