Latest metrics component

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Latest metrics component

Post by BanditBBS »

Ok, so after every upgrade I used to heavily modify the /usr/local/nagiosxi/html/includes/utils-metrics.inc.php file to make it work like I needed. Basically I removed the details column and also made it work with my perfdata and settings. I of course no longer need to remove the details column(THANK YOU!) but the metrics still aren't working with my perfdata for either CPU or MEMORY, the two I need :(

Lets talk about CPU(for linux, using NRPE and the check_cpu_stats.sh plugin with the nrpe command of check_cpu):
I see it is checking the command for check_nrpe, which we are using that plugin and then further looking in that for check_cpu_stats. 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.

Any idea what else I am missing?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Latest metrics component

Post by lmiltchev »

The CPU checks are showing up for me.
example01.PNG
Maybe some of the files didn't get updated for you. Backup your XI server (snapshot it, etc.), remove the "Metrics" component then force upgrade:

Code: Select all

cd /tmp/nagiosxi
./upgrade -f
The "-f" flag should force the update of all components, wizards, dashlets, etc. Let me know if this helped.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Latest metrics component

Post by BanditBBS »

Ludmil, yeah, but your setup is probably exactly what its looking for, hence why I have to remove the _stats part as I said in opening post. Also though, look at your image, the bottom one(nrpe, which I want to use) is wrong. The percent used is 0 but if you add up the user and system it should be showing 5.56%, so there has to be an issue with it there anyway.

Also, I can verify all the files are fresh and the proper version.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Latest metrics component

Post by lmiltchev »

Hm-m-m, you have a point. I will do some more digging into this and ask Luke to check this out. He was working on the Metrics component and will be able to find a solution.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Latest metrics component

Post by lmiltchev »

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)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Latest metrics component

Post by BanditBBS »

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);
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Latest metrics component

Post by lmiltchev »

I posted an internal bug report about the "0% Utilization" issue in the Metrics component (TASK ID 6717).
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.
It is difficult to include all of the custom plugins and make them work with the Metrics component. We wouldn't even know how they handle perfdata and how to parse the output. However, we are planning on adding a section where you could input a custom command. I don't have an ETA on this - just wanted to give you heads up. Any other mods would be a "custom development".
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked