Configuring Nagios Graphs

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.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

Yes even with those changes this is what happens

Code: Select all

# enable nagiosgraph CGI scripts
ScriptAlias /nagiosgraph/cgi-bin /usr/local/nagiosgraph/cgi-bin
<Directory "/usr/local/nagiosgraph/cgi-bin">
   Options ExecCGI
   AllowOverride None
#   Order allow,deny
#   Allow from all
#   AuthName "Nagios Access"
#   AuthType Basic
#   AuthUserFile NAGIOS_ETC_DIR/htpasswd.users
#   Require valid-user
</Directory>
# enable nagiosgraph CSS and JavaScript
Alias /nagiosgraph "/usr/local/nagiosgraph/share"
<Directory "/usr/local/nagiosgraph/share">
   Options None
   AllowOverride None
#   Order allow,deny
#   Allow from all

nagios@nagios:~$ sudo service apache2 restart
* Restarting web server apache2 [Tue Mar 29 19:19:04.577156 2016] [alias:warn] [pid 1879] AH00671: The ScriptAlias directive in /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf at line 2 will probably never match because it overlaps an earlier ScriptAlias.
[Tue Mar 29 19:19:04.577220 2016] [alias:warn] [pid 1879] AH00671: The Alias directive in /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf at line 14 will probably never match because it overlaps an earlier Alias.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[ OK ]
nagios@nagios:~$
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Configuring Nagios Graphs

Post by rkennedy »

The error is clear, you have a duplicate entry somewhere. Please run cat /etc/httpd/conf.d/* | grep 'nagiosgraph' and post the result.

Additionally, I don't see Require all granted - this is needed on Apache 2.4+ - this could also be why you're seeing Forbidden.
Former Nagios Employee
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

Hi Rob,

Here you go;

nagios@nagios:~$ sudo cat /etc/httpd/conf.d/* | grep 'nagiosgraph'
cat: /etc/httpd/conf.d/*: No such file or directory

I did have the allow all unhashed but i hashed it based off earlier posts
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Configuring Nagios Graphs

Post by rkennedy »

nathanplatt wrote:Hi Rob,

Here you go;

nagios@nagios:~$ sudo cat /etc/httpd/conf.d/* | grep 'nagiosgraph'
cat: /etc/httpd/conf.d/*: No such file or directory

I did have the allow all unhashed but i hashed it based off earlier posts
It isn't the allow all, but rather the exact words 'require all granted' that matter. That's the only thing that needs to be uncommented, not the rest of the stuff.

What OS are you running? If it's Debian / Ubuntu try -

Code: Select all

cat /etc/apache2/conf.d/* | grep 'nagiosgraph'
Former Nagios Employee
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

nagios@nagios:~$ cat /etc/apache2/conf.d/* | grep 'nagiosgraph'
cat: /etc/apache2/conf.d/*: No such file or directory
nagios@nagios:~$

its ubuntu 14, server edition

i added the Require all granted to conf file and restarted apache2 same error
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

Code: Select all

nagios@nagios:~$ cat /usr/local/nagiosgraph/etc/* | grep 'nagiosgraph'
# access control for nagiosgraph
# dataset options for nagiosgraph
# group options for nagiosgraph
# arbitrary groupings of hosts and services to be displayed by nagiosgraph.
# host options for nagiosgraph
# labels for services and data in nagiosgraph.
# enable nagiosgraph CGI scripts
ScriptAlias /nagiosgraph/cgi-bin /usr/local/nagiosgraph/cgi-bin
<Directory "/usr/local/nagiosgraph/cgi-bin">
# enable nagiosgraph CSS and JavaScript
Alias /nagiosgraph "/usr/local/nagiosgraph/share"
<Directory "/usr/local/nagiosgraph/share">
# command to process nagios performance data for nagiosgraph
  command_name process-service-perfdata-for-nagiosgraph
  command_line /usr/local/nagiosgraph/bin/insert.pl
# nagiosgraph configuration file
# Location of output from nagiosgraph data processing
logfile = /usr/local/nagiosgraph/var/log/nagiosgraph.log
# Location of output from nagiosgraph CGI scripts
cgilogfile = /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
rrddir = /usr/local/nagiosgraph/var/rrd
mapfile = /usr/local/nagiosgraph/etc/map
nagiosgraphcgiurl = /nagiosgraph/cgi-bin
# JavaScript: URL to the nagiosgraph javascript file.
javascript = /nagiosgraph/nagiosgraph.js
# Stylesheet: URL to the nagiosgraph stylesheet.
stylesheet = /nagiosgraph/nagiosgraph.css
labelfile = /usr/local/nagiosgraph/etc/labels.conf
#hostdb = /etc/nagiosgraph/hostdb.conf
#servdb = /etc/nagiosgraph/servdb.conf
#groupdb = /etc/nagiosgraph/groupdb.conf
datasetdb = /usr/local/nagiosgraph/etc/datasetdb.conf
# The authorization method can be one of nagios3 or nagiosgraph.  If no
# Nagios3 defaults to use authentication.  nagiosgraph looks for the
# If authentication is enabled, nagiosgraph looks for the
# For access control via nagiosgraph, specify a single access control file.
#authzmethod = nagiosgraph
#authzfile = /etc/nagiosgraph/access.conf
# Set this to hide the nagiosgraph title (useful when nagiosgraph is
#rrdoptsfile=/etc/nagiosgraph/rrdopts.conf
# the nagiosgraph data processing interval.
# nagiosgraph auf deutsch
# nagiosgraph en espanol
# nagiosgraph en frances
# process nagios performance data using nagiosgraph
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
$CFGNAME = 'nagiosgraph.conf';
    NAGIOSGRAPHURL => 'http://nagiosgraph.sourceforge.net/',
# nagiosgraph.js file.  change this number when the javascript is not
    JSMISSING => 'nagiosgraph.js is not installed or wrong version.',
        $cgi->start_html(-id => 'nagiosgraph',
        } elsif ( $Config{authzmethod} eq 'nagiosgraph' ) {
    return 'nagiosgraph_' . $key . '.conf';
    my $action = $Config{nagiosgraphcgiurl} . q(/) . $script{$context};
    my $url = $Config{nagiosgraphcgiurl} . '/showgraph.cgi?'
    $rval .= $cgi->start_html(-id => 'nagiosgraph',
                              -title => "nagiosgraph: $opts->{title}",
        my $worklog = $fn . '.nagiosgraph';
ngshared.pm - shared subroutines for the nagiosgraph programs
ngshared.pm uses B<nagiosgraph.conf> for most configuration.  ngshared.pm also includes subroutines to read from B<hostdb.conf>, B<servdb.conf>, B<groupdb.conf>, and B<rrdopts.conf> files.  These files are typically located in /etc/nagiosgraph.
Copy this file into a configuration directory (/etc/nagiosgraph, for example) and modify the B<use lib> line in each *.cgi file to the directory.
Alan Brenner - [email protected]; I've updated this from the version at http://nagiosgraph.wiki.sourceforge.net/ by moving some subroutines into this shared file (ngshared.pm) for use by insert.pl and the show*.cgi files.
# rrd options for nagiosgraph
# service options for nagiosgraph
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Configuring Nagios Graphs

Post by rkennedy »

nathanplatt wrote:nagios@nagios:~$ cat /etc/apache2/conf.d/* | grep 'nagiosgraph'
cat: /etc/apache2/conf.d/*: No such file or directory
nagios@nagios:~$

its ubuntu 14, server edition

i added the Require all granted to conf file and restarted apache2 same error
Where is your apache installed? You'll want to run that command against the folder that contains your apache configuration.

Additionally, the command you ran worries me as it's finding the apache configuration in your nagiosgraph install directory. Do you have this file referenced to include from apache?
Former Nagios Employee
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

I think perhaps this is where i've gone wrong,

Apache2 is installed in /etc/apache2/
The Nagiosgraphs is installed in /usr/local/nagiosgraphs/share/

when running thru the setup instructions I wasn't sure of this and followed the defaults. Here is a tree of the folders to help:

Code: Select all

nagios@nagios:/usr/local/nagiosgraph$ tree
.
├── bin
│   └── insert.pl
├── cgi
│   ├── export.cgi
│   ├── show.cgi
│   ├── showconfig.cgi
│   ├── showgraph.cgi
│   ├── showgroup.cgi
│   ├── showhost.cgi
│   ├── showservice.cgi
│   └── testcolor.cgi
├── doc
│   ├── AUTHORS
│   ├── CHANGELOG
│   ├── INSTALL
│   ├── README
│   └── TODO
├── etc
│   ├── access.conf
│   ├── datasetdb.conf
│   ├── groupdb.conf
│   ├── hostdb.conf
│   ├── labels.conf
│   ├── map
│   ├── nagiosgraph-apache.conf
│   ├── nagiosgraph-commands.cfg
│   ├── nagiosgraph.conf
│   ├── nagiosgraph_de.conf
│   ├── nagiosgraph_es.conf
│   ├── nagiosgraph_fr.conf
│   ├── nagiosgraph-nagios.cfg
│   ├── ngshared.pm
│   ├── rrdopts.conf
│   └── servdb.conf
├── examples
│   ├── graphed-host.cfg
│   ├── graphed-service.cfg
│   ├── graph.gif
│   ├── insert.sh
│   ├── map_1_3
│   ├── map_1_4_3
│   ├── map_1_4_4
│   ├── map_1_4_5
│   ├── map_examples
│   ├── map_minimal
│   ├── map_mwall
│   ├── nagiosgraph.1.css
│   ├── nagiosgraph.2.css
│   ├── nagiosgraph-apache.conf
│   ├── nagiosgraph-commands.cfg
│   ├── nagiosgraph-logrotate
│   ├── nagiosgraph-nagios.cfg
│   └── nagiosgraph.ssi
├── share
│   ├── nagiosgraph.css
│   └── nagiosgraph.js
├── util
│   ├── flat2hier.pl
│   └── testentry.pl
└── var
    ├── log
    │   ├── nagiosgraph-cgi.log
    │   └── nagiosgraph.log
    └── rrd

10 directories, 54 files
nagios@nagios:/usr/local/nagiosgraph$

Code: Select all

├── ports.conf
├── sites-available
│   ├── 000-default.conf
│   ├── default-ssl.conf
│   └── otrs.conf
└── sites-enabled
    ├── 000-default.conf -> ../sites-available/000-default.conf
    ├── nagios.conf
    ├── nagiosgraph.conf
    └── otrs.conf -> ../sites-available/otrs.conf

6 directories, 186 files
nagios@nagios:/etc/apache2$ cd sites-available/
nagios@nagios:/etc/apache2/sites-available$ ls
000-default.conf  default-ssl.conf  otrs.conf
nagios@nagios:/etc/apache2/sites-available$ cd ..
nagios@nagios:/etc/apache2$ cd sites-enabled/
nagios@nagios:/etc/apache2/sites-enabled$ nano nagiosgraph.conf
nagios@nagios:/etc/apache2/sites-enabled$ rm nagiosgraph.conf
rm: remove write-protected regular file ‘nagiosgraph.conf’? sudo rm nagiosgr
nagios@nagios:/etc/apache2/sites-enabled$ ls
000-default.conf  nagios.conf  nagiosgraph.conf  otrs.conf
nagios@nagios:/etc/apache2/sites-enabled$ sudo su
root@nagios:/etc/apache2/sites-enabled# rm nagiosgraph.conf
root@nagios:/etc/apache2/sites-enabled# ls
000-default.conf  nagios.conf  otrs.conf
root@nagios:/etc/apache2/sites-enabled# service apache2 restart
 * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                         [ OK ]
root@nagios:/etc/apache2/sites-enabled#
Okay so i found the apache2 error but i may have just put us back to square one. I found that due to the multiple attempts to fix this on my own, i had a nagiosgraph.conf in the sites-enabled folder, so this is where the duplicate was being created from. Deleted this and now apache2 restarts fine.

I'm guessing from your previous comment that the share folder is probably in the wrong location.

Let me know.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Configuring Nagios Graphs

Post by rkennedy »

Are you still seeing a forbidden error? Please post the nagiosgraph.conf file from your sites-enabled folder.
Former Nagios Employee
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Configuring Nagios Graphs

Post by nathanplatt »

I am still seeing the error, i deleted the one from the site-enabled folder to stop the error happening. Currently that folder only has the default site and nagios in it.
Locked