Solved

nagios3 monitoring remote linux server

Posted on 2014-02-27
11
356 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

919 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

19 Experts available now in Live!

Get 1:1 Help Now