Think I have this issue solved now.
In looking through the logic in "process_perfdata.pl" we get this function
Code: Select all
my $string = shift;
my $tmp_string = $string;
$string =~ s/^([^=]+)=([\d\.\-]+)([\w\/%]*);?([\d\.\-:~@]+)?;?([\d\.\-:~@]+)?;?([\d\.\-]+)?;?([\d\.\-]+)?;?\s*//;
if ( $tmp_string eq $string ) {
print_log( "No pattern match in function _parse($string)", 2 );
return undef;
}
A breakdown of that regex (
https://regex101.com/)
Code: Select all
gm
~s matches the characters ~s literally (case sensitive)
\/ matches the character / literally (case sensitive)
^ asserts position at start of a line
1st Capturing Group ([^=]+)
Match a single character not present in the list below [^=]+
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
= matches the character = literally (case sensitive)
= matches the character = literally (case sensitive)
2nd Capturing Group ([\d\.\-]+)
Match a single character present in the list below [\d\.\-]+
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equal to [0-9])
\. matches the character . literally (case sensitive)
\- matches the character - literally (case sensitive)
3rd Capturing Group ([\w\/%]*)
Match a single character present in the list below [\w\/%]*
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\w matches any word character (equal to [a-zA-Z0-9_])
\/ matches the character / literally (case sensitive)
% matches the character % literally (case sensitive)
;?
matches the character ; literally (case sensitive)
? Quantifier — Matches between zero and one times, as many times as possible, giving back as needed (greedy)
4th Capturing Group ([\d\.\-:~@]+)?
? Quantifier — Matches between zero and one times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below [\d\.\-:~@]+
;?
matches the character ; literally (case sensitive)
5th Capturing Group ([\d\.\-:~@]+)?
;?
matches the character ; literally (case sensitive)
6th Capturing Group ([\d\.\-]+)?
;?
matches the character ; literally (case sensitive)
7th Capturing Group ([\d\.\-]+)?
;?
matches the character ; literally (case sensitive)
\s*
matches any whitespace character (equal to [\r\n\t\f\v ])
\/ matches the character / literally (case sensitive)
\/ matches the character / literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
The 2nd group is the culprit for my error.
Code: Select all
2nd Capturing Group ([\d\.\-]+)
Match a single character present in the list below [\d\.\-]+
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equal to [0-9])
\. matches the character . literally (case sensitive)
\- matches the character - literally (case sensitive)
My Performance data output contains strings
process-0-cmd=grafana-server
process-0-status=SLsl
process-0-start-time=Jul13
To workaround this I prepended the values in my scripting with a "."
perfdata.log
Code: Select all
Found Performance Data for linuxmonitor00 / lin--check-cadvisor--grafana7 (process-zero-pid=2007 process-zero-parentpid=1991 process-zero-cmd=.grafana-server process-zero-starttime=.Jul13 process-zero-runningtime=00:03:09 process-zero-cpu=0.1 process-zero-mem=1.4 process-zero-status=.SLsl processcount=1 totalcpu=0.1 totalmem=1.4)
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] No Custom Template found for check-cadvisor (/usr/local/nagios/etc/pnp/check_commands/check-cadvisor.cfg)
2020-07-15 18:05:45 [780689] [2] Template is check-cadvisor.php
2020-07-15 18:05:45 [780689] [2] data2rrd called
2020-07-15 18:05:45 [780689] [2] Reading /usr/local/nagios/etc/pnp/rra.cfg
2020-07-15 18:05:45 [780689] [2] RRDs::create /usr/local/nagios/share/perfdata/linuxmonitor00/lin--check-cadvisor--grafana7.rrd RRA:AVERAGE:0.5:1:2880 RRA:AVERAGE:0.5:5:2880 RRA:AVERAGE:0.5:30:4320 RRA:AVERAGE:0.5:360:5840 RRA:MAX:0.5:1:2880 RRA:MAX:0.5:5:2880 RRA:MAX:0.5:30:4320 RRA:MAX:0.5:360:5840 RRA:MIN:0.5:1:2880 RRA:MIN:0.5:5:2880 RRA:MIN:0.5:30:4320 RRA:MIN:0.5:360:5840 DS:1:GAUGE:8460:U:U DS:2:GAUGE:8460:U:U DS:3:GAUGE:8460:U:U DS:4:GAUGE:8460:U:U DS:5:GAUGE:8460:U:U DS:6:GAUGE:8460:U:U DS:7:GAUGE:8460:U:U DS:8:GAUGE:8460:U:U DS:9:GAUGE:8460:U:U DS:10:GAUGE:8460:U:U DS:11:GAUGE:8460:U:U --start=1594854330 --step=60
2020-07-15 18:05:45 [780689] [2] /usr/local/nagios/share/perfdata/linuxmonitor00/lin--check-cadvisor--grafana7.rrd created
We have Data-Ish!
dataGuage.PNG
I say data-ish because it still wont give you pretty graphs in the Performance Data Explorer or Graph Explorer
PerformanceGraphs.PNG
graphExplorer.PNG
To overcome that issue there's only one fix. Only use numbers after the = sign in Nagios Performance Data.