Grouping

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Grouping

Post by MPIvan »

Hi all,

I have read nagios documentation and i get the point of the grouping hosts and other but i need a little help. I would like to make a template and group of hosts and services, for example i would like to have 10 PC-servers to have (i dont know) 5 services like UpTime, CPU, Bandwith, SSH for example and HTTP. Also i would like to do this on Routers, i have 50 routers and to have them in one group and 10 same services to get all of them like Port UPTIME ....

And another problem i can think of this shame is the community string/passwords ... because i use different password and community string on almost all machines.

Any suggestions ?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Grouping

Post by abrist »

You can do this a number of ways. The easiest, most direct way, would be to use hostgroups. Create a hostgroup, then create services and add them to the hostgroup. Then add whatever hosts that should have those service checks to the hostgroup. Rinse and repeat for each set of services.

You could also do this through templates. Create a set of services and add them to a servicegroup. Then create a service template and add the servicegroup to it. Then create a hostgroup and add that to the template. Then add hosts to the host group and they will all inherit the checks from the template.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Grouping

Post by MPIvan »

Hi abrist, and tnx for reply ...

that's good idea, ill try some things.. now im trying to work with different community string on each host, and i need help here. For example: i have create in template like this...

define hostgroup{
name group1
use generic-host
members PC1,PC2,PC3
}

and
define servicegroup{
name servicegroup1
use generic-service
members PC1,Uptime,PC2,Uptime,PC3,Uptime
}

and now im wondering is there a way to put different community string/password for eche PC and combine with macro to passed for each PC ?
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Grouping

Post by MPIvan »

Well i gees i wont need explanation i found the solution ... and here it is....

i made in template.cfg file my definition about host ...

Code: Select all

define host {
name     def-host1
use         generic-host
check_period            24x7            ; By default, Windows servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          3               ; Schedule host check retries at 1 minute intervals - 1
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,r             ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              windows-for-def-host1 ; Host groups that Windows servers should be a member of
        register                0
}
then in the windows.cfg file i made hostgroup and define the hosts

Code: Select all

define host{
use      def-host1
host_name  PC1
alias            win 8
address       10.10.10.10
_SNMPCOMMUNITY    Test1
}

define hostgroup{
hostgroup_name    windows-for-def-host1
alias                       windows PC's
members              PC1,PC2,PC3 ; i think it can do without members ... 
}

and the services
define service{
use            generic-service
hostgroup_name    windows-for-def-host1
service_description     Uptime
check_command           check_nt!UPTIME
}
and in the commands.cfg
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 1354 -s $_HOSTSNM$
}

so thats it ... now im trying to group services so if you have any sugestions pls shear ....
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Grouping

Post by abrist »

You can group services by hostgroups or by servicegroups attached to templates.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Grouping

Post by MPIvan »

That is my next think. But what can i do with the service like ifOperStatus.0 - for interface fa 0/0 and ifOperStatus.1 for interface 0/1 etc.... how can i solve this repeating ?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Grouping

Post by abrist »

MPIvan wrote:That is my next think. But what can i do with the service like ifOperStatus.0 - for interface fa 0/0 and ifOperStatus.1 for interface 0/1 etc.... how can i solve this repeating ?
You really cannot solve it, as they are technically different service checks. If you have a mib/oid for the overall status of the switch you could, but your switch most likely does not have the option.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Grouping

Post by MPIvan »

I did as grouphost .. i have read somewhere that you can split with a " , " in old versions of nagios here and in some other google search results but nothing work or im doing something wrong ...
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Grouping

Post by sreinhardt »

Sorry that link does not work, seems to be a paid google book. Could you provide another similar link?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: Grouping

Post by MPIvan »

I cannot find another link for that book but here is how in the example is written:
check_snmp -H 10.0.0.4 -C public -o IF_MIB::ifOperStatus.1,IF-MIB::ifOperStatus.2
.

This book is Pro Nagios 2.0 and somewhere in google search i have found similar solution, i cannot find that link but if i remember good it was something like ifOperStatus.1,2,3 something like this or similar
Locked