Solved

Nagios 4.0.8 adding additional hosts

Posted on 2014-09-20
9
773 Views
Last Modified: 2014-12-15
I have installed Nagios 4.0.8 on fedora and it seems to be working well. I added the initial windows host for monitoring in the windows.cfg file according to the directions. Now if  I want to add additional hosts do I just duplicate the code that is already in there and just change the host name and IP? Is there a better way of doing that maybe a different config file for each host or something? Thanks!
0
Comment
Question by:eli290
  • 5
  • 4
9 Comments
 
LVL 18

Expert Comment

by:Sanga Collins
ID: 40334499
Hi eli290

You can also duplicate the file and name it Linux.cfg and change the details to reflect Linux servers. This is the basic way monitored items are organized in nagios.

In the nagios.cfg there is a parameter to specify a directory ( on mine I called the directory 'hosts') and in th directory and sub directories I save all my files. Some are based on remote location such as state or country while others based on server type like emailservers.cfg or networks like routers.cfg

Hope that helps
0
 

Author Comment

by:eli290
ID: 40334509
oh ok, I may hit you up again if thats ok once I get a second to make that edit
0
 
LVL 18

Expert Comment

by:Sanga Collins
ID: 40334532
Not a problem. Send any additional questions our way
0
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)

 

Author Comment

by:eli290
ID: 40336408
Ok so I see where you were talking about the directory location for a specific category such as servers, printers etc... If I want to create a new category such as workstations I would just create an additional group above right? for instance

# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers


If I want to create say a workstation group I could just create
cfg_dir=/usr/local/nagios/etc/workstations

Am I correct on this?
0
 
LVL 18

Accepted Solution

by:
Sanga Collins earned 500 total points
ID: 40336419
Yes that is correct. Remember this is just a folder for organizing config files. I nagios you use host groups definition to define the groups you want hosts to be a member of when viewed from nagios.
0
 

Author Comment

by:eli290
ID: 40336788
OK so I created a new cfg file and placed it in the servers folder that I created. The new cfg is named file01.cfg and I basically duplicated the windows.cfg file. I went back and edited the windows.cfg and put it back to the sample data. Now I get a warning when validating.

Warning: Duplicate definition found for hostgroup 'windows-servers' (config file '/usr/local/nagios/etc/servers/file01.cfg', starting on line 46)
Error: Could not add object property in file '/usr/local/nagios/etc/servers/file01.cfg' on line 47.

Any thoughts?
0
 

Author Comment

by:eli290
ID: 40337017
OK I got that worked out kinda... I had to comment out the Windows Machine Definition
# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

However when I create a second host cfg and change the IP address and host_name to the new server name I get the same error. Line 46 begins with the following

define hostgroup{
      hostgroup_name      windows-servers      ; The name of the hostgroup
      alias            Windows Servers      ; Long name of the group
      }

Those are in fact the same in both files but I thought that just basically says that these devices are in the host group windows-servers?
0
 

Author Comment

by:eli290
ID: 40337377
Got it working but just using the single file which is working fine. I had to use the * in the place of the host name under services
0
 
LVL 18

Assisted Solution

by:Sanga Collins
Sanga Collins earned 500 total points
ID: 40337463
Sorry for the late reply. I was going to say that you only need to define the hostgroup once to make it available for all other future hosts.

In my ../config directory i have the following files

hostgroups.cfg
hosts.cfg
servers.cfg
routers.cfg
services.cfg

This way I am sure not to define something more than once. For example I may define a service SMTP to check email servers, then under that single service defenition I list all my email servers instead of making a new services for each.

hope that clears it up :)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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 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…
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.

685 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