1.Тестирование плагинов с командной строки
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_ssmtp -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
SSMTP OK - 0.062 second response time on <IP-address-client> port 465 [220 <IP-address-client> ESMTP Sendmail 8.14.7/8.14.7; Thu, 14 Jan 2016 18:11:04 +0200]|time=0.061593s;5.000000;10.000000;0.000000;15.000000 |
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_smtp -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
SMTP OK - 0.004 sec. response time|time=0.003644s;5.000000;10.000000;0.000000 |
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_imap -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
IMAP OK - 0.020 second response time on <IP-address-client> port 143 [* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.]|time=0.020129s;5.000000;10.000000;0.000000;15.000000 |
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_simap -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
SIMAP OK - 0.059 second response time on <IP-address-client> port 993 [* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.]|time=0.059049s;5.000000;10.000000;0.000000;15.000000 |
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_pop -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
POP OK - 0.006 second response time on <IP-address-client> port 110 [+OK Dovecot ready.]|time=0.006072s;5.000000;10.000000;0.000000;15.000000 |
1 |
# su -l nagios -c '/usr/lib64/nagios/plugins/check_spop -4 -t 15 -H <IP-address-client> -w 5 -c 10' |
1 |
SPOP OK - 0.054 second response time on <IP-address-client> port 995 [+OK Dovecot ready.]|time=0.054477s;5.000000;10.000000;0.000000;15.000000 |
2.Определение команд для проверки
1 |
# cd /usr/local/nagios/etc/ |
1 |
# nano commands.d/check-mail.cfg |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
define command { command_name check-plain-pop3 command_line $USER1$/check_pop -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } define command { command_name check-secure-pop3 command_line $USER1$/check_spop -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } define command { command_name check-plain-imap command_line $USER1$/check_imap -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } define command { command_name check-secure-imap command_line $USER1$/check_simap -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } define command { command_name check-plain-smtp command_line $USER1$/check_smtp -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } define command { command_name check-secure-smtp command_line $USER1$/check_ssmtp -4 -t 30 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ } |
3.Добавление хостов/групп на мониторинг для указанных проверок
1 |
# nano services.d/services-myproject.cfg |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail IMAP Plain Available check_command check-plain-imap!5!10 use service-template-all-generic } define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail IMAP Secure Available check_command check-secure-imap!5!10 use service-template-all-generic } define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail POP3 Plain Available check_command check-plain-pop3!5!10 use service-template-all-generic } define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail POP3 Secure Available check_command check-secure-pop3!5!10 use service-template-all-generic } define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail SMTP Plain Available check_command check-plain-smtp!5!10 use service-template-all-generic } define service{ hostgroup_name hostgroup-myproject-all-servers service_description Mail SMTP Secure Available check_command check-secure-smtp!5!10 use service-template-all-generic } |
4.Проверка синтаксиса и перезапуск Nagios
1 |
# /etc/init.d/nagios configtest |
1 |
# /etc/init.d/nagios reload |