Page 1 of 2

nagiosgraph.js is not installed or wrong version

Posted: Wed Jul 29, 2015 9:59 am
by setevoy
Hi.

I spent almost whole day, trying solve that problem. Finally - I came here :-(

I have installed Nagiosgrapth (manually), but after opening page like "http://nagios.domain.com/nagios/cgi-bin ... t%20memory" - I have next error:
JavaScript is disabled.
nagiosgraph.js is not installed or wrong version.
Image

As I goggled - basically, problem is in URLs in nagiosgraph.conf.

Here is my content:

Code: Select all

logfile = /var/log/nagios/nagiosgraph.log
cgilogfile = /var/log/nagios/nagiosgraph-cgi.log
perflog = /var/log/nagios/perfdata.log
rrddir = /var/nagios/rrd
mapfile = /opt/nagiosgraph/etc/map
nagiosgraphcgiurl = /nagios/cgi-bin
javascript = /js/nagiosgraph.js
stylesheet = /stylesheets/nagiosgraph.css
File /usr/local/nagios/share/ssi/common-header.ssi:

Code: Select all

<script type="text/javascript" src="/js/nagiosgraph.js"></script>
nagiosgraph.js accessible with browser:

Code: Select all

# curl -u nagiosadmin:pass http://nagios.domain.com/nagios/js/nagiosgraph.js | head
...
//
// $Id$
// License: OSI Artistic License
//          http://www.opensource.org/licenses/artistic-license-2.0.php
// Author:  (c) 2005 Soren Dossing
// Author:  (c) 2008 Alan Brenner, Ithaka Harbors
// Author:  (c) 2010 Matthew Wall

var PNAME = [ 'hour', 'day', 'week', 'month', 'quarter', 'year' ];
curl: (23) Failed writing body (456 != 1448)
(or via http://nagios.domain.com/js/nagiosgraph.js).

Also - I have same Nagios + Nagiosgrapth installation on another server, with same (aha...) setup - and it's works.

What I'm doing wrong here?

Thanks.

P.S. No errors in NGINX or Nagios logs, related to nagiosgraph.js.
P.P.S. Full setup described http://rtfm.co.ua/nagios-ruchnaya-ustan ... giosgraph/, although it's in russian - but configuration(s) available.

Re: nagiosgraph.js is not installed or wrong version

Posted: Wed Jul 29, 2015 12:34 pm
by jolson
You say that you have a working server and a non-working server.

Are there any notable differences between the servers regarding software versions, OS versions, apache versions, etc?

You might try checking the permissions of the broken nagiosgraph installation against the permissions of the working installation - any notable permissions differences?

Re: nagiosgraph.js is not installed or wrong version

Posted: Thu Jul 30, 2015 3:08 am
by setevoy
Hi, @jolson.

Thanks for replay.
Are there any notable differences between the servers regarding software versions, OS versions, apache versions, etc?
Working server works under CentOS 6 OS, and non-working - under Amazon Linux (which is also based on RHEL).

Both uses same NGINX + PHP-FPM:

Code: Select all

# nginx -v
nginx version: nginx/1.6.2

Code: Select all

# php-fpm -v
PHP 5.3.29 (fpm-fcgi) (built: May 12 2015 22:43:17)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

Code: Select all

# spawn-fcgi -v
spawn-fcgi v1.6.3 (ipv6) - spawns FastCGI processes
Build-Date: Jan 22 2011 09:35:38
You might try checking the permissions of the broken nagiosgraph installation against the permissions of the working installation - any notable permissions differences?
Just checked directories and files:

Code: Select all

/usr/local/nagios/sbin/
/usr/lib64/nagios/plugins/insert.pl
/opt/nagiosgraph/etc/
/usr/local/nagios/share/
/usr/local/nagios/share/js
/usr/local/nagios/share/stylesheets/
All seems to be similar (users, groups, permissions).

Re: nagiosgraph.js is not installed or wrong version

Posted: Thu Jul 30, 2015 5:03 pm
by jdalrymple
setevoy wrote:P.S. No errors in NGINX or Nagios logs, related to nagiosgraph.js.
Anything at all? 200s? 302s? Anything? Or is it like it's not even being accessed?

Also a stretch - is it possible selinux is beating you up?

Sidebar: I love Kiev, can't wait to come back and visit again. My wife has tried, but just can't make Akroshka like that I had there.

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Jul 31, 2015 2:43 am
by setevoy
jdalrymple wrote:Anything at all? 200s? 302s? Anything? Or is it like it's not even being accessed?
Well, of course - tehre is some enries :-)

Code: Select all

# tail -f /var/log/nagios/nagiosgraph.log /var/log/nagios/nagiosgraph-cgi.log /var/log/nagios/nagios.log
==> /var/log/nagios/nagiosgraph.log <==
Fri Jul 31 07:27:58 2015 insert.pl 18493 warn output/perfdata not recognized:
hostname:www.dev.domain.com
servicedesc:Tomcat status
output:OK  Apache Tomcat/7.0.62 server is OK
perfdata:
Fri Jul 31 07:28:58 2015 insert.pl 18540 warn output/perfdata not recognized:
hostname:www.staging.domain.com
servicedesc:Tomcat status
output:OK  Apache Tomcat/7.0.62 server is OK
perfdata:

==> /var/log/nagios/nagiosgraph-cgi.log <==

==> /var/log/nagios/nagios.log <==
[1438327540] wproc:   host=cassandra-qa; service=(null);
[1438327540] wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
[1438327540] Warning: Check of host 'cassandra-qa' timed out after 30.01 seconds
[1438327540] wproc: Core Worker 23583: job 7418 (pid=18373): Dormant child reaped
[1438327840] wproc: Core Worker 23583: job 7446 (pid=18590) timed out. Killing it
[1438327840] wproc: CHECK job 7446 from worker Core Worker 23583 timed out after 30.01s
[1438327840] wproc:   host=cassandra-qa; service=(null);
[1438327840] wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
[1438327840] Warning: Check of host 'cassandra-qa' timed out after 30.01 seconds
[1438327840] wproc: Core Worker 23583: job 7446 (pid=18590): Dormant child reaped
And NGINX error log, during http://nagios.domain.com/nagios/cgi-bin ... t%20memory page reload:

Code: Select all

2015/07/31 07:34:25 [warn] 21194#0: *7230 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/fastcgi/7/67/0000000677 while reading upstream, client: 194.105.145.69, server: 52.2.150.132, request: "GET /nagios/cgi-bin/status.cgi?host=all HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/status.cgi?host=all"
2015/07/31 07:35:24 [error] 21194#0: *7230 open() "/usr/local/nagios/share/favicon.ico" failed (2: No such file or directory), client: 194.105.145.69, server: 52.2.150.132, request: "GET /favicon.ico HTTP/1.1", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory"
2015/07/31 07:35:56 [warn] 21194#0: *7230 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/fastcgi/8/67/0000000678 while reading upstream, client: 194.105.145.69, server: 52.2.150.132, request: "GET /nagios/cgi-bin/status.cgi?host=all HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/status.cgi?host=all"
2015/07/31 07:36:16 [info] 21194#0: *7249 client closed connection while waiting for request, client: 194.105.145.69, server: 0.0.0.0:80
2015/07/31 07:37:22 [error] 21194#0: *7258 open() "/usr/local/nagios/share/favicon.ico" failed (2: No such file or directory), client: 194.105.145.69, server: 52.2.150.132, request: "GET /favicon.ico HTTP/1.1", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory"
2015/07/31 07:37:27 [warn] 21194#0: *7258 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/fastcgi/9/67/0000000679 while reading upstream, client: 194.105.145.69, server: 52.2.150.132, request: "GET /nagios/cgi-bin/status.cgi?host=all HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/status.cgi?host=all"
Access log:

Code: Select all

194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /js/nagiosgraph.js HTTP/1.1" 200 42865 "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 OPR/30.0.1835.125"
194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /nagios/cgi-bin/showgraph.cgi?host=www.cloud.domain.com&service=Tomcat%20memory&db=Used_memory&rrdopts=%20-snow-118800%20-enow-0 HTTP/1.1" 200 15014 "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 OPR/30.0.1835.125"
194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /nagios/cgi-bin/showgraph.cgi?host=www.cloud.domain.com&service=Tomcat%20memory&db=Used_memory&rrdopts=%20-snow-34560000%20-enow-0 HTTP/1.1" 200 12333 "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 OPR/30.0.1835.125"
194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /nagios/cgi-bin/showgraph.cgi?host=www.cloud.domain.com&service=Tomcat%20memory&db=Used_memory&rrdopts=%20-snow-3024000%20-enow-0 HTTP/1.1" 200 11411 "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 OPR/30.0.1835.125"
194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /nagios/cgi-bin/showgraph.cgi?host=www.cloud.domain.com&service=Tomcat%20memory&db=Used_memory&rrdopts=%20-snow-777600%20-enow-0 HTTP/1.1" 200 12477 "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 OPR/30.0.1835.125"
Also a stretch - is it possible selinux is beating you up?
No, Amazon Linux haven't SELinux (and on my CentOS it's disabled).

<offtopic>
Sidebar: I love Kiev, can't wait to come back and visit again. My wife has tried, but just can't make Akroshka like that I had there.
Wow :-) Your wife from Ukraine?
We can drink some beer here, when you'll be there :-)

P.S. Akroshka => Okroshka :-)</offtopic>

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Jul 31, 2015 9:51 am
by jdalrymple
Right at the moment I'm a bit confused, namely about what the problem is. You'll have to forgive me also as I'm not a nagiosgraph user but a pnp4nagios user. That said right now I'm wondering, is everything working and really the only problem is the nagiosgraph.js errors? From what I can find on Google, that error typically has little to do with functionality but is more just an aesthetic thing. That's not to say that I don't want to help you get it solved, but I just want to make sure we're on the same page about the scale and number of problems we're looking at.

Not knowing that - here is what I see:

Code: Select all

194.105.145.69 - nagiosadmin [31/Jul/2015:07:42:27 +0000] "GET /js/nagiosgraph.js HTTP/1.1" 200
For like everyone who has that issue, the problem is that they're not specifying things properly in their configs. This doesn't seem to be the case for you. Also the error seems to source from just a simple version check between a perl script (no doubt called by the CGI) and the .js file. I suppose just to be sure you could verify this stuff in your files, but I'm sure that's not the problem:

ngshared.pm:

Code: Select all

# the javascript version number here must match the version number in the
# nagiosgraph.js file.  change this number when the javascript is not
# backward compatible with previous versions.
use constant {
    JSVERSION => 1.7,
    JSMISSING => 'nagiosgraph.js is not installed or wrong version.',
    JSDISABLED => 'JavaScript is disabled.',
};
and nagiosgraph.js:

Code: Select all

var VERSION = 1.7;
So what I'm wondering - and it again is a far reach... is the favicon.ico error holding up the cgi in such a way that we're seeing an obviously unrelated error?

Code: Select all

2015/07/31 07:35:24 [error] 21194#0: *7230 open() "/usr/local/nagios/share/favicon.ico" failed (2: No such file or directory), client: 194.105.145.69, server: 52.2.150.132, request: "GET /favicon.ico HTTP/1.1", host: "nagios.domain.com", referrer: "http://nagios.domain.com/nagios/cgi-bin/show.cgi?host=www.cloud.domain.com&service=Tomcat%20memory"
Most of the time favicon.ico problems are on just interpreted webpages, but maybe since this is a CGI unable to find the file maybe it's causing a script execution failure that is showing us unrelated errors. I'm reaching - I know.

Lastly - maybe set debug=5 in nagiosgraph.conf? We'll want to lower it if we can get the issue solved.

Back to the off-topic:

My wife is not of Ukrainian decent, she is an American with a trace of Italian in her. This is no doubt why her Okroshka isn't particularly authentic tasting. No doubt connotations of my travels to Eastern Europe (Ukraine isn't the only East Bloc country I've visited) exist, but I actually chose to travel there simply because I don't really like Western Europe. After my first trip I was hooked. I have spent my share of time in Britain, France, Spain, Ireland, etc - they're not for me. I'll be happy to sit down over a Чернигивськe on my next trip there!

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Nov 04, 2016 9:02 am
by jotagera
Hi

I found the root cause of this error.

If your instalation was running OK like mine was, the cause are some performance data reported and used automaticaly to create a wrong rrd name. This wrong name disrupts the contents of javascript table on showservice.cgi.

Try to look some strange rrds, some created when you are created new nagios services.

It is not easy but you can. I looked the servers registered since last month. They are about 20. I move it to another folder on linux and the web page worked ok.

Them, i voce back one by one until i find the damaged. In my case, the name are "perf_ux2___sar%20file%22%20runq.rrd".

perf_ux2 are the name of our own plugin to grab CPU data based on sar.

Good luck.

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Nov 04, 2016 9:35 am
by avandemore
@jotagera -- Thank for your input on this issue.

@jdalrymple -- Does this fix your issue?

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Nov 04, 2016 9:37 am
by dwhitfield
@jotagera, thanks so much for helping out!

Re: nagiosgraph.js is not installed or wrong version

Posted: Fri Dec 09, 2016 6:34 am
by mksmr
This issue is a duplicate of the error.

Return values of a check might contain characters that are invalid in filenames. By default, nagiosgraph creates rrd files with filenames composed of the check name and the return value label.

Workaround: make sure that rrd filenames do not contain illegal characters by naming the checks and labeling them properly.