Installing Nagios on openSUSE 11.0 Rumi, April 27, 2009 Scope: Nagios is an excellent tool that can be used to monitor your systems and devices. For more detailed information check out the main Nagios site : Nagios.org The scope of this howto is to give specific installation tips for Nagios running on openSUSE 11.x (should also work on openSUSE 10.3 and 11.1). Another aim is to give you an easy way to get graph history setup and more. ~ Step 1) Setting up openSUSE 11.0 Basically stick to the install defaults. I’d recommend to use the install DVD so you have all the needed packages at hand. Get that here : software.opensuse.org Install your basic openSUSE system Pointers on installing openSUSE 11.0 as base for Nagios *here*. Note on 64bit: Although I have a couple of running 64bit Nagios systems, I can’t say for sure 64bit is fully functional (possible 3de party plugin issues). Nagios does support 64bit and the directory locations are the same as on 32bit. 2) Installing Nagios and needed packages Download the jumpstart kit here : http://www.diwi.nl/downloads/jumstartkit.zip It contains edited sample configurations and packages that adds to the standard setup. It also includes some more detail on what can be configured (Novell Netware users: config also included 😉 ). * UPDATE : Thanks to the feedback I’ve received from Jan van de Voort, it’s come to my attention the the check_nrpe definition was missing from the included commands.cfg file. Here is the correct version: http://www.diwi.nl/downloads/updated-commands.cfg.zip Using YaST Nagios can be selected and installed. Seeing we want to get the most out of Nagios there are also some extra packages to install. We could use YaST to do this… Zypper on the other hand is quite powerful & I will be using it to install. Let’s get installing: Log in as the system user and open a terminal console and enter: su - <– elevates to root * now we run the first install batch installs basic development packages zypper install kernel-source make gcc gcc-c++ * the second batch installs nagios along with some goodies zypper install nagios nagios-plugins nagios-plugins-extras nagios-nrpe rrdtool php5 php5-gd php5-zlib apache2-mod_php5 perl-SNMP net-snmp-32bit nmap ncpfs libwavpack1 NOTE: if you are using openSUSE 11.1 as base, the nagios-www package sometimes won’t get installed as dependancy. Make sure it gets installed or just add ‘ nagios-www’ to the install command. * net-snmp-32bit is the package name if installing on a 64bit system. If your OS is 32bit change the package name to net-snmp. Now set Nagios’s WWW password. This is the account you use to log into the monitoring page. htpasswd2 -c /etc/nagios/htpasswd.users nagiosadmin Your basic Nagios setup has been installed, now lets add some items: 3) Updating Nagios to 3.0.3 (or later) NOTE: openSUSE 11.1 already includes 3.0.5, update to a later package if needed. We can update Nagios to the latest release (v3.0.3 at the time of this writing) using rpms found at http://software.opensuse.org/search From the extracted jumpstartkit copy the relevant files to new folder (e.g. we create a folder in /tmp called nagios303) To update cd to /tmp/nagios303 and run: rpm -Uhv *.rpm While updating keep an eye out for error messages. The upgrade should go without to much hassle. 4) PNP addon: PNP is an extension for Nagios that, along with the Rrdtool , makes for nice graphs and historic logging. To install it download and extract the startkit zip. Note: A newer version could be available from the OBS service cd to the unzipped folder containing the PNP rpm and install it using: rpm -Uhv pnp4nagios-.i586.rpm <- 32bit OS * or * rpm -Uhv pnp4nagios-.x86_64.rpm <- 64 bit OS 5) Placing the modified config files Now all the packages are installed we can copy over the basic configuration files found in the jumpstartkit. Copy the files in the folder ‘/basic setup’ to the relevant locations (overwriting existing files). When the copy is done check the placed configuration files for possible errors: /usr/sbin/nagios -v /etc/nagios/nagios.cfg No errors should be returned! 6) Setting the needed services to start at boot To set the needed services to start at boot: chkconfig apache2 on chkconfig nagios on chkconfig npcd on <- * only needed if running pnp in bulk mode And now start them manually: service apache2 start service nagios start service npcd start <- * only needed if running pnp in bulk mode * PNP will be set to run in single mode to collect it’s data. You can use the npcd daemon to run this action in bulk mode. To enter this mode edit the nagios.cfg file as needed. ** Congratulations! Your customized Nagios is now running!! ** Nagios can be accessed by browsing to http://[ip or name server]/nagios Log in with nagiosadmin and the password you have set for it. You can now further customize and add the needed definitions within the /etc/nagios/objects directories. Copy and rename the sample files so the end in the .cfg extension. When nagios is restarted the *.cfg files will be read and changes should be reflected in the Nagios web interface. tip: When you have configured Nagios to suit your needs, it’s a good idea to set the default runlevel to 3. This will let your system run using less memory. To set this edit /etc/inittab and set the initdefault from 5 to 3. 7) Enable mail support using postfix Run YaST > ‘Mail Transfer Agent ‘ Choose standard setup, permanent connection and enter the outgoing server. * If Nagios is set to mail to external addresses the outgoing server should be set to allow Nagios to relay mail. Don’t forget to edit /etc/nagios/objects/contacts.cfg to reflect the correct contact email addresses. 8) Troubleshooting Keep an eye on /var/log/messages. Nagios will write debug info to this log. After making changes to configuration files always check for errors using the nagios verify option: /usr/sbin/nagios -v /etc/nagios/nagios.cfg —————————————————————- Other useful information: Nagios directories in openSUSE: Configuration file locations: /etc/apache2 /etc/nagios <– holds your Nagios configuration /etc/nagios/pnp /etc/nagios/objects <– holds Nagios templates, commands & definitions Website & related files: /usr/share/nagios /usr/share/pnp Logging and spooling directories: /var/spool/nagios /pnp /var/lib/nagios /pnp /var/log/messages Finding out more about a plugin Most plugins have an extensive help page included that can be listed by running the plugin manually with the –help switch appended to it. The plugins can be found in /usr/lib/nagios/plugins cd into this directory and run the pluigin using the switch, e.g. ./check_load --help Plugins needing special privileges (as found at http://en.opensuse.org/Nagios-plugins) There are at least three check scripts that need root privileges to run: * check_dhcp * check_icmp * check_ide_smart To be “safe per default”, SuSE doesn’t install these plugins with the suid bit set. There are two recommended ways about overriding this on your system: [edit] Set the suid bit Note: Please choose only those examples you need. * change the group ownership to the users primary group that executes this check (normally nagios): chgrp nagios /usr/lib/nagios/plugins/check_dhcp chgrp nagios /usr/lib/nagios/plugins/check_icmp chgrp nagios /usr/lib/nagios/plugins/check_ide_smart * set the suid bit so the plugin is executed as root: chmod 4750 /usr/lib/nagios/plugins/check_dhcp chmod 4750 /usr/lib/nagios/plugins/check_icmp chmod 4750 /usr/lib/nagios/plugins/check_ide_smart More information about Nagios on openSUSE: http://en.opensuse.org/Nagios http://en.opensuse.org/PNP4Nagios —- Need SMS notification support? Check out http://www.mollie.nl or http://www.twisted-solutions.nl — Viewing the 3D status map: To view this map you will need to install a VRML plugin. For openSUSE freeWRL is a good choice. Note: You will first need to install packages sox & openmotif before installing the freewrl package. Administrations Configurations (Linux)