notify email
- Ajout de l’option -r pour forcer l’envoie
/usr/bin/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$" | /bin/mail -s "Services $SERVICESTATE$ alert for $HOSTNAME$/$SERVICEDESC$!" -r $CONTACTEMAIL$ $CONTACTEMAIL$
- email ne fonctionne pas, voir /srv/eyesofnetwork/nagios-3.5.1/etc/
define contact {
contact_name admin
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email,notify-service-by-email
service_notification_commands notify-host-by-email,notify-service-by-email
can_submit_commands 1
retain_status_information 1
email admin[at]domaine.local; <= on vérifie cette ligne
}
check_update_ipfire
snmpwalk -v2c -c public 127.0.0.1 nsExtendOutput1
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."update" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."echotest" = STRING: hello world
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."update" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."echotest" = STRING: hello world
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."update" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."echotest" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."update" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendResult."echotest" = INTEGER: 0
snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.\"update\"
.1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 <= GOOD
$USER1$/check_snmp -H $HOSTADDRESS$ -P 1 -C $USER2$ -o .1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 -l "Update" -s 0 -c 2
- Ce qui donnerai dans un fichier texte normal
define command {
command_name check_ipfire_update
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -P 1 -C $USER2$ -o .1.3.6.1.4.1.8072.1.3.2.3.1.1.6.117.112.100.97.116.101 -s 0 -c 2 -l "Update"
}
- debug : /srv/eyesofnetwork/nagios-3.5.1/plugins/debug
#!/bin/bash
# Attention au caractère ! dans la commande nagios.
DATE=$(date +%d-%m-%Y-%H-%M-%S)
DIR=/tmp/nagios-${DATE}
echo ${@} > ${DIR}
${@}