lmiltchev wrote:I changed all instances of check_cpu_stats to just check_cpu but no luck, nothing shows up when I run metrics for a hostgroup that contains about 8 servers that have a CPU service defined using the command I described above.
BanditBBS, can you show us the actual config (with the mods you made)?
Hey, I fixed CPU for me. Here are the code changes I just made to make the metrics component work for me for CPU(working on memory now):
Code: Select all
189 if (preg_match("/check_cpu_stats/", $command) > 0) {
to
189 if (preg_match("/check_cpu/", $command) > 0) {
318 } else if (preg_match("/check_cpu_stats/", $command) > 0) { // NRPE
to
318 } else if (preg_match("/check_cpu/", $command) > 0) { // NRPE
539 if (preg_match("/check_cpu_stats/", $command) > 0) {
to
539 if (preg_match("/check_cpu/", $command) > 0) {
I then remove lines 516 - 536
I then remove lines 520 - 535
I then add these:
Code: Select all
520 //inserted by Bandit
521 $perfpartsa = explode("=", $perfdata);
522 $perfpartsb = explode(";", $perfpartsa[1]);
523 $perfpartsc = explode(";", $perfpartsa[2]);
524 $perfpartsd = explode(";", $perfpartsa[3]);
525 $cpuuser = floatval(grab_array_var($perfpartsb, 0, 0));
526 $cpusystem = floatval(grab_array_var($perfpartsc, 0, 0));
527 $cpuiowait = floatval(grab_array_var($perfpartsd, 0, 0));
528 $warn = floatval(grab_array_var($perfpartsb, 1, 0));
529 $crit = floatval(grab_array_var($perfpartsb, 2, 0));
530 $usage = number_format(($cpuuser + $cpusystem + $cpuiowait), 1);
531 //end insert
I realize this might just be for me, but many others may be using the same plugins I do and may not add the word "stats" to their nrpe command name. Working on memory fixes now
edit:
For memory I then do this:
remove lines 541 to 556
Then add:
Code: Select all
541 $perfpartsa = explode("=", $perfdata);
542 $perfpartsb = explode(";", $perfpartsa[1]);
543 $perfpartsc = explode(";", $perfpartsa[2]);
544 $perfpartsd = explode(";", $perfpartsa[3]);
545
546 $current = floatval(grab_array_var($perfpartsc, 0, 0));
547 $uom = "";
548 $warn = floatval(grab_array_var($perfpartsc, 1, 0));
549 $crit = floatval(grab_array_var($perfpartsc, 2, 0));
550 $min = floatval(grab_array_var($perfpartsb, 3, 0));
551 $max = floatval(grab_array_var($perfpartsb, 0, 0));
552 $usage = number_format(100-(($max - $current) / $max * 100), 1);