LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-04-2007, 06:27 AM   #1
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 38
nagios, same command for multiple hosts


Hi, I was wondering if it is possible in Nagios (monitoring software) to define a command to run for multiple hosts in one go.
The normal way is to write a stanza for each host. Since all my hosts and commands are the same I would like to define a group of hosts to which apply the same monitor-command. Is that possible? How?
If possible I would like to avoid plugins or extensions.
 
Old 07-04-2007, 06:55 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,765

Rep: Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535
I assume you mean you use the same cmds/checks for all hosts (you can't have all the 'same hosts' ;-) )
Anyway, create a stanza for each cmd for 1 host, then write a short script to cp the file for each extra host and substitute eg via sed, the name of each host, then concat the files together eg:
cat host1.cfg host2.cfg ... >> hosts.cfg
 
Old 07-04-2007, 07:08 AM   #3
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Original Poster
Rep: Reputation: 38
Thanks for the try. But I found out it can be done with the hostgroup_name definition in nagios. Or you can use a comma-separated list of multiple hosts in host_name.

So /etc/nagios/services.cfg would look something like this:
Code:
define service{
     use     generic-service
     host_name      host1,host2
     service_description      ping
<SNIP>
     check_command      check_ping!100.0,20%!500.0,60%
     }
Or use the definition hostgroup_name instead of host_name:
Code:
define service{
     use     generic-service
     hostgroup_name      group1,group2
     service_description      ping
<SNIP>
     check_command      check_ping!100.0,20%!500.0,60%
     }
Then you also have to define hostgroups in /etc/nagios/hostgroups.cfg
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nagios + virtual hosts = How to keep it to one domain neocontrol Linux - Server 2 05-30-2007 01:33 AM
Nagios v.2.9 - hosts/hostgroups not recognized??? arktik Linux - Networking 2 05-25-2007 07:45 PM
after chnaging the ipaddress of nagios server new hosts adding error sridhar11 Linux - Software 0 10-26-2005 01:07 PM
PGP across multiple hosts mr666white Linux - Security 4 08-22-2004 10:14 AM
RH:8 Multiple Hosts Problem ecroswell Linux - Newbie 9 03-17-2003 05:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration