Nagios
Downloads
DEB Packages
nagios3 nagios-plugins nagios-nrpe-plugins
Config prüfen
/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
pnp4nagios
- http://docs.pnp4nagios.org/de/pnp-0.6/doc_complete
- http://docs.pnp4nagios.org/de/pnp-0.6/webfe
- http://nagios.sourceforge.net/docs/3_0/cgiincludes.html
- http://docs.pnp4nagios.org/faq/3
NSCA
apt-get install nsca
NSCA Testscript
#!/bin/bash CFG="/etc/nagios/send_nsca.cfg" CMD="hostname;ROOT PARTITION;33;10;/" /bin/echo $CMD | /usr/sbin/send_nsca -H 123.13.132.123 -d ';' -c $CFG
echo "test;test;0;test-output" | send_nsca -H hostname -p 5667 -c /etc/send_nsca.cfg
Client
send_nsca.cfg send_nsca
#commands file tail # 'process-host-perfdata' command definition define command{ command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/nagios/host-perfdata.out } # 'process-service-perfdata' command definition define command{ command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/nagios/service-perfdata.out } #submit_service_check define command { command_name submit_service_check command_line $USER1$/eventhandlers/distributed-monitoring/obsessive_svc_handler $HOSTNAME$ "$SERVICEDESC$" $SERVICESTATE$ "$SERVICEOUTPUT$|$SERVICEPERFDATA$" } #submit_host_check define command{ command_name submit_host_check command_line $USER1$/eventhandlers/distributed-monitoring/obsessive_host_handler $HOSTNAME$ $HOSTSTATE$ "$HOSTOUTPUT$|$HOSTPERFDATA$" }
NRPE
/etc/default/nagios-nrpe-server
- hier kann SSL ein und ausgeschalten werden
nrpe xinetd.d
#Nagios remote Service service nrpe { flags = REUSE socket_type = stream wait = no user = nagios group = nagios server = /usr/local/nagios/nrpe server_args = -c /usr/local/nagios/nrpe.cfg --inetd -n log_on_failure += USERID disable = no only_from = 127.0.0.1 192.168.0.1 }
MK Livestatus
http://www.nagios-portal.org/wbb/index.php?page=Thread&threadID=17389 http://docs.icinga.org/1.3.0/de/int-mklivestatus.html
mcrypt
mcrypt libmcrypt -dev php5-mcrypt http://www.nagios-portal.org/wbb/index.php?page=Thread&threadID=19022
NagiosQL
#Passwort Reset update `tbl_user` set `username` = 'admin', `alias` = 'Administrator', `password` = md5('password'), `access_rights` = '11111111', `wsauth` = '0', `active` = '1', `nodelete` = '1', `last_login` = '', `last_modified` = NOW() where `id` = '1';
NagiosQL Repository
# NagiosQL deb http://debian.swobspace.net lenny main deb-src http://debian.swobspace.net lenny main
Graphiz
apt-get install graphviz
check_nt
http://www.nagios-wiki.de/nagios/plugins/check_nt
./check_nt -H xxxxxxxxxxxxxxxx -p 12489 -v CLIENTVERSION ./check_nt -H <host_address> -p 12489 -v COUNTER -l "\\Leistungsobjekt(Instanz)\\Indikator"
check_mailq
command[check_nrpe_mailq]=/usr/lib/nagios/plugins/check_mailq -w 50 -c 100 -M qmail | postfix | sendmail | exim
qmail problem
QMail Fix Part1: http://www.cherpec.com/2008/08/nagios-check_mailq-is-not-executable-by-uid-0/
Danke an: http://forums.cacti.net/viewtopic.php?t=13199
Code:
- /5 * * * * root /var/qmail/bin/qmail-qstat > /tmp/qmail-qstat
and then use a modified sript to read the data:
Code:
#!/usr/bin/perl # # qmailq.pl # # Author : Jeremy Garcia <jeremy@linuxquestions.org> # Modified : Ollie Maitland # Date : 07/07/04, 25/04/06 # Version : 0.3 # Description : Script to output the number of messages in a qmail queue. # Output is <messages in queue> <messages in queue but not yet # preprocessed> # Thanks to Nick, who alerted me to the fact that the script # needed an update # to be compatible with the latest version of cacti. # Full path to qmail-stat. If you are using Linux you will need to write # a SUID perl wrapper as suid sh scripts are no good in Linux. #@queue = `/var/qmail/bin/qmail-qstat`; open (QMAIL, '</tmp/qmail-qstat'); my @queue = <QMAIL>; close QMAIL; @jqueue = split " ",$queue[0]; @pro = split " ",$queue[1]; print join(':','messages',$jqueue[3])," ",join(':','unprocessed',$pro[7]);
Pretty obvious but some people might be having problems...incidentally for those people searching errors, this is what you might get when trying to use apache directly on the qmail-qstat binary:
find: queue/mess/*: Permission denied find: queue/todo: Permission denied messages in queue: -1 messages in queue but not yet preprocessed: -1