[RESOLVED] 4.0.4 -> 4.0.8 "Unable to get process status"

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.
Locked
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

[RESOLVED] 4.0.4 -> 4.0.8 "Unable to get process status"

Post by tlum »

Following the upgrade I have "Unable to get process status", similar to http://tracker.nagios.org/view.php?id=612

It was logging

Code: Select all

[Tue Jan 27 19:21:03 2015] [error] [client 192.168.2.2] script not found or unable to stat: /var/www/cgi-bin/statusjson.cgi
/etc/httpd/conf.d/nagios.conf has

Code: Select all

    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
main.php has

Code: Select all

                $.get('cgi-bin/statusjson.cgi?query=programstatus', function(d) {
change it to

Code: Select all

                $.get('/nagios/cgi-bin/statusjson.cgi?query=programstatus', function(d) {
and it works, though that's probably not as intended.

EDIT 20150128: I've checked the source history and find the process status was implemented in v4.0.5 which is one point higher than what I upgraded from, so I have never had this "functionality" installed and working. From my perspective it is new functionality that has never worked [for me]. It is implemented as a jQuery Ajax call to a status CGI, but I question how the relative URL is supposed to work.

Please advise.
Last edited by tlum on Thu Jan 29, 2015 10:40 am, edited 2 times in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: 4.0.4 -> 4.0.8 "Unable to get process status"

Post by Box293 »

What operating system are you on and what version is it?

Did you follow any specific guides on how to upgrade?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Re: 4.0.4 -> 4.0.8 "Unable to get process status"

Post by tlum »

CentOS 6.5

Code: Select all

Linux nm2srvp01 2.6.32-431.5.1.el6.i686 #1 SMP Tue Feb 11 21:56:33 UTC 2014 i686 i686 i386 GNU/Linux
These are the upgrade steps as far as I know.

Code: Select all

Upgrading From Previous Nagios 3 or 4 Releases

As newer alpha, beta, and stable releases of Nagios are released, you should strongly consider upgrading as soon as possible. Newer releases usually contain critical bug fixes, so its important to stay up to date. Assuming you've already installed Nagios from source code as described in the quickstart guide, you can install newer versions of Nagios easily. You don't even need root access to do it, as everything that needed to be done as root was done during the initial install. Here's the upgrade process.

Make sure you have a good backup of your existing Nagios installation and configuration files. If anything goes wrong or doesn't work, this will allow you to rollback to your old version.

Become the nagios user. Debian/Ubuntu users should use sudo -s nagios.


su -l nagios

Removed the following old HTML files that were used by the web frontend. They have been replaced by PHP equivalents.

rm /usr/local/nagios/share/{main,side,index}.html

Download the source code tarball of the latest version of Nagios (visit http://www.nagios.org/download/ for the link to the latest version).


wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-x.y.z.tar.gz

Extract the Nagios source code tarball.


tar xzf nagios-x.y.z.tar.gz

cd nagios

Run the Nagios configure script, passing the name of the group used to control external command file permissions like so:


./configure --with-command-group=nagcmd

Compile the Nagios source code.


make all

Install updated binaries, documentation, and web web interface. Your existing configuration files will not be overwritten by this step.


make install

Verify your configuration files. Correct any errors shown here before proceeding with the next step.


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart Nagios. Debian/Ubuntu users should use /etc/init.d/nagios restart.


/sbin/service nagios restart

That's it - you're done! 
It won't actually restart if you're the nagios user, root owns the lock file.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: 4.0.4 -> 4.0.8 "Unable to get process status"

Post by scottwilkerson »

Does your compile directory have the statusjson.cgi built?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Re: 4.0.4 -> 4.0.8 "Unable to get process status"

Post by tlum »

change it to

Code: Select all

                    $.get('/nagios/cgi-bin/statusjson.cgi?query=programstatus', function(d) {
and it works, though that's probably not as intended.
Maybe I should rephrase the question. How is this jQuery statement ever expected to work?

Code: Select all

                $.get('cgi-bin/statusjson.cgi?query=programstatus', function(d) {
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Re: 4.0.4 -> 4.0.8 "Unable to get process status"

Post by tlum »

Edit 20150129: Non-standard config in use. This issue does not pertain directly to an "out of the box" configuration, though it might aid others indirectly who land here as the result of a search hit on this error. The process status is implemented as a client side jQuery call to the server CGI, so it's rendered client side, not server side. The jQuery call is relative to the page URL, so the cgi-bin folder is expected to exist wherever the page was served from. As explained below, it's quite possible to violate that expectation.

All right, I've found the reason for this behavior. I guess Nagios expects to own the URL space. I'm actually running some other web apps so Nagios is in a vhost. It has a /etc/httpd/conf.d/nagios.conf of:

Code: Select all

<VirtualHost *:80>
    DocumentRoot /usr/local/nagios/share
    ServerName server.name
.
.
.

    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
.
.
.

    Alias /nagios "/usr/local/nagios/share"

.
.
.
</VirtualHost>
As a result you can access Nagios both with http://server.name and http://server.name/nagios . The former fails because the cgi-bin resources are under /nagios/cgi-bin and the relative reference, when using http://server.name as the base, tries to hit http://server.name/cgi-bin which does not exist. If you hard code the reference it works, but this is problematic because cgi-bin is intended to be relative to the movable document root.

It can actually be resolved with an additional ScriptAlias to go with the vhost DocumentRoot, like so:

Code: Select all

<VirtualHost *:80>
    DocumentRoot /usr/local/nagios/share
    ServerName server.name
.
.
.

    ScriptAlias /cgi-bin "/usr/local/nagios/sbin"
    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
.
.
.

    Alias /nagios "/usr/local/nagios/share"

.
.
.
</VirtualHost>
Locked