Solved

nagios3 monitoring remote linux server

Posted on 2014-02-27
11
360 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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
 
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)

Question has a verified solution.

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

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
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.:

856 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