13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 3 ■ MONITORING AND UPDATINGdefine service {hostgroup_nameservice_descriptioncheck_commanduse}nrpeSMTPcheck_nrpe_1arg!check_smtpgeneric-serviceThen set up which hosts have these checks by defining a hostgroup in conf.d/hostgroups_nagios2.cfg:define hostgroup {hostgroup_name disk-localaliasHosts with /localmembers client1, client2}define hostgroup {hostgroup_name smtpaliasHosts with SMTPmembers client1, client2, server1}Restart Nagios, and you’re done!■ Note One gotcha to watch out for is that the check_disk command takes percentage arguments, and it warnson percentage free, rather than percentage used. Mine is set to warn at 10 percent and to be critical at 5 percent.3-9. Enabling External Commands in NagiosEnabling external commands means that you can do various things from the web interface, such asrestarting services. To turn them on, first you need to stop Nagios (/etc/init.d/nagios3 stop). Editnagios.cfg, and set the check_external_commands value to 1.Next, if you’re using Debian, you need to set the permissions on /var/lib/nagios2/rw correctly. Tomake that directory read-writeable by your apache2 user (on Debian this is www-data), use thesecommands:dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios2/rwdpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios2This will override the package defaults to set the rw directory to be owned by the www-data group andto be group-executable. It also sets the setgid bit so that files created within this directory will also beowned by www-data rather than by the user who created the file. The permissions on the parent directory(/var/lib/nagios2) are changed similarly, but by using the nagios group rather than www-data andwithout the setgid bit.76Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!