Hello, I am stuck already. All installed fine & I can add my 1st host into windows.cfg. The difficulty comes when adding the second host. Can someone post their config of a windows.cfg file with more than 1 host in it please.
What I dont understand is the 7 define service statements in the file. For each host I add do I then need to add another 7 define statements per host with a matching hostname??
First of all, you need to define a new host, something like the following:
define host{
use windows-service
host_name your host
alias host name
address ip address of the host
max_check_attempts 3
notification_interval 60
notification_period 24x7
}
Then you need to add the new host to the host group. Look at the example below:
Then you will want to add the new host to the command definition:
define service{
use windows-service
host_name host name
and so on for the configuration
}
And that should be it…
Hi!
no, you don’t need to define only 7 parameters for a host, but much more!
BUT, the good news is that, in order to be lazy, you can define hosts templates.
The very good news is that some are already defined!, like “generic-host”.
Here is my template for a generic host:
define host{
name generic-host
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 0 ; Host event handler is enabled
flap_detection_enabled 0 ; Flap detection is enabled
process_perf_data 0 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
passive_checks_enabled 0
obsess_over_host 0
active_checks_enabled 1
check_command check-host-alive-ping
notification_interval 10
max_check_attempts 2
notification_period 24x7
notification_options d,u,r
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
which is almost the pre-defined template. Note the “register => 0” at the end, which means that it is a template, and not a host definition.
From this definition, you can use it to define your hosts. here are two examples:
define host{
use generic-host
host_name Host_1
alias my_alias_1
contact_groups netcool-group
address address1
}
define host{
use generic-host
host_name Host_2
alias my_alias_2
contact_groups netcool-group
address address2
}
As you can see, I only defined 4 parameters, plus de “use” parameter.
As you can also see, I could have put the “contact_groups” parameter in my template, since all my hosts are defined with the same contact_groups (but I’m too lazy to correct all my cfg :))
I hope this helps you grabing the meaning of hosts definitions, and which parameters to define
EDIT thanks loose, I thought there would have been sensible (lazy!) way to do it. Will try this out.
ok add new host to windows.cfg is fine:-
define host{
use windows-server ; Inherit default values from a template
host_name exchange
alias DC
address 192.168.0.24
}
members:- well this is not mentioned in the quickstart quide for monitoring windows servers, I will try to find additional infomation.
Its the define service bit I still dont understand. Are you saying that if I want to monitor 200 servers with identical monitoring requirements I need to add 7 new ‘define service’ statements covering memory usage, disk space etc etc per server added to the windows.cfg file:?: Surely I am misreading this? or perhaps this is what the members statement does?
Basically, for example, you create one command definition for checking memory usage and then add the host names to the command definition that you want nagios to include in the command check. Look at the following:
define service{
use linux-service
host_name host1, host2, host3
service_description memory usage
check_command check_memory
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 1
retry_check_interval 1
contact_groups nagios-admins
notification_interval 60
notification_period 24x7
}
Host 1-3 represent a host that you have defined in your host definition. So basically, you only need one service definition for all hosts that you want to be included in the service definition for the command check.