No graphs - pnp4nagios - cosmetic verify_pnp_config error - fix PHP deprecated methods

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Nyle
Posts: 2
Joined: Mon Jul 01, 2024 12:16 pm

No graphs - pnp4nagios - cosmetic verify_pnp_config error - fix PHP deprecated methods

Post by Nyle »

I am hoping somebody can help me get past this hurdle with pnp4nagios.

Running RHEL 8.
Followed this guide - https://support.nagios.com/kb/article/n ... s-801.html

/root/pnp4nagios-0.6.26/scripts/verify_pnp_config_v2.pl -m bulk+npcd -c /usr/local/nagios/etc/nagios.cfg -p /usr/local/pnp4nagios/etc/

Code: Select all

[INFO]  Nagios config looks good so far
[INFO]  ========== Checking config values ============
[OK  ]  npcd daemon is running
[OK  ]  /usr/local/pnp4nagios/etc/npcd.cfg is used by npcd and readable
[INFO]  Reading /usr/local/pnp4nagios/etc/npcd.cfg
[OK  ]  perfdata_spool_dir is defined
[OK  ]  perfdata_spool_dir=/usr/local/pnp4nagios/var/spool
[OK  ]  -1 files found in /usr/local/pnp4nagios/var/spool
service_perfdata_file_processing_command at /root/pnp4nagios-0.6.26/scripts/verify_pnp_config_v2.pl line 462.
[CRIT]  Command process-service-perfdata-file-bulk-npcd is not defined 
/usr/local/nagios/etc/objects/commands.cfg contains -

Code: Select all

define command {
    command_name    process-service-perfdata-file-bulk-npcd
    command_line    /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
    }

define command {
    command_name    process-host-perfdata-file-bulk-npcd
    command_line    /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
    }
/usr/local/nagios/etc/nagios.cfg contains -
cfg_file=/usr/local/nagios/etc/objects/commands.cfg

The data in /usr/local/pnp4nagios/var/perfdata/localhost is updating.

The /usr/local/pnp4nagios/var/perfdata/service-perfdata and /usr/local/pnp4nagios/var/perfdata/host-perfdata files exist they are 0 in size and I see in /var/log/messages, now that I turned deugging on, that they are being moved every 15 seconds into spool.

# cat /etc/httpd/conf.modules.d/* | grep mod_rewrite
LoadModule rewrite_module modules/mod_rewrite.so

graphs show broken and I can't understand why verify_pnp_config_v2.pl is throwing an error on a specific line in the file saying the command is not defined. I've tried to not bother anyone with this but if someone has a moment to see if they can see what I mis-configured while using the guide it would be appreciated. Thank you.

/var/log/messages - (It appears the npcd is processing the performance data. Still at a loss why the graphs are broken links.)

Code: Select all

Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Found 4 files in /usr/local/pnp4nagios/var/spool
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: ThreadCounter 0/5 File is .
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: ThreadCounter 0/5 File is ..
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: ThreadCounter 0/5 File is host-perfdata.1719861228
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Regular File: host-perfdata.1719861228
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: A thread was started on thread_counter = 0
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: ThreadCounter 1/5 File is service-perfdata.1719861229
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Regular File: service-perfdata.1719861229
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: A thread was started on thread_counter = 1
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Have to wait: Filecounter = 2 - thread_counter = 2
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Processing file host-perfdata.1719861228 with ID 140688057685760 - going to exec /usr/local/pnp4nagios/libexec/process_perfdata.pl -n --bulk /usr/local/pnp4nagios/var/spool/host-perfdata.1719861228
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Processing file 'host-perfdata.1719861228'
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Processing file service-perfdata.1719861229 with ID 140688049293056 - going to exec /usr/local/pnp4nagios/libexec/process_perfdata.pl -n --bulk /usr/local/pnp4nagios/var/spool/service-perfdata.1719861229
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: Processing file 'service-perfdata.1719861229'
Jul  1 15:13:52 lx-vm-nagios NPCD[9662]: No more files to process... waiting for 15 seconds
You do not have the required permissions to view the files attached to this post.
Last edited by Nyle on Mon Jul 01, 2024 3:15 pm, edited 1 time in total.
Nyle
Posts: 2
Joined: Mon Jul 01, 2024 12:16 pm

Re: No graphs - pnp4nagios - [CRIT] Command process-service-perfdata-file-bulk-npcd is not defined

Post by Nyle »

The deprecated errors at the top of the graph page are not cosmetic and once you fix them, if you have the other configuration correct - graphs will display!!!

Found details of the error here -https://sebhastian.com/php-deprecated-m ... structors/

Then I made a backup of /usr/local/pnp4nagios/application/lib/json.php file and edited the file. I located the lines 115, 781, and 795 and then
located each class and inside the class in front of the function that's call I added "__" (two underscores) as per the URL above. I reloaded npcd but I don't think that was strictly necessary as refreshing the page would likely have pulled the new code.

These are the lines currently.

function __Services_JSON($use = 0)
function __Services_JSON_Error
function __Services_JSON_Error

graphs immediately started to function - this should probably be in the main guide on the Nagios CORE site. The pnp4nagion project should take into account newer versions of PHP on newer OS releases but at least if there was a note of how to fix this in the guide - it would have saved me a lot of time.
You do not have the required permissions to view the files attached to this post.
Last edited by Nyle on Mon Jul 01, 2024 3:13 pm, edited 1 time in total.