Nagios CORE commands failing from XI web interface

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
BenCowan
Posts: 80
Joined: Thu Jul 28, 2011 11:34 am

Nagios CORE commands failing from XI web interface

Post by BenCowan »

RHEL9 w/Nagios XI version 2024R1.1.4

I upgraded last week but just noticed that I was unable to issue commands via the web interface. For example Home->Tactical Overview->Notifications I' receive errors attempting to ENABLE/DISABLE anything. The following error was prevalent in the logs so I commented out a block of code (lines 315 to 320) and now it's working, however, I have no idea what I may have broken by doing this.

Mon, 08 Jul 2024 17:32:01 -0700 PROCESSED 0 COMMANDS
PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
............................................................PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
sgardil
Posts: 278
Joined: Wed Aug 09, 2023 9:58 am

Re: Nagios CORE commands failing from XI web interface

Post by sgardil »

BenCowan wrote: Mon Jul 08, 2024 7:56 pm RHEL9 w/Nagios XI version 2024R1.1.4

I upgraded last week but just noticed that I was unable to issue commands via the web interface. For example Home->Tactical Overview->Notifications I' receive errors attempting to ENABLE/DISABLE anything. The following error was prevalent in the logs so I commented out a block of code (lines 315 to 320) and now it's working, however, I have no idea what I may have broken by doing this.

Mon, 08 Jul 2024 17:32:01 -0700 PROCESSED 0 COMMANDS
PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
............................................................PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
We use grab_request_vars in many locations so its best to not comment out this code. I'm not sure what your line 315 looks like but it seems like there isn't a guard for if that array key exists. If you want to get rid of the warning you mentioned above and you feel fine updating the code you can change line 315 to this:

Code: Select all

    if (array_key_exists('REQUEST_METHOD', $_SERVER) && $_SERVER['REQUEST_METHOD'] == "PUT") {
Let us know if this fixes your issue.
BenCowan
Posts: 80
Joined: Thu Jul 28, 2011 11:34 am

Re: Nagios CORE commands failing from XI web interface

Post by BenCowan »

That worked great. Thanks. Will that alternate code be in future upgrades?
bbahn
Posts: 274
Joined: Thu Jan 12, 2023 5:42 pm

Re: Nagios CORE commands failing from XI web interface

Post by bbahn »

@BenCowan,

Yes, this change will be included in future updates.
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.
BenCowan
Posts: 80
Joined: Thu Jul 28, 2011 11:34 am

Re: Nagios CORE commands failing from XI web interface

Post by BenCowan »

Excellent.
rosydam
Posts: 3
Joined: Sun Aug 27, 2023 10:12 pm
Contact:

Re: Nagios CORE commands failing from XI web interface

Post by rosydam »

sgardil wrote: Tue Jul 09, 2024 9:18 am
BenCowan wrote: Mon Jul 08, 2024 7:56 pm RHEL9 w/Nagios XI version 2024R1.1.4Incredibox game

I upgraded last week but just noticed that I was unable to issue commands via the web interface. For example Home->Tactical Overview->Notifications I' receive errors attempting to ENABLE/DISABLE anything. The following error was prevalent in the logs so I commented out a block of code (lines 315 to 320) and now it's working, however, I have no idea what I may have broken by doing this.

Mon, 08 Jul 2024 17:32:01 -0700 PROCESSED 0 COMMANDS
PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
............................................................PHP Warning: Undefined array key "REQUEST_METHOD" in /app/nagios/nagiosxi/html/includes/utils.inc.php on line 315
We use grab_request_vars in a many locations so its best to not comment out this code. I'm not sure what your line 315 looks like but it seems like there isn't a guard for if that array key exists. If you want to get rid of the warning you mentioned above and you feel fine updating the code you can change line 315 to this:

Code: Select all

    if (array_key_exists('REQUEST_METHOD', $_SERVER) && $_SERVER['REQUEST_METHOD'] == "PUT") {
Let us know if this fixes your issue.
sgardil
Posts: 278
Joined: Wed Aug 09, 2023 9:58 am

Re: Nagios CORE commands failing from XI web interface

Post by sgardil »

Hey @rosydam

I saw you quoted the response above. Are you still having similar issues?
Andreaa23
Posts: 5
Joined: Mon Aug 07, 2023 10:06 pm

Re: Nagios CORE commands failing from XI web interface

Post by Andreaa23 »

If Nagios CORE commands are failing when executed through the Nagios XI web interface, but work via the command line, it’s often related to permissions, configuration issues, or web interface settings. incredibox sprunki
Post Reply