Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

nagios notification

Posted on 2013-12-19
8
Medium Priority
?
360 Views
Last Modified: 2013-12-20
I have problem Mail notification in nagios 3(debian Linux).but my Postfix mail works because if i make a test like
mail -v it@domain.com then comes mail

hier is my configurations:

###contact.cfg
define contact{
        contact_name                    myname
        alias                           myname
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           it@mydomain.com
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin, it
        }


###command.cfg
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: http://nagios/nagios/cgi-bin/status.cgi?host=$HOSTNAME$&style=detail\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

define command{
        command_name    notify-service-by-sms
        command_line    /usr/local/nagios/libexec/eventhandlers/sendsms $CONTACTPAGER$ "NAGIOS $NOTIFICATIONTYPE$ $DATE$ $TIME$ $HOSTNAME$ Service: $SERVICEOUTPUT$"
        }

###nagios.cfg


# NOTIFICATION LOGGING OPTION
# If you don't want notifications to be logged, set this value to 0.
# If notifications should be logged, set the value to 1.

log_notifications=1
0
Comment
Question by:apollo-13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:apollo-13
ID: 39731231
i found something mails sended root@localhost . how can i change?
0
 
LVL 7

Expert Comment

by:Beneford
ID: 39731248
Do you have

contact_groups admins

in your host/service definitions?

You also need to have the contacts you want to receive the email defined in the group referred to in contact_groups, so

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin, it, admins
        }
0
 

Author Comment

by:apollo-13
ID: 39731257
No   contact_groups admins .how can i do that?
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 7

Expert Comment

by:Beneford
ID: 39731262
In your definitions of hosts and services, you indicate who should be notified by including the line:

contact_groups admins

so (eg):
define host{
       host_name    MyRouter
       address          192.168.1.1
       contact_groups admins
       }

This contact_groups refers to one or more contactgroup definitions (the one you have shown above is called 'admins')
The contactgroup collects the contacts, and these contacts are notified when a notifiable event takes place.
0
 

Author Comment

by:apollo-13
ID: 39731293
I have so :

#######PC19 TEST PING #######

define host{
      use            windows-server
      host_name       PC19
      alias                       Remote Windows Host
      address             x.x.x.x ip
      contact_groups       admins
     icon_image           internet_device.png
       statusmap_image      internet_device.gd2

}

define service{

      use                  generic-service
      host_name            PC19
      service_description      Explorer
      check_command            check_nt!PROCSTATE! -d SHOWALL -l Explorer.exe

      }
0
 

Author Comment

by:apollo-13
ID: 39731307
i do not undesrtand something. I have in two diffrent place contact.cfg ,which one do i need to use?
/etc/nagios3/objects/contacts.cfg
/etc/nagios3/conf.d/contactsnagios2.cfg
0
 

Author Comment

by:apollo-13
ID: 39731310
mails still come to mail  root [root@mydomain.com].But i definied my mail address.
0
 
LVL 7

Accepted Solution

by:
Beneford earned 2000 total points
ID: 39731442
You need to trace the configuration - do you have the web UI running?

At the bottom, select: configuration and then select Contact Groups, and Contacts and check it's what you were expecting?
Then look at Hosts and see that the Contacts/Groups is right.

This config is what is actually running - you should be able to trace the .cfg files.

The file /etc/nagios/nagios.cfg indicates which .cfg files are used:
cfg_file= <-- this line is probably repeated for individual files
cfg_dir= <-- this is a directory - all .cfg files here will be loaded.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question