Configuring Nagios Graphs
Re: Configuring Nagios Graphs
Can you please post the apache configuration file then, that now has your nagios graph settings?
Former Nagios Employee
-
nathanplatt
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Configuring Nagios Graphs
I think this is where i've gone wrong, i have nothing in the apache2 folders for nagiosgraph. Should i re-install the whole thing again and see what it generates?
-
nathanplatt
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Configuring Nagios Graphs
Okay i've reinstalled in with the following;
I had a look for the nagiosgraph-apache.conf file and nothing was there, so i went looking and found that there was one in the apache2 folder
Thinking that should be in site-avaliable or enabled I moved it and restarted with no luck, still getting access denied, so i returned it back to original home.
The contents of the file after fresh install;
Code: Select all
root@nagios:/tmp/nagiosgraph-1.5.2# perl install.pl
checking required PERL modules
Carp...1.29
CGI...3.64
Data::Dumper...2.145
Digest::MD5...2.55
File::Basename...2.84
File::Find...1.23
MIME::Base64...3.15
POSIX...1.32
RRDs...1.4007
Time::HiRes...1.9725
checking optional PERL modules
GD...2.46
Nagios::Config...36
checking nagios installation
found nagios exectuable at /usr/local/nagios/bin/nagios
found nagios init script at /etc/init.d/nagios
checking web server installation
found apache executable at /usr/sbin/apache2
found apache init script at /etc/init.d/apache2
Destination directory (prefix)? [/usr/local/nagiosgraph] /usr/local/nagiosgraph
Location of configuration files (etc-dir)? [/usr/local/nagiosgraph/etc] /usr/local/nagiosgraph/etc
Location of executables? [/usr/local/nagiosgraph/bin] /usr/local/nagiosgraph/bin
Location of CGI scripts? [/usr/local/nagiosgraph/cgi] /usr/local/nagiosgraph/cgi
Location of documentation (doc-dir)? [/usr/local/nagiosgraph/doc] /usr/local/nagiosgraph/doc
Location of examples? [/usr/local/nagiosgraph/examples] /usr/local/nagiosgraph/examples
Location of CSS and JavaScript files? [/usr/local/nagiosgraph/share] /usr/local/nagiosgraph/share
Location of utilities? [/usr/local/nagiosgraph/util] /usr/local/nagiosgraph/util
Location of state files (var-dir)? [/usr/local/nagiosgraph/var] /usr/local/nagiosgraph/var
Location of RRD files? [/usr/local/nagiosgraph/var/rrd] /usr/local/nagiosgraph/var/rrd
Location of log files (log-dir)? [/usr/local/nagiosgraph/var/log] /usr/local/nagiosgraph/var/log
Path of log file? [/usr/local/nagiosgraph/var/log/nagiosgraph.log] /usr/local/nagiosgraph/var/log/nagiosgraph.log
Path of CGI log file? [/usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log] /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
Base URL? [/nagiosgraph] /nagiosgraph
URL of CGI scripts? [/nagiosgraph/cgi-bin] /nagiosgraph/cgi-bin
URL of CSS file? [/nagiosgraph/nagiosgraph.css] /nagiosgraph/nagiosgraph.css
URL of JavaScript file? [/nagiosgraph/nagiosgraph.js] /nagiosgraph/nagiosgraph.js
URL of Nagios CGI scripts? [/nagios/cgi-bin] /nagios/cgi-bin
Path of Nagios performance data file? [/var/nagios/perfdata.log] /var/nagios/perfdata.log
username or userid of Nagios user? [nagios] nagios
username or userid of web server user? [www-data] www-data
Modify the Nagios configuration? [n] n
Modify the Apache configuration? [n] Y
Path of Apache configuration directory? /etc/apache2/
configuration:
ng_prefix /usr/local/nagiosgraph
ng_etc_dir /usr/local/nagiosgraph/etc
ng_bin_dir /usr/local/nagiosgraph/bin
ng_cgi_dir /usr/local/nagiosgraph/cgi
ng_doc_dir /usr/local/nagiosgraph/doc
ng_examples_dir /usr/local/nagiosgraph/examples
ng_www_dir /usr/local/nagiosgraph/share
ng_util_dir /usr/local/nagiosgraph/util
ng_var_dir /usr/local/nagiosgraph/var
ng_rrd_dir /usr/local/nagiosgraph/var/rrd
ng_log_dir /usr/local/nagiosgraph/var/log
ng_log_file /usr/local/nagiosgraph/var/log/nagiosgraph.log
ng_cgilog_file /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
ng_url /nagiosgraph
ng_cgi_url /nagiosgraph/cgi-bin
ng_css_url /nagiosgraph/nagiosgraph.css
ng_js_url /nagiosgraph/nagiosgraph.js
nagios_cgi_url /nagios/cgi-bin
nagios_perfdata_file /var/nagios/perfdata.log
nagios_user nagios
www_user www-data
modify_nagios_config n
nagios_config_file
nagios_commands_file
modify_apache_config Y
apache_config_dir /etc/apache2/
apache_config_file
Continue with this configuration? [y] y
mkdir /usr/local/nagiosgraph
mkdir /usr/local/nagiosgraph/etc
copy etc/hostdb.conf to /usr/local/nagiosgraph/etc/hostdb.conf
copy etc/access.conf to /usr/local/nagiosgraph/etc/access.conf
copy etc/servdb.conf to /usr/local/nagiosgraph/etc/servdb.conf
copy etc/nagiosgraph.conf to /usr/local/nagiosgraph/etc/nagiosgraph.conf
copy etc/nagiosgraph_es.conf to /usr/local/nagiosgraph/etc/nagiosgraph_es.conf
copy etc/labels.conf to /usr/local/nagiosgraph/etc/labels.conf
copy etc/rrdopts.conf to /usr/local/nagiosgraph/etc/rrdopts.conf
copy etc/nagiosgraph_fr.conf to /usr/local/nagiosgraph/etc/nagiosgraph_fr.conf
copy etc/datasetdb.conf to /usr/local/nagiosgraph/etc/datasetdb.conf
copy etc/nagiosgraph_de.conf to /usr/local/nagiosgraph/etc/nagiosgraph_de.conf
copy etc/groupdb.conf to /usr/local/nagiosgraph/etc/groupdb.conf
copy etc/map to /usr/local/nagiosgraph/etc/map
copy etc/ngshared.pm to /usr/local/nagiosgraph/etc
replace text in /usr/local/nagiosgraph/etc/nagiosgraph.conf
move /usr/local/nagiosgraph/etc/nagiosgraph.conf-bak to /usr/local/nagiosgraph/etc/nagiosgraph.conf
replace text in /usr/local/nagiosgraph/etc/nagiosgraph.conf
move /usr/local/nagiosgraph/etc/nagiosgraph.conf-bak to /usr/local/nagiosgraph/etc/nagiosgraph.conf
write stub to /usr/local/nagiosgraph/etc/nagiosgraph-nagios.cfg
write stub to /usr/local/nagiosgraph/etc/nagiosgraph-commands.cfg
write stub to /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf
mkdir /usr/local/nagiosgraph/cgi
copy cgi/showhost.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/showhost.cgi
move /usr/local/nagiosgraph/cgi/showhost.cgi-bak to /usr/local/nagiosgraph/cgi/showhost.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/showhost.cgi
copy cgi/export.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/export.cgi
move /usr/local/nagiosgraph/cgi/export.cgi-bak to /usr/local/nagiosgraph/cgi/export.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/export.cgi
copy cgi/showconfig.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/showconfig.cgi
move /usr/local/nagiosgraph/cgi/showconfig.cgi-bak to /usr/local/nagiosgraph/cgi/showconfig.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/showconfig.cgi
copy cgi/showgraph.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/showgraph.cgi
move /usr/local/nagiosgraph/cgi/showgraph.cgi-bak to /usr/local/nagiosgraph/cgi/showgraph.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/showgraph.cgi
copy cgi/show.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/show.cgi
move /usr/local/nagiosgraph/cgi/show.cgi-bak to /usr/local/nagiosgraph/cgi/show.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/show.cgi
copy cgi/showgroup.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/showgroup.cgi
move /usr/local/nagiosgraph/cgi/showgroup.cgi-bak to /usr/local/nagiosgraph/cgi/showgroup.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/showgroup.cgi
copy cgi/testcolor.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/testcolor.cgi
move /usr/local/nagiosgraph/cgi/testcolor.cgi-bak to /usr/local/nagiosgraph/cgi/testcolor.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/testcolor.cgi
copy cgi/showservice.cgi to /usr/local/nagiosgraph/cgi
replace text in /usr/local/nagiosgraph/cgi/showservice.cgi
move /usr/local/nagiosgraph/cgi/showservice.cgi-bak to /usr/local/nagiosgraph/cgi/showservice.cgi
chmod 755 on /usr/local/nagiosgraph/cgi/showservice.cgi
mkdir /usr/local/nagiosgraph/bin
copy lib/insert.pl to /usr/local/nagiosgraph/bin
replace text in /usr/local/nagiosgraph/bin/insert.pl
move /usr/local/nagiosgraph/bin/insert.pl-bak to /usr/local/nagiosgraph/bin/insert.pl
chmod 755 on /usr/local/nagiosgraph/bin/insert.pl
mkdir /usr/local/nagiosgraph/share
copy share/nagiosgraph.css to /usr/local/nagiosgraph/share/nagiosgraph.css
copy share/nagiosgraph.js to /usr/local/nagiosgraph/share
mkdir /usr/local/nagiosgraph/doc
copy AUTHORS to /usr/local/nagiosgraph/doc
copy CHANGELOG to /usr/local/nagiosgraph/doc
copy INSTALL to /usr/local/nagiosgraph/doc
copy README to /usr/local/nagiosgraph/doc
copy TODO to /usr/local/nagiosgraph/doc
mkdir /usr/local/nagiosgraph/examples
copy examples/graphed-service.cfg to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph.1.css to /usr/local/nagiosgraph/examples
copy examples/map_1_4_3 to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph-nagios.cfg to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph-commands.cfg to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph-apache.conf to /usr/local/nagiosgraph/examples
copy examples/map_1_4_5 to /usr/local/nagiosgraph/examples
copy examples/map_1_4_4 to /usr/local/nagiosgraph/examples
copy examples/graphed-host.cfg to /usr/local/nagiosgraph/examples
copy examples/map_minimal to /usr/local/nagiosgraph/examples
copy examples/map_mwall to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph-logrotate to /usr/local/nagiosgraph/examples
copy examples/map_1_3 to /usr/local/nagiosgraph/examples
copy examples/nagiosgraph.2.css to /usr/local/nagiosgraph/examples
copy examples/map_examples to /usr/local/nagiosgraph/examples
copy examples/insert.sh to /usr/local/nagiosgraph/examples
copy share/graph.gif to /usr/local/nagiosgraph/examples
copy share/nagiosgraph.ssi to /usr/local/nagiosgraph/examples
mkdir /usr/local/nagiosgraph/util
copy utils/testentry.pl to /usr/local/nagiosgraph/util
copy utils/flat2hier.pl to /usr/local/nagiosgraph/util
chmod 755 on /usr/local/nagiosgraph/util/testentry.pl
chmod 755 on /usr/local/nagiosgraph/util/flat2hier.pl
mkdir /usr/local/nagiosgraph/var/rrd
chmod 755 on /usr/local/nagiosgraph/var/rrd
chown nagios,- on /usr/local/nagiosgraph/var/rrd
mkdir /usr/local/nagiosgraph/var/log
chmod 755 on /usr/local/nagiosgraph/var/log
touching /usr/local/nagiosgraph/var/log/nagiosgraph.log
chmod 644 on /usr/local/nagiosgraph/var/log/nagiosgraph.log
chown nagios,- on /usr/local/nagiosgraph/var/log/nagiosgraph.log
touching /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
chmod 644 on /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
chown www-data,- on /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
move /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf to /etc/apache2//nagiosgraph.conf
To complete the installation, do the following:
* In the nagios configuration file (nagios.cfg),
add these lines:
# process nagios performance data using nagiosgraph
process_performance_data=1
service_perfdata_file=/var/nagios/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
* In the nagios commands file (command.cfg),
add these lines:
# command to process nagios performance data for nagiosgraph
define command {
command_name process-service-perfdata-for-nagiosgraph
command_line /usr/local/nagiosgraph/bin/insert.pl
}
* Check the nagios configuration:
/usr/local/nagios/bin/nagios -v /path/to/nagios.cfg
* Restart nagios to start data collection:
/etc/init.d/nagios restart
* Restart apache to enable display of graphs:
/etc/init.d/apache2 restart
* To enable graph links and mouseovers, see README sections:
Displaying Per-Service and Per-Host Graph Icons and Links
Displaying Graphs in Nagios Mouseovers
root@nagios:/tmp/nagiosgraph-1.5.2# service apache2 restart
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 223 of /etc/apache2/apache2.conf: Could not open configuration file /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
root@nagios:/tmp/nagiosgraph-1.5.2# nano /etc/apache2/apache2.conf
Code: Select all
root@nagios:/tmp/nagiosgraph-1.5.2# cd /etc/apache2/
root@nagios:/etc/apache2# ls
apache2.conf apache2.conf.save conf-available conf-enabled envvars magic mods-available mods-enabled nagiosgraph.conf ports.conf sites-available sites-enabled
root@nagios:/etc/apache2# nano nagiosgraph.conf
root@nagios:/etc/apache2# mv nagiosgraph.conf /etc/apache2/sites-available/
root@nagios:/etc/apache2# ls sites-available/
000-default.conf default-ssl.conf nagiosgraph.conf otrs.conf
root@nagios:/etc/apache2# nano apache2.conf
root@nagios:/etc/apache2# 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# ls
apache2.conf apache2.conf.save conf-available conf-enabled envvars magic mods-available mods-enabled ports.conf sites-available sites-enabled
root@nagios:/etc/apache2# ls sites-available/
000-default.conf default-ssl.conf nagiosgraph.conf otrs.conf
root@nagios:/etc/apache2# cd sites-available/
root@nagios:/etc/apache2/sites-available# mv nagiosgraph.conf /etc/apache2/sites-enabled/
root@nagios:/etc/apache2/sites-available# 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-available# ls
000-default.conf default-ssl.conf otrs.conf
root@nagios:/etc/apache2/sites-available# cd ..
root@nagios:/etc/apache2# cd sites-enabled/
root@nagios:/etc/apache2/sites-enabled# ls
000-default.conf nagios.conf nagiosgraph.conf otrs.conf
root@nagios:/etc/apache2/sites-enabled# nano nagiosgraph.conf
root@nagios:/etc/apache2/sites-enabled# mv nagiosgraph.conf /etc/apache2/
root@nagios:/etc/apache2/sites-enabled# cd ..
root@nagios:/etc/apache2# ls
apache2.conf apache2.conf.save conf-available conf-enabled envvars magic mods-available mods-enabled nagiosgraph.conf ports.conf sites-available sites-enabled
root@nagios:/etc/apache2# nano apache2.conf
root@nagios:/etc/apache2# nano apache2.conf
root@nagios:/etc/apache2# 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# /etc/apache2/The contents of the file after fresh install;
# enable nagiosgraph CGI scripts
ScriptAlias /nagiosgraph/cgi-bin "/usr/local/nagiosgraph/cgi"
<Directory "/usr/local/nagiosgraph/cgi">
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
</Directory>
Re: Configuring Nagios Graphs
As I said previously, you will need to update your apache configuration to reflect what's above. The 'Require all granted' is needed on Apache 2.4+. The Order allow,deny and Allow from all are commented out as they're used in 2.2-.rkennedy wrote:For the record, did you update your apache settings accordingly?Did this make any difference?Code: Select all
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 Require all granted </Directory> Alias /nagiosgraph "/usr/local/nagiosgraph/share" <Directory "/usr/local/nagiosgraph/share"> Options None AllowOverride None #Order allow,deny #Allow from all Require all granted </Directory>
Former Nagios Employee
-
nathanplatt
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Configuring Nagios Graphs
Okay so that worked a charm, i'm now able to access the nagiosgraph url.
All the squares are white, the only issue i'm seing now is when i run the test;
http://192.168.1.5/nagiosgraph/cgi-bin/show.cgi
No data in rrd directory /usr/local/nagiosgraph/var/rrd
Will that be caused by a mis-config in Nagios?
All the squares are white, the only issue i'm seing now is when i run the test;
http://192.168.1.5/nagiosgraph/cgi-bin/show.cgi
No data in rrd directory /usr/local/nagiosgraph/var/rrd
Will that be caused by a mis-config in Nagios?
-
nathanplatt
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Configuring Nagios Graphs
Okay, great news! I have it running now, again thank you for all the help. I've noticed by default it only monitors Linux servers, when reading you need to modify the map file to add other items to it. When looking at monitoring Windows Servers, I've seen the following additions;
Looking at this i don't know how it will link back to the hosts, is there somewhere I can read a little more about this?
Code: Select all
# Service type: ntload
# check command: check_nt -H Address -v CPULOAD -l5,70,90,30,70,90
# output: CPU Load 9% (5 min average) 11% (30 min average)
# perfdata: '5 min avg Load'=9%;70;80;0;100 '30 min avg Load'=11%;70;90;0;100
#/perfdata:.*5 min avg Load'=(\d+)%;(\d+);(\d+);\d+;\d+ '30 min avg Load'=(\d+)%;\d+;\d+;\d+;\d+ /
/output:.*?(\d+)% .*?(\d+)% /
and push @s, [ ntload,
[ avg05min, GAUGE, $1 ],
[ avg30min, GAUGE, $2 ] ];
# Service type: ntmem
# check command: check_nt -H Address -v MEMUSE -w 50 -c 90
# output: Memory usage: total:2467.75 Mb - used: 510.38 Mb (21%) - free: 1957.37 Mb (79%)
# perfdata: Memory usage=510.38Mb;1233.88;2220.98;0.00;2467.75
/perfdata:.*usage=([.0-9]+)Mb;([.0-9]+);([.0-9]+);([.0-9]+);([.0-9]+)/
and push @s, [ ntmem,
[ memused, GAUGE, $1*1024**2 ],
[ memwarn, GAUGE, $2*1024**2 ],
[ memcrit, GAUGE, $3*1024**2 ],
[ memmmax, GAUGE, $5*1024**2 ] ];
# Service type: ntdisk
# check command: check_nt -H Address -v USEDDISKSPACE -lc -w 75 -c 90
# output: c:\ - total: 25.87 Gb - used: 4.10 Gb (16%) - free 21.77 Gb (84%)
# perfdata: c:\ Used Space=4.10Gb;19.40;23.28;0.00;25.87
/perfdata:.*Space=([.0-9]+)Gb;([.0-9]+);([.0-9]+);([.0-9]+);([.0-9]+)/
and push @s, [ ntdisk,
[ diskused, GAUGE, $1*1024**3 ],
[ diskwarn, GAUGE, $2*1024**3 ],
[ diskcrit, GAUGE, $3*1024**3 ],
[ diskmaxi, GAUGE, $5*1024**3 ] ];
# Service type: fping
# output:FPING OK - 10.1.1.1 (loss=20%, rta=385.000000 ms)
# perfdata: loss=20%;79;100;0;100 rta=0.385000s;2.000000;5.000000;0.000000
#/output:PING.*?(\d+)%.+?([.\d]+)\sms/
/perfdata:.*loss=(\d+)%.*rta=([.0-9]+)s;/
and push @s, [ fping,
[ losspct, GAUGE, $1 ],
[ rta, GAUGE, $2 ] ];-
nathanplatt
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Configuring Nagios Graphs
Thank you for all the help, i've managed to get it all configured now and polling data. I can't say i entirely understand the map file, but none the less its working.
Please close the case.
Please close the case.
Re: Configuring Nagios Graphs
Ah, my guess it just had to reference the right file.
Glad to hear you were able to get this working!
Closing this out now, but feel free to make a new thread if you need any assistance in the future.
Glad to hear you were able to get this working!
Closing this out now, but feel free to make a new thread if you need any assistance in the future.
Former Nagios Employee