?
Solved

nagios3 monitoring remote linux server

Posted on 2014-02-27
11
Medium Priority
?
383 Views
Last Modified: 2014-03-17
i have nagios3 and i monitor windows and linux server. My nagios server send mails if warning and criticaly something. But both mails send to only one mail address.

i would like nagios sends mails two diffrent mails addresses if windows meassages then windowswarning@domain.com ,if linux server messages then linuxwarning@domain.com


please help me to configure

thanks
0
Comment
Question by:apollo-13
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 9

Assisted Solution

by:sda100
sda100 earned 1000 total points
ID: 39891473
Hello,

You can do this by defining Contact Groups.
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#contactgroup

Steve
0
 
LVL 1

Assisted Solution

by:Reza_a
Reza_a earned 664 total points
ID: 39891474
You need to do following steps:
create two contact for linux email and windows emails in contacts.cfg file

define contact{
        contact_name            linux_contact
        use                             linux_contact
        alias                           Linux admin
        email                          linuxadm@example.com
        }

Then create contact group

define contactgroup{
contactgroup_name          linux-admins
alias                             Linux Administrators
members                    linux_contact
}


Then add contact group for each service you need depending the type of service

define service{
use                             service1
host_name                       prod-db
service_description             CPU Load
contact_groups                  linux-admins
check_command                   check_nrpe!check_load
}
0
 

Author Comment

by:apollo-13
ID: 39891527
Error: Could not find any host matching 'server1' (config file '/etc                       /nagios3/objects/windows.cfg', starting on line 546)
Error: Could not expand hostgroups and/or hosts specified in service (config fil                       e '/etc/nagios3/objects/windows.cfg', starting on line 546)
   Error processing object config files!


#contacts.cfg

###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }
define contact{
        contact_name                        linux_contact
        use                             linux_contact
        alias                           Linux admin
        email                          mailaddress
        }
define contactgroup{
contactgroup_name          linux-admins
alias                      Linux Administrators
members                    linux_contact
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:apollo-13
ID: 39891538
Warning: Duplicate definition found for contact 'nagiosadmin' (config file '/etc/nagios3/objects/contacts.cfg', starting on line 30)
Error: Could not add object property in file '/etc/nagios3/objects/contacts.cfg' on line 31.
   Error processing object config files!
0
 
LVL 1

Assisted Solution

by:Reza_a
Reza_a earned 664 total points
ID: 39891560
The service1 is an example, you need to modify your service files.
0
 
LVL 9

Assisted Solution

by:sda100
sda100 earned 1000 total points
ID: 39891561
You shouldn't just copy/paste the example above.  You must use it as a guide for your particular situation.

You will need to post more of your configuration if you need help diagnosing the exact error line.

Steve
0
 

Author Comment

by:apollo-13
ID: 39891564
#contact.cfg

###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

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                           nagios@localhost      ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

define contact{
        contact_name                        linux_contact
        use                             linux_contact
        alias                           Linux admin
        email                          mail@domain.com
        }
define contactgroup{
contactgroup_name          linux-admins
alias                      Linux Administrators
members                    linux_contact
}
0
 

Author Comment

by:apollo-13
ID: 39891570
i changed before server1 to pass my hostname of server
0
 
LVL 9

Assisted Solution

by:sda100
sda100 earned 1000 total points
ID: 39892214
I don't have an install at the moment to check the exact config files, but the error message about contacts, said you have a duplicate definition for 'nagiosadmin'.  It must be defined in more than one file that nagios is trying to load.

In your nagios config directory (/etc/nagios3/)?? , type: "   grep -irl nagiosadmin   ", whcih should list all the config files with that mentioned.  That will give you a clue where to start.

Don't forget to test your config every few changes to make sure you don't change too much and get confused:
http://nagios.sourceforge.net/docs/3_0/verifyconfig.html

Does this help?
Steve
0
 
LVL 36

Accepted Solution

by:
Seth Simmons earned 336 total points
ID: 39892331
your last contact.cfg post is on the right track; just add another contact for windows admin

define contact{
	contact_name		windows_contact
	alias			Windows admin
	email			windowswarning@domain.com
	}

Open in new window


then for your service/host definitions, define the contact appropriately
0
 

Author Comment

by:apollo-13
ID: 39894160
Hey guys , I am not success yet But i would like to say that YOU ARE SUPER!!! with yours comments.

I AM VERY HAPPY TO ASK MY QUESTION HERE.

I will let you know result
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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