{"id":621,"date":"2010-11-09T09:32:01","date_gmt":"2010-11-09T14:32:01","guid":{"rendered":"http:\/\/it.thelibrarie.com\/weblog\/?p=621"},"modified":"2013-04-03T16:34:26","modified_gmt":"2013-04-03T21:34:26","slug":"install-nagiosgraph","status":"publish","type":"post","link":"https:\/\/it.thelibrarie.com\/weblog\/2010\/11\/install-nagiosgraph\/","title":{"rendered":"Install Nagiosgraph"},"content":{"rendered":"<p><strong>Install NagiosGraph<\/strong><\/p>\n<p>First of all, this is running on Ubuntu 10.04.1 LTS x32.  I installed Nagios 3.2.0 from the source packages (see another post on this site), and will be installing NagiosGraph 1.4.3.  I&#8217;ve also installed Nagios-Plugins-1.4.15.<\/p>\n<p>This will probably be a lot of writing, but in the end it was definitely worth my time.<\/p>\n<p><strong>Update System and Install SNMPD:<\/strong><\/p>\n<blockquote><p>\n<code>su root<\/code><br \/>\n<code>apt-get install update<\/code><br \/>\n<code>apt-get install upgrade<\/code><br \/>\n<code>apt-get install snmpd<\/code><br \/>\n<code>mv \/etc\/snmp\/snmpd.conf \/etc\/snmp\/snmpd.conf.org<\/code><br \/>\n<code>nano \/etc\/snmp\/snmpd.conf<\/code><br \/>\nrocommunity  public<br \/>\nsyslocation  &#8220;MyLocation&#8221;<br \/>\nsyscontact email@domain.tld<br \/>\nSave and close<br \/>\n<code>nano \/etc\/default\/snmpd<\/code><br \/>\nChange From:<br \/>\n# snmpd options (use syslog, close stdin\/out\/err).<br \/>\nSNMPDOPTS=&#8217;-Lsd -Lf \/dev\/null -u snmp -I -smux -p \/var\/run\/snmpd.pid 127.0.0.1&#8242;<br \/>\nTo:<br \/>\n# snmpd options (use syslog, close stdin\/out\/err).<br \/>\n#SNMPDOPTS=&#8217;-Lsd -Lf \/dev\/null -u snmp -I -smux -p \/var\/run\/snmpd.pid 127.0.0.1&#8242;<br \/>\nSNMPDOPTS=&#8217;-Lsd -Lf \/dev\/null -u snmp -I -smux -p \/var\/run\/snmpd.pid -c \/etc\/snmp\/snmpd.conf&#8217;<br \/>\nSave and close<br \/>\n<code>\/etc\/init.d\/snmpd restart<\/code><\/p><\/blockquote>\n<p><strong>Test SNMPD:<\/strong><\/p>\n<blockquote><p><code>snmpwalk -v 1 -c public -O e IP_OF_YOUR_MACHINE<\/code><br \/>\nYou can use Localhost (127.0.0.1) in lieu of another IP address<\/p><\/blockquote>\n<p><strong>Download Required Files:<\/strong><\/p>\n<blockquote><p>\n<code>cd \/home\/nagios<\/code><br \/>\n<code>wget http:\/\/voxel.dl.sourceforge.net\/project\/nagiosgraph\/nagiosgraph\/1.4.3\/nagiosgraph-1.4.3.tar.gz<\/code><br \/>\n<code>apt-get install rrdtool perl libcgi-pm-perl librrds-perl libgd-gd2-perl<\/code><\/p><\/blockquote>\n<p><strong>Extract Required Files:<\/strong><\/p>\n<blockquote><p><code>tar xzvf nagiosgraph-1.4.3.tar.gz<\/code><br \/>\n<code>cd nagiosgraph-1.4.3<\/code><\/p><\/blockquote>\n<p><strong>Copy Files:<\/strong><\/p>\n<blockquote><p><code>mkdir \/etc\/nagiosgraph<\/code><br \/>\n<code>cp etc\/* \/etc\/nagiosgraph<\/code><\/p><\/blockquote>\n<p><strong>Edit Perl Scripts With FilePath:<\/strong><\/p>\n<blockquote><p><code>nano cgi\/*.cgi lib\/insert.pl<\/code><br \/>\nFind &#8220;use lib&#8221; line (definitely on the first page of text) and edit it to be \/etc\/nagiosgraph<br \/>\nSave all files<\/p><\/blockquote>\n<p><strong>Continue Copying Files:<\/strong><\/p>\n<blockquote><p><code>cp lib\/insert.pl \/usr\/local\/nagios\/libexec<\/code><br \/>\n<code>cp cgi\/*.cgi \/usr\/local\/nagios\/sbin<\/code><br \/>\n<code>cp share\/nagiosgraph.css \/usr\/local\/nagios\/share<\/code><br \/>\n<code>cp share\/nagiosgraph.js \/usr\/local\/nagios\/share<\/code><\/p><\/blockquote>\n<p><strong>Edit The Nagiosgraph.conf File:<\/strong><\/p>\n<blockquote><p><code>nano \/etc\/nagiosgraph\/nagiosgraph.conf<\/code><br \/>\nSet the following:<br \/>\nperflog           = \/var\/nagios\/perfdata.log<br \/>\nrrddir            = \/var\/nagios\/rrd<br \/>\nmapfile           = \/etc\/nagiosgraph\/map<br \/>\nnagiosgraphcgiurl = \/nagios\/cgi-bin<br \/>\njavascript        = \/nagios\/nagiosgraph.js<br \/>\nstylesheet        = \/nagios\/nagiosgraph.css<br \/>\nlogfile           = \/var\/log\/nagiosgraph.log<br \/>\ncgilogfile        = \/var\/log\/nagiosgraph-cgi.log<\/p><\/blockquote>\n<p><strong>Set Permissions For RRD Directory, Log Files, CGI Files:<\/strong><\/p>\n<blockquote><p><code>mkdir \/var\/nagios\/rrd<\/code><br \/>\n<code>chown 777 \/var\/nagios<\/code><br \/>\n<code>chown nagios \/var\/nagios\/rrd<\/code><br \/>\n<code>chmod 755 \/var\/nagios\/rrd<\/code><br \/>\n<code>touch \/var\/log\/nagiosgraph.log<\/code><br \/>\n<code>chown nagios \/var\/log\/nagiosgraph.log<\/code><br \/>\n<code>chmod 664 \/var\/log\/nagiosgraph.log<\/code><br \/>\n<code>touch \/var\/log\/nagiosgraph-cgi.log<\/code><br \/>\n<code>chown www-data \/var\/log\/nagiosgraph-cgi.log<\/code><br \/>\n<code>chmod 664 \/var\/log\/nagiosgraph-cgi.log<\/code><\/p><\/blockquote>\n<p><strong>Edit Nagios.cfg:<\/strong><\/p>\n<blockquote><p><code>nano \/usr\/local\/nagios\/etc\/nagios.cfg<\/code><br \/>\nprocess_performance_data=1<br \/>\nservice_perfdata_file=\/var\/nagios\/perfdata.log<br \/>\nservice_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$<br \/>\nservice_perfdata_file_mode=a<br \/>\nservice_perfdata_file_processing_interval=30<br \/>\nservice_perfdata_file_processing_command=process-service-perfdata<\/p><\/blockquote>\n<p><strong>Edit Commands.cfg (make sure this is enabled\/correct):<\/strong><\/p>\n<blockquote><p><code>nano \/usr\/local\/nagios\/etc\/objects\/commands.cfg<\/code><br \/>\ndefine command {<br \/>\n  command_name  process-service-perfdata<br \/>\n  command_line  \/usr\/local\/nagios\/libexec\/insert.pl<br \/>\n}<\/p><\/blockquote>\n<p><strong>Restart Nagios:<\/strong><\/p>\n<blockquote><p><code>\/etc\/init.d\/nagios restart<\/code><\/p><\/blockquote>\n<p><strong>Edit Apache Configuration:<\/strong><\/p>\n<blockquote><p>This was already done for me from the Nagios install, but just verify it&#8217;s correct.<br \/>\n<code>nano \/etc\/apache2\/conf.d\/nagios.conf<\/code><br \/>\nScriptAlias \/nagios\/cgi-bin \/usr\/local\/nagios\/sbin<br \/>\n<Directory \"\/usr\/local\/nagios\/sbin\"><br \/>\n#  SSLRequireSSL<br \/>\n   Options ExecCGI<br \/>\n   AllowOverride None<br \/>\n   Order allow,deny<br \/>\n   Allow from all<br \/>\n#  Order deny,allow<br \/>\n#  Deny from all<br \/>\n#  Allow from 127.0.0.1<br \/>\n   AuthName &#8220;Nagios Access&#8221;<br \/>\n   AuthType Basic<br \/>\n   AuthUserFile \/usr\/local\/nagios\/etc\/htpasswd.users<br \/>\n   Require valid-user<br \/>\n<\/Directory><br \/>\nThere should be more below this, so just leave that alone.<\/p><\/blockquote>\n<p><strong>Restart Apache:<\/strong><\/p>\n<blockquote><p><code>apache2ctl restart<\/code><\/p><\/blockquote>\n<p><strong>Test Your Site:<\/strong><\/p>\n<blockquote><p>http:\/\/server\/nagios\/cgi-bin\/show.cgi<\/p><\/blockquote>\n<p>You shouldn&#8217;t get any errors.  If you get a 500 internal error, the issue is with Apache.  If you get a &#8220;no rrd data found&#8221; error, then the configuration of nagiosgraph is incorrect OR you haven&#8217;t waited long enough.<\/p>\n<p><strong>You can try to run the script directly:<\/strong><\/p>\n<blockquote><p><code>cd \/usr\/local\/nagios\/libexec<\/code><br \/>\n<code>.\/insert.pl<\/code><\/p><\/blockquote>\n<p><strong>Then verify that there is some data in the RRD directory:<\/strong><br \/>\n<code>ls \/var\/nagios\/rrd\/<\/code><\/p>\n<p><strong>To get it to work with Windows Clients:<\/strong><\/p>\n<blockquote><p>Edit the map file:<br \/>\n<code>nano \/etc\/nagiosgraph\/map<\/code><br \/>\nAdd the following to the END of the file:<br \/>\n# Service type: memory<br \/>\n# check command: check_nt -H Address -v MEMUSE -w 50 -c 90<br \/>\n#output: Memory usage: tootal:2467.75 Mb &#8211; used: 510.38 Mb (21%) &#8211; free: 1957.37 Mb (79%)<br \/>\n\/perfdata:Memory usage=([.0-9])+Mb;([.0-9+);([.0-9+);([.0-9+);([.0-9]+)\/<br \/>\nand push @s, [ntmem,<br \/>\n[memused, GAUGE, $1*1024**2 ]<br \/>\n];<br \/>\n# Service type: ntload<br \/>\n# Check command: check_nt -H Address -v CPULOAD -l1,70,90,5,70,90,30,70,90<br \/>\n# output: CPU Load 9% (5 min average) 11% (30 min average)<br \/>\n#perfdata: &#8216;5 min avg Load&#8217;=9%;70;80;0;100 &#8217;30 min avg Load&#8217;=11%;70;90;0;100<br \/>\n\/output:.*?(\\d+)% .*?(\\d+)% \/<br \/>\nand push @s, [ ntload,<br \/>\n[ avg05min, GAUGE, $1 ],<br \/>\n[avg30min, GAUGE, $2 ] ];<br \/>\n# Service type: ntdisk<br \/>\n# check command: check_nt -H Address -v USEDDISKSPACE -lc -w 75 -c 90<br \/>\n# output: c:\\ &#8211; total: 25.87 Gb &#8211; used: 4.10 Gb (16%) &#8211; free 21.77 Gb (84%)<br \/>\n# perfdata: c:\\ Used Space=4.10Gb;19.40;23.28;0.00;25.87<br \/>\n\/perfdata:.*Space=([.0-9]+)Gb;([.0-9]+);([.0-9]+);([.0-9]+);([.0-9]+)\/<br \/>\nand push @s, [ ntdisk,<br \/>\n[ diskused, GAUGE, $1*1024**3 ],<br \/>\n[ diskwarn, GAUGE, $2*1024**3 ],<br \/>\n[ diskcrit, GAUGE, $3*1024**3 ],<br \/>\n[ diskmaxi, GAUGE, $5*1024**3 ] ];<\/p>\n<p>Save and close the file, then restart nagios (\/etc\/init.d\/nagios restart)<\/p><\/blockquote>\n<p>***EDIT***<br \/>\nUpdated &#8211; had &#8220;.conf&#8221; instead of &#8220;.cfg&#8221; under &#8220;edit nagios.cfg&#8221;<br \/>\nAdded chmod 777 for \/var\/nagios to allow perfdata.log to be written<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install NagiosGraph First of all, this is running on Ubuntu 10.04.1 LTS x32. I installed Nagios 3.2.0 from the source packages (see another post on this site), and will be installing NagiosGraph 1.4.3. I&#8217;ve also installed Nagios-Plugins-1.4.15. This will probably be a lot of writing, but in the end it was definitely worth my time. &hellip; <a href=\"https:\/\/it.thelibrarie.com\/weblog\/2010\/11\/install-nagiosgraph\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Install Nagiosgraph<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-621","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/comments?post=621"}],"version-history":[{"count":7,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/621\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/621\/revisions\/624"}],"wp:attachment":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/media?parent=621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/categories?post=621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/tags?post=621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}