Page 2 of 2

Re: Service Performance Data not showing for Nagios plugins

Posted: Wed Jan 08, 2020 8:56 am
by cybergene
The perfdata files are located under :

Code: Select all

/usr/local/pnp4nagios/var/perfdata
The OS information :

Code: Select all

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

Re: Service Performance Data not showing for Nagios plugins

Posted: Wed Jan 08, 2020 9:42 am
by tgriep
Follow this procedure to reinstall Grafana.

It is written for Nagios Core. The other link you used earlier was for Nagios XI.
https://support.nagios.com/kb/article/n ... s-803.html

You should only have to start as the Install Grafana section as pnp4nagios is installed and seems to be collection the data.

Re: Service Performance Data not showing for Nagios plugins

Posted: Thu Jan 09, 2020 12:17 pm
by cybergene
@tgriep

Both pages are referring to https://grafana.com/docs/grafana/latest ... on/debian/ to install Grafana whether it is Nagios Core or Nagios XI, which I have done already.

I tried reinstalling and I think i'm good:

Code: Select all

sudo apt-get install grafana
Reading package lists... Done
Building dependency tree
Reading state information... Done
grafana is already the newest version (6.5.2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
I restarted the services again and I'm still not getting any data graphed.

I had those couple error in the grafana.log

Code: Select all

t=2020-01-09T17:04:04+0000 lvl=warn msg="Plugin missing module.js" logger=plugins name=PNP warning="Missing module.js, If you loaded this plugin from git, make sure to compile it." path=/var/lib/grafana/plugins/sni-pnp-datasource/dist/src/module.js
t=2020-01-09T17:04:04+0000 lvl=eror msg="Plugins: Failed to load plugin json file: /var/lib/grafana/plugins/sni-pnp-datasource/dist/src/plugin.json,  err: Failed to register plugin: Plugin with ID \"sni-pnp-datasource\" already exists"
t=2020-01-09T17:04:04+0000 lvl=warn msg="Some plugins failed to load" logger=plugins errors="[Failed to register plugin:\n    github.com/grafana/grafana/pkg/util/errutil.Wrap\n        /go/src/github.com/grafana/grafana/pkg/util/errutil/errors.go:18\n  - Plugin with ID \"sni-pnp-datasource\" already exists]"
Resolved them by doing this:
https://github.com/grafana/simple-json- ... fc58d9a694

and now the logs are clean but the graphs still don't have data.
Screenshot_1.png
Do I need to fix any config for pnp4nagios?

Re: Service Performance Data not showing for Nagios plugins

Posted: Thu Jan 09, 2020 1:01 pm
by tgriep
I would verify that the Grafana settings are pointing to the pnp4nagios performance datafiles.
I suspect that it is not as the files are in this folder

Code: Select all

/usr/local/pnp4nagios/var/perfdata/
when Grafana might be looking in this folder for them.

Code: Select all

/usr/local/nagios/share/perfdata
Another thing, can you login to the server with the pnp4nagios application and verify that the performance data is there?

Re: Service Performance Data not showing for Nagios plugins

Posted: Thu Jan 09, 2020 2:59 pm
by cybergene
installing the pnp4nagios components for Grafana on the sever is causing some errors, it seems to be missing a module.js

Code: Select all

lvl=warn msg="Plugin missing module.js" logger=plugins name=PNP warning="Missing module.js, If you loaded this plugin from git, make sure to compile it." path=/var/lib/grafana/plugins/sni-pnp-datasource/dist/src/module.js
So I moved files around and now the logs are clean.

where in Grafana I can modify this? any specific config file?

Code: Select all

/usr/local/nagios/share/perfdata/ 
Another thing; I got this message in Grafana query inspector

Code: Select all

response:"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Installation</title> <style type="text/css"> body { width: 42em; margin: 0 auto; font-family: sans-serif; font-size: 90%; } #tests table { border-collapse: collapse; width: 100%; } #tests table th, #tests table td { padding: 0.2em 0.4em; text-align: left; vertical-align: top; } #tests table th { width: 12em; font-weight: normal; font-size: 1.2em; } #tests table tr:nth-child(odd) { background: #eee; } #tests table td.pass { color: #191; } #tests table td.fail { color: #911; } #tests table td.warn { background: #ff3; } #tests #results { color: #fff; } #tests #results p { padding: 0.8em 0.4em; } #tests #results p.pass { background: #191; } #tests #results p.fail { background: #911; } #tests #results p.warn { background: #ff3; } </style> </head> <body> <h1>PNP4Nagios Environment Tests</h1> <p>The following options are determined by "configure". If any of the tests have failed, consult the <a href="http://docs.pnp4nagios.org/pnp-0.6/install">documentation</a> for more information on how to correct the problem.</p> <div id="tests"> <table cellspacing="0"> <tr> <th>PNP4Nagios Version</th> <td class="pass">pnp4nagios-0.6.26</td> </tr> <tr> <th>Prefix</th> <td class="pass">/usr/local/pnp4nagios</td> </tr> <tr> <th>Configure Arguments</th> <td class="pass">./configure '--with-perfdata-dir=/usr/local/nagios/share/perfdata' '--with-httpd-conf=/etc/apache2/sites-enabled'</td> </tr> <tr> <th>RRD Storage</th> <td class="pass">/usr/local/nagios/share/perfdata is readable.</td> </tr> <tr> <th>RRDtool Binary</th> <td class="pass">/usr/bin/rrdtool is executable by PHP</td> </tr> <tr> <th>PHP GD extension</th> <td class="pass">Pass</td> </tr> <tr> <th>PHP function proc_open()</th> <td class="pass">Pass</td> </tr> <tr> <th>PHP zlib extension</th> <td class="pass">Pass</td> </tr> <tr> <th>PHP session extension</th> <td class="pass">Pass</td> </tr> <tr> <th>PHP JSON extension</th> <td class="pass">Pass</td> </tr> <th>PHP magic_quotes_gpc</th> <td class="pass">Off</td> </tr> <th>PHP socket extension</th> <td class="pass">Pass</td> </tr> <th>Apache Rewrite Module</th> <td class="warn"><a href="http://docs.pnp4nagios.org/faq/i9">Apache mod_rewrite</a> is not enabled</td> </tr> </tr> </table> </div> <h1>Kohana Environment Tests</h1> <p>The following tests have been run to determine if Kohana will work in your environment. If any of the tests have failed, consult the <a href="http://docs.pnp4nagios.org/pnp-0.6/install">documentation</a> for more information on how to correct the problem.</p> <div id="tests"> <table cellspacing="0"> <tr> <th>PHP Version</th> <td class="pass">7.2.24-0ubuntu0.18.04.1</td> </tr> <tr> <th>System Directory</th> <td class="pass">/usr/local/pnp4nagios/lib/kohana/system/</td> </tr> <tr> <th>Application Directory</th> <td class="pass">/usr/local/pnp4nagios/share/application/</td> </tr> <tr> <th>Reflection Enabled</th> <td class="pass">Pass</td> </tr> <tr> <th>Iconv Extension Loaded</th> <td class="pass">Pass</td> <tr> </tr> <tr> <th>URI Determination</th> <td class="pass">Pass</td> </tr> </table> <div id="results"> <p class="pass">Your environment passed all requirements. Remove or rename the <code>/usr/local/pnp4nagios/share/install.php</code> file now.</p> </div> </div> </body> </html> "
I can point out that the following is the wrong location but I can't find the config file for that?

Code: Select all

/usr/local/pnp4nagios</td> </tr> <tr> <th>Configure Arguments</th> <td class="pass">./configure '--with-perfdata-dir=/usr/local/nagios/share/perfdata' '--with-httpd-conf=/etc/apache2/sites-enabled'</td> </tr> <tr> <th>RRD Storage</th> <td class="pass">/usr/local/nagios/share/perfdata is readabl

The data is located here:
Screenshot_2.png
Also, I replaced all the instances of

Code: Select all

/usr/local/nagios/share/perfdata

with

Code: Select all

/usr/local/pnp4nagios/var/perfdata/
in all the files under this folder:

Code: Select all

/usr/local/pnp4nagios/libexec/
-rwxr-xr-x 1 nagios nagios  8119 Jan  7 16:58 check_pnp_rrds.pl*
-rwxr-xr-x 1 nagios nagios 55045 Jan  9 19:50 process_perfdata.pl*
-rwxr-xr-x 1 nagios nagios 14988 Jan  7 16:58 rrd_convert.pl*
-rwxr-xr-x 1 nagios nagios  7855 Jan  7 16:58 rrd_modify.pl*
root@XXXXXXXX:/usr/local/pnp4nagios/libexec# vi 
but the wrong folder location is still showing and the graphs are empty....

Re: Service Performance Data not showing for Nagios plugins

Posted: Thu Jan 09, 2020 4:11 pm
by tgriep
We currently do not have Grafana running so you should take a look at Grafana's site for configuration file locations.
Look here for more info.
https://grafana.com/docs/grafana/latest ... on/debian/
Is says that the configuration file is here

Code: Select all

/etc/grafana/grafana.ini

Re: Service Performance Data not showing for Nagios plugins

Posted: Fri Jan 10, 2020 11:08 am
by cybergene
Yes, I figured that out, but there is nothing related to the perfdata files in there.

I have some good news though, I re-install pnp4nagios alone and now this:

Code: Select all

If any of the tests have failed, consult the <a href="http://docs.pnp4nagios.org/pnp-0.6/install">documentation</a> for more information on how to correct the problem.</p> <div id="tests"> <table cellspacing="0"> <tr> <th>PNP4Nagios Version</th> <td class="pass">pnp4nagios-0.6.26</td> </tr> <tr> <th>Prefix</th> <td class="pass">/usr/local/pnp4nagios</td> </tr> <tr> <th>Configure Arguments</th> <td class="pass">./configure '--with-nagios-user=nagios' '--with-nagios-group=nagios'</td> </tr> <tr> <th>RRD Storage</th> <td class="pass">/usr/local/pnp4nagios/var/perfdata is readable.</td>

Looks better and it has the correct perfdata location:

Code: Select all

/usr/local/pnp4nagios/var/perfdata
Questions:

1-Any specific user to configure pnp4nagios with? as you can see above, I have nagios user in there, is that correct?

2- The timestamp on the perfdata files is changing but the sizes are not, why is that?
Screenshot_4.png

Re: Service Performance Data not showing for Nagios plugins

Posted: Fri Jan 10, 2020 12:11 pm
by tgriep
1. Nagios user is correct.
2. RRD files are round robin databases, as new data comes in, old is removed and they stay fixed in size.
https://en.wikipedia.org/wiki/RRDtool

Re: Service Performance Data not showing for Nagios plugins

Posted: Tue Jan 14, 2020 8:23 am
by cybergene
I solved the problems with Grafana, it was pnp4nagios that had errors.

1. When I try to browse to http://nagios_ip/pnp4nagios/graph?host=hostname, I was getting

Code: Select all

PNP4Nagios Version 0.6.26
Please check the documentation for information about the following error.
Call to undefined function simplexml_load_file()
file [line]:
application/models/data.php [270]:
and to solve, there was a thread about it in the forum:
https://support.nagios.com/forum/viewto ... =7&t=53095 and the solution is

Code: Select all

sudo apt-get install php7.2-simplexml
sudo systemctl restart npcd.service
sudo systemctl restart apache2
2. Now, the 2nd error appeared:

Code: Select all

sizeof(): Parameter must be an array or an object that implements Countable
file [line]:
application/models/data.php *[979]:*
Also from that same thread, to solve this error one need to fix the data.php model

Code: Select all

go to /usr/local/pnp4nagios/share/application/models
sudo vi data.php
Replace it (in two places)

Code: Select all

if(sizeof($pages) > 0 ){
with

Code: Select all

if(is_arrary($pages) && sizeof($pages) > 0 ){
Source: https://github.com/lingej/pnp4nagios/issues/148

and restart apache2,

sudo systemctl restart npcd.service
sudo systemctl restart apache2


Test it by browsing to http://nagios_ip/pnp4nagios/graph?host=hostname, and the graphs should show up
Screenshot_5.png
If you try the Grafana visualizations , they will work.
Screenshot_6.png
Thank you for the help and you can close this thread ! :)

Re: Service Performance Data not showing for Nagios plugins

Posted: Tue Jan 14, 2020 11:15 am
by scottwilkerson
cybergene wrote:I solved the problems with Grafana, it was pnp4nagios that had errors.

1. When I try to browse to http://nagios_ip/pnp4nagios/graph?host=hostname, I was getting

Code: Select all

PNP4Nagios Version 0.6.26
Please check the documentation for information about the following error.
Call to undefined function simplexml_load_file()
file [line]:
application/models/data.php [270]:
and to solve, there was a thread about it in the forum:
https://support.nagios.com/forum/viewto ... =7&t=53095 and the solution is

Code: Select all

sudo apt-get install php7.2-simplexml
sudo systemctl restart npcd.service
sudo systemctl restart apache2
2. Now, the 2nd error appeared:

Code: Select all

sizeof(): Parameter must be an array or an object that implements Countable
file [line]:
application/models/data.php *[979]:*
Also from that same thread, to solve this error one need to fix the data.php model

Code: Select all

go to /usr/local/pnp4nagios/share/application/models
sudo vi data.php
Replace it (in two places)

Code: Select all

if(sizeof($pages) > 0 ){
with

Code: Select all

if(is_arrary($pages) && sizeof($pages) > 0 ){
Source: https://github.com/lingej/pnp4nagios/issues/148

and restart apache2,

sudo systemctl restart npcd.service
sudo systemctl restart apache2


Test it by browsing to http://nagios_ip/pnp4nagios/graph?host=hostname, and the graphs should show up
Screenshot_5.png
If you try the Grafana visualizations , they will work.
Screenshot_6.png
Thank you for the help and you can close this thread ! :)
great!

Locking