?
Solved

nagios3 monitoring remote linux server

Posted on 2014-02-27
11
Medium Priority
?
375 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
[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
  • 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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 35

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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

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é.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

770 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