2016-05-11 13 views
0

Ich versuche, E-Mail-Benachrichtigungen auf einem Nagios-Server einzurichten. Die Nagios-Maschine läuft seit einiger Zeit gut. Außer der Tatsache, dass es keine E-Mails gesendet hat. Ich habe ein Chrom-Plugin verwendet, bis ich das Problem gelöst habe.nagios sendet keine emalis

Wie auch immer, das ist, wie ich meine Kontakte Datei Setup:

define contact{ 
     contact_name      nagiosadmin    ; Short name of user 
     use        generic-contact   ; Inherit default values from generic-contact template (defined above) 
     alias       Nagios Admin   ; Full name of user 
     email       [email protected];  <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** 
     service_notification_period  24x7 
     host_notification_period   24x7 
     service_notification_options  w,u,c,r,f 
     host_notification_options  d,u,r,f 
     service_notification_commands notify-service-by-email 
     host_notification_commands  notify-host-by-email 
     } 


define contactgroup{ 
    contactgroup_name  admins 
    alias     Nagios Administrators 
    members     nagiosadmin 
    } 

Und ich habe meine Host- und Service-Definitionen Setup wie folgt aus:

define host{ 
    use      linux-server   ; Name of host template to use 
                ; This host definition will inherit all variables that are defined 
                ; in (or inherited by) the linux-server host template definition. 
    host_name    web1 
    alias     web1 
    address     10.10.10.6 
    contact_groups   admins 
    } 


define service{ 
    use        local-service   ; Name of service template to use 
    host_name      web1 
    service_description    HTTP 
    contact_groups     admins 
    check_command     check_http 
    notifications_enabled   1 
    } 

ich getestet habe, ob das funktioniert durch Herunterfahren von http auf einem Webserver, den es überwacht. Eine Weile gewartet und keine Nachricht auf dem Mail-Server erhalten.

Ich habe auch telnetted auf dem Mail-Server auf der Nagios-Maschine. Und ich kann per Telnet eine E-Mail an das Konto senden, das ich möchte.

Ich würde einige Hilfe hier schätzen!

Antwort

0

Schauen Sie in Ihre Servicebefehlskonfiguration und führen Sie sie in einem Terminal zum Debuggen aus.

Beispiel: define command { command_name notify-service-by-email command_line /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$\n $NOTIFICATIONCOMMENT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ }