Solved

nagios3 monitoring remote linux server

Posted on 2014-02-27
11
353 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 250 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 166 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
 

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 166 total points
ID: 39891560
The service1 is an example, you need to modify your service files.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 9

Assisted Solution

by:sda100
sda100 earned 250 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 250 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 34

Accepted Solution

by:
Seth Simmons earned 84 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now