Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: [RESOLVED] Nagios Extended Notification Mail

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    [RESOLVED] Nagios Extended Notification Mail

    Hi,

    I installed shinken with OMD (omdistro.org), but I cannot get email notifications to work. On my nagios server I always use the following script to send an email:

    http://www.bergercity.de/linux/nagio...fication-mail/
    https://www.monitoringexchange.org/i...ification-Mail

    But when I try to use it with shinken, non of the variables are filled and it looks like this (the script goes into testmode:

    Code:
    	Nagios Monitoring Message
    TESTMODE: [M] Host %%NOTIFICATIONTYPE%%: %%HOSTNAME%% is %%HOSTSTATE%% (%%NOTIFICATIONNUMBER%%) 
    Output: HOSTOUTPUT 
    http://shinken/DTG/thruk 
    Host details
    Host Informations
    Hostname	HOSTNAME
    Alias	HOSTALIAS
    Adresse	HOSTADDRESS
    
    Notes-URL	HOSTNOTESURL
    
    	Host Zustand
    Status	HOSTSTATE
    Statustyp	HOSTSTATETYPE
    Versuch	HOSTATTEMPT
    Dauer	HOSTDURATION
    Downtime	HOSTDOWNTIME
    
    Host Gruppe
    Gruppe	HOSTGROUPNAME
    Gruppen Alias	HOSTGROUPALIAS
    Gruppen Alias	HOSTGROUPNOTES
    Gruppen Alias	HOSTGROUPNOTESURL
    
    	Host-Zurkenntnisnahme
    Autor	HOSTACKAUTHOR
    Kommentar	HOSTACKCOMMENT
    
    Host Zustandsdaten
    Command	HOSTCHECKCOMMAND
    Typ	HOSTCHECKTYPE
    Latenz	HOSTLATENCY
    Prozentual	HOSTPERCENTAGE
    	Host-Ausgabe
    HOSTOUTPUT
    
    Host Zeiten
    Letzte Überprüfung	29.09.2011 23:01
    Letzter Statuswechsel	29.09.2011 23:01
    Zuletzt Online	29.09.2011 23:01
    Zuletzt Offline	29.09.2011 23:01
    Zuletzt Unerreichbar	29.09.2011 23:01
    	
    Service details
    Servive details
    Service	SERVICEDESC
    Command	SERVICECHECKCOMMA...
    Typ	SERVICECHECKTYPE
    Latenz	SERVICELATENCY
    Prozentual	SERVICEPERCENTCHA...
    	Service Gruppe
    Gruppe	SERVICEGROUPNAME
    Gruppen Alias	SERVICEGROUPALIAS
    Notizen	SERVICEGROUPNOTES
    Notizen	SERVICEGROUPNOTES...
    
    
    Service-Zurkenntnisnahme
    Autor	SERVICEACKAUTHOR
    Kommentar	SERVICEACKCOMMENT
    	Service Zustand
    Status	SERVICESTATE
    Status-Typ	SERVICESTATETYPE
    Versuch	SERVICEATTEMPT
    Dauer	SERVICEDURATION
    Downtime	SERVICEDOWNTIME
    
    Service-Ausgabe
    SERVICEOUTPUT
    	Service Zeiten
    Letzte Überprüfung	29.09.2011 23:01
    Letzter Statuswechsel	29.09.2011 23:01
    Zuletzt OK	29.09.2011 23:01
    Zuletzt Kritisch	29.09.2011 23:01
    Letzte Warnung	29.09.2011 23:01
    Letztes mal Unbekannt	29.09.2011 23:01
    
    Kontaktdetails
    Kontakt Info
    Name	CONTACTNAME
    Alias	CONTACTALIAS
    Pager	CONTACTPAGER
    	Kontaktgruppen Info
    Name	CONTACTGROUPNAME
    Alias	CONTACTGROUPALIAS
    Mitglieder	CONTACTGROUPMEMBE...
    Have anyone tried to use it, too?

    Regards,
    Daniel

  2. #2
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Nagios Extended Notification Mail

    Hi,

    How is the service command defined? I don't really understand in your post what is ok and what miss too

    I think the %% %% things will not works, the macros are defined with $ $, so I think we will better understand what miss with the command definition
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    Re: Nagios Extended Notification Mail

    Here are my commands:

    Code:
    define command{
        command_name  host-notify-by-html-email
        command_line  /usr/bin/php -q /opt/nagios_mail.php
        }
     
    define command{
        command_name  serice-notify-by-html-email
        command_line  /usr/bin/php -q /opt/nagios_mail.php
        }
    and this is the script itself:

    http://pastebin.com/aEV2zeEP


    If shinken sends a notification, the script will be executed an I get an email but without any of the variables (like on my first post). With Nagios the script works fine with the same commands.


    Regards,
    Daniel

  4. #4
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Nagios Extended Notification Mail

    Hi,

    This script use environnement macros, and they are disabled by default in the /etc/shinken/nagios.cfg file because nearly no plugins are using them and they are really CPU costing.

    You an enable them by setting :
    use_large_installation_tweaks=0
    enable_environment_macros=1

    And it should be ok ;D
    No direct support by personal message. Please open a thread so everyone can see the solution

  5. #5
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    Re: Nagios Extended Notification Mail

    Hi,

    i tried to add these parameters to the shinken.cfg, but there are no environment macros (to test it, i've created a command that writes the macros to a text file):

    Code:
    HOME='/omd/sites/DTG'
    IFS=' 	
    '
    LD_LIBRARY_PATH='/omd/sites/DTG/local/lib:/omd/sites/DTG/lib'
    MANPATH='/omd/sites/DTG/share/man:'
    MODULEBUILDRC='/omd/sites/DTG/.modulebuildrc'
    OLDPWD='/opt/omd/sites/DTG'
    OMD_ROOT='/omd/sites/DTG'
    OMD_SITE='DTG'
    OPTIND='1'
    PATH='/omd/sites/DTG/lib/perl5/bin:/omd/sites/DTG/local/bin:/omd/sites/DTG/bin:/omd/sites/DTG/local/lib/perl5/bin:/omd/sites/DTG/local/bin:/omd/sites/DTG/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin'
    PERL5LIB='/omd/sites/DTG/local/lib/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/omd/sites/DTG/local/lib/perl5/lib/perl5:/omd/sites/DTG/lib/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/omd/sites/DTG/lib/perl5/lib/perl5:'
    PERL_MM_OPT='INSTALL_BASE=/omd/sites/DTG/local/lib/perl5/'
    PPID='19271'
    PS1='$ '
    PS2='> '
    PS4='+ '
    PWD='/opt/omd/sites/DTG/tmp/shinken/run'
    PYTHONPATH='/omd/sites/DTG/lib/python:/omd/sites/DTG/lib/shinken'
    TERM='xterm'
    USER='DTG'
    The shinken.cfg:

    Code:
    #
    # This file has been created by OMD out of the following files:
    #
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg
    # /omd/sites/DTG/etc/shinken/shinken.d/tuning.cfg
    # /omd/sites/DTG/etc/shinken/shinken.cfg
    #
    # Do not edit this file. It will be recreated each time Nagios
    # is started or reloaded. Rather change things in the original
    # files.
    # 
    # ------------------------------------------------------------
    
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:18
    log_rotation_method=d
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:24
    use_syslog=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:30
    log_notifications=1
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:36
    log_service_retries=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:42
    log_host_retries=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:49
    log_event_handlers=1
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:59
    log_initial_states=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:68
    log_external_commands=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:75
    log_passive_checks=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:97
    debug_level=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:105
    debug_verbosity=0
    # /omd/sites/DTG/etc/shinken/shinken.d/logging.cfg:114
    max_debug_file_size=1000000
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:18
    check_for_updates=0
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:28
    bare_update_check=1
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:39
    date_format=euro
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:48
    use_regexp_matching=0
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:60
    use_true_regexp_matching=0
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:68
    enable_embedded_perl=0
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:77
    use_embedded_perl_implicitly=1
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:84
    illegal_object_name_chars=`~!$%^&*|'"<>?,()=
    # /omd/sites/DTG/etc/shinken/shinken.d/misc.cfg:101
    illegal_macro_output_chars=`~$&|'"<>
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:12
    lock_file=/omd/sites/DTG/tmp/shinken/run/arbiterd.pid
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:13
    temp_file=/omd/sites/DTG/tmp/shinken/tmp.file
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:14
    temp_path=/omd/sites/DTG/tmp/shinken/tmp
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:15
    log_archive_path=/omd/sites/DTG/var/nagios/archive
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:16
    state_retention_file=/omd/sites/DTG/var/nagios/retention.dat
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:17
    debug_file=/omd/sites/DTG/var/shinken/debug.log
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:18
    command_file=/omd/sites/DTG/tmp/run/nagios.cmd
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:19
    resource_file=/omd/sites/DTG/etc/nagios/resource.cfg
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:20
    cfg_dir=/omd/sites/DTG/etc/nagios/conf.d
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:21
    shinken_user=DTG
    # /omd/sites/DTG/etc/shinken/shinken.d/omd.cfg:22
    shinken_group=DTG
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:19
    retain_state_information=1
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:29
    retention_update_interval=60
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:38
    use_retained_program_state=1
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:47
    use_retained_scheduling_info=1
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:63
    retained_host_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:66
    retained_service_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:72
    retained_process_host_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:73
    retained_process_service_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:79
    retained_contact_host_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/retention.cfg:80
    retained_contact_service_attribute_mask=0
    # /omd/sites/DTG/etc/shinken/shinken.d/tuning.cfg:2
    use_large_installation_tweakes=0
    # /omd/sites/DTG/etc/shinken/shinken.d/tuning.cfg:3
    enable_environment_macros=1

  6. #6
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Nagios Extended Notification Mail

    Hi,

    It's use_large_installation_tweaks without an 'e' after the k
    No direct support by personal message. Please open a thread so everyone can see the solution

  7. #7
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    Re: Nagios Extended Notification Mail

    Hi,

    shame on me...

    Unfortunately this doesn't help :-( :

    Code:
    HOME='/omd/sites/DTG'
    IFS=' 	
    '
    LD_LIBRARY_PATH='/omd/sites/DTG/local/lib:/omd/sites/DTG/lib'
    MANPATH='/omd/sites/DTG/share/man:'
    MODULEBUILDRC='/omd/sites/DTG/.modulebuildrc'
    OLDPWD='/opt/omd/sites/DTG'
    OMD_ROOT='/omd/sites/DTG'
    OMD_SITE='DTG'
    OPTIND='1'
    ORACLE_HOME='/usr/lib/oracle/11.2/client64'
    PATH='/omd/sites/DTG/lib/perl5/bin:/omd/sites/DTG/local/bin:/omd/sites/DTG/bin:/omd/sites/DTG/local/lib/perl5/bin:/omd/sites/DTG/local/bin:/omd/sites/DTG/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin'
    PERL5LIB='/omd/sites/DTG/local/lib/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/omd/sites/DTG/local/lib/perl5/lib/perl5:/omd/sites/DTG/lib/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/omd/sites/DTG/lib/perl5/lib/perl5:'
    PERL_MM_OPT='INSTALL_BASE=/omd/sites/DTG/local/lib/perl5/'
    PPID='30505'
    PS1='$ '
    PS2='> '
    PS4='+ '
    PWD='/opt/omd/sites/DTG/tmp/shinken/run'
    PYTHONPATH='/omd/sites/DTG/lib/python:/omd/sites/DTG/lib/shinken'
    TERM='xterm'
    USER='DTG'

  8. #8
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    Re: Nagios Extended Notification Mail

    Hi,

    I give it up...

    Do you know any other script that provides a similar mail stucture than "Nagios Extended Notification Mail" and without the need of environment macros?

    Thanks for your help

    Regards,
    Daniel

  9. #9
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Nagios Extended Notification Mail

    Hi,

    So sorry, I don't know other scripts so complete.

    There must be something I don't understand in OMD and theses configurations files, because I can't reproduce your problem
    No direct support by personal message. Please open a thread so everyone can see the solution

  10. #10
    Junior Member
    Join Date
    Sep 2011
    Posts
    7

    Re: Nagios Extended Notification Mail

    Hmm...ok

    I will open a call at omdistro.org. Maybe it is a bug in the OMD-Version of shinken


    Regards,
    Daniel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •