Issue configuring pnp4nagios

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.
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Issue configuring pnp4nagios

Post by miniman321 »

Hello guys,

I recently installed Nagios Core which is now working fine, but having a bit more issues implementing pnp4nagios, after I overcame some issue with the installation, now there is some issue with php.

Error code:

PNP4Nagios Environment Tests
The following options are determined by "configure". If any of the tests have failed, consult the documentation for more information on how to correct the problem.

Here is the test result:

Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /usr/local/pnp4nagios/share/install.php:108 Stack trace: #0 /usr/local/pnp4nagios/share/index.php(140): include() #1 {main} thrown in /usr/local/pnp4nagios/share/install.php on line 108
PNP4Nagios Version pnp4nagios-0.6.26
Prefix /usr/local/pnp4nagios
Configure Arguments ./configure '--with-httpd-conf=/etc/apache2/sites-enabled'
RRD Storage /usr/local/pnp4nagios/var/perfdata is readable.
RRDtool Binary /usr/bin/rrdtool is executable by PHP
PHP GD extension Pass
PHP function proc_open() Pass
PHP zlib extension Pass
PHP session extension Pass
PHP JSON extension Pass
PHP magic_quotes_gpc

Think there was recently an issue with php version, but I am using the most recent one I guess...

PHP 8.2.20 (cli) (built: Jun 17 2024 13:33:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies
with Zend OPcache v8.2.20, Copyright (c), by Zend Technologies

Was anyone facing simillar issue and would be able to share some solution?

Many thanks!
bbahn
Posts: 274
Joined: Thu Jan 12, 2023 5:42 pm

Re: Issue configuring pnp4nagios

Post by bbahn »

Hello @miniman321,

It seems that pnp4nagios checks for the function get_magic_quotes_gpc() and lets you know that it's deprecated, but this function is removed entirely as of PHP 8. The version of the library located at he only other place where this function in mentioned in the current version of the original library (lingej's repo, which is now unmaintained, but is likely the version you are using if you're running into this issue) is checking if the function exists. Thusly, if you go to your pnp4nagios' install.php.in file and remove the following, it should work unless there are other similarly removed functions:

Code: Select all

<th>PHP magic_quotes_gpc</th>
<?php if (get_magic_quotes_gpc() == FALSE): ?>
<td class="pass">Off</td>
<?php else: $failed++ ?>
<td class="fail">PHP <a href="http://docs.pnp4nagios.org/faq/i7">magic_quotes_gpc</a> is deprecated</td>
<?php endif ?>
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Re: Issue configuring pnp4nagios

Post by miniman321 »

HI @bbahn,

thank you for your help, I ve removed the following code from install.php.in and install.php, I ve rebooted the server and it returns the same error however lines has been removed, do I need to start anything else?


Thank you!
bbahn
Posts: 274
Joined: Thu Jan 12, 2023 5:42 pm

Re: Issue configuring pnp4nagios

Post by bbahn »

If you removed those lines, you cannot have had the exact same error. Can you post your new error here? Are you sure you saved the changes before running the install?
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Re: Issue configuring pnp4nagios

Post by miniman321 »

Yes I did and rerun the installation, now I am getting different error. (already removed install.php file from /usr/local/PNP4Nagios/share/ as it was all clear).

Once I am opening http://hostname/pnp4nagios/ getting this one :oops:

PNP4Nagios Version 0.6.26
Please check the documentation for information about the following error.
Call to a member function getCode() on int

file [line]:
/usr/local/pnp4nagios/lib/kohana/system/core/Kohana.php [879]:
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Re: Issue configuring pnp4nagios

Post by miniman321 »

Anyone would be able to help please? Looks this is kind of general error message, and cant find the root cause....
bbahn
Posts: 274
Joined: Thu Jan 12, 2023 5:42 pm

Re: Issue configuring pnp4nagios

Post by bbahn »

Before we can really figure out how to help, what distribution/fork of PNP4Nagios are you using? What set of instructions are you following for setting it up? Usually, an error message such as what you've encountered will include a file and line number. Can you include those here?
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Re: Issue configuring pnp4nagios

Post by miniman321 »

Hello mate,

here is the info:

PNP4Nagios Version 0.6.26
Please check the documentation for information about the following error.
Call to a member function getCode() on int

file [line]:
/usr/local/pnp4nagios/lib/kohana/system/core/Kohana.php [879]:

And I was using this guide:

https://arkit.co.in/pnp4nagios-installa ... iguration/
bbahn
Posts: 274
Joined: Thu Jan 12, 2023 5:42 pm

Re: Issue configuring pnp4nagios

Post by bbahn »

Since all the links around that version lead to dead webpages, my assumption is that it is no longer maintained and may just be broken with modern versions of Core. I suggest retrying with https://github.com/pnp4nagios/pnp4nagios/tree/master.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
miniman321
Posts: 10
Joined: Tue Aug 27, 2024 9:18 am

Re: Issue configuring pnp4nagios

Post by miniman321 »

Thanks bbahn, looks it worked, however still all my graphs are emtpy :( but definitely advanced up that graphs are already visible thanks!

So by some of the hosts there are graphs but they are empty and by some of the host I am getting this error:

Image
Attachments
nag.JPG
Post Reply