check_hostgroup

Knowledge Base

Description

This plugin was developed by OpServices and add a new features by ForceOneIT our Certified Partner. This plugins checks the Hostgroups availability.

Use Examples

This plugin are in /usr/local/opmon/libexec/opservices/ directory, therefore you need access this directory before execute the command:

[root@opmon opservices]# ./check_hostgroup.php -G Linux -w 5 -c 10
Linux: UP: (26/100%) DOWN: (0/0%)|'up'=26;0;0;0;26 'down'=0;0;0;0;26 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

The -G parameter allows what the hostgroups will be monitored. On the new version, will can be define how many hostgroups are necessary. These should be separated by commas and without space.

[root@opmon opservices]# ./check_hostgroups.php -G Linux,Database 
Linux,Database: UP: (5/100%) DOWN: (0/0%)|'up'=5;0;0;0;5 'down'=0;0;0;0;5 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

The -i parameter allows to define the operation will be applied on hostgroups: union (-i) or intersection (-i), where union will be the sum of all hosts in the hostgroups and the intersection will be the sum of the hosts are common in both hostgroups. In the case of user don’t define the operation, the operation will be intersection:

[root@opmon opservices]# ./check_hostgroups.php -G Linux,Windows -i union
Linux,Windows: UP: (168/100%) DOWN: (0/0%)|'up'=168;0;0;0;168 'down'=0;0;0;0;168 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

One more example, first was searched the Linux hosts (26 in total). Then, was searched the Windows hosts (142 in total).

When we execute with the union parameter (-i union), the command will return all Windows and Linux (26 + 142 = 168), see:

[root@opmon opservices]# ./check_hostgroups.php -G Linux
 Linux: UP: (26/100%) DOWN: (0/0%)|'up'=26;0;0;0;26 'down'=0;0;0;0;26 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

[root@opmon opservices]# ./check_hostgroups.php -G Windows
 Windows: UP: (142/100%) DOWN: (0/0%)|'up'=142;0;0;0;142 'down'=0;0;0;0;142 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

[root@opmon opservices]# ./check_hostgroups.php -G Linux,Windows -i union
 Linux,Windows: UP: (168/100%) DOWN: (0/0%)|'up'=168;0;0;0;168 'down'=0;0;0;0;168 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

To understand what is intersection and union, see one more example:

Prod servers: 157
Homolog Servers: 15
Servers which are production and homologattion: 169 hosts

[root@opmon opservices]# ./check_hostgroups.php -G Servidores-Producao
 Servidores-Producao: UP: (157/100%) DOWN: (0/0%)|'up'=157;0;0;0;157 'down'=0;0;0;0;157 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

[root@opmon opservices]# ./check_hostgroups.php -G Homologacao
 Homologacao: UP: (15/100%) DOWN: (0/0%)|'up'=15;0;0;0;15 'down'=0;0;0;0;15 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

[root@opmon opservices]# ./check_hostgroups.php -G Servidores-Producao,Homologacao -i union
 Servidores-Producao,Homologacao: UP: (169/100%) DOWN: (0/0%)|'up'=169;0;0;0;169 'down'=0;0;0;0;169 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100

The union above are the sum (157+15 = 172) because are 3 hosts which are production and homologation at the same time, like the command bellow:

 [root@opmon opservices]# ./check_hostgroups.php -G Servidores-Producao,Homologacao
 Servidores-Producao,Homologacao: UP: (3/100%) DOWN: (0/0%)|'up'=3;0;0;0;3 'down'=0;0;0;0;3 'perc_up'=100%;;;0;100 'perc_down'=0%;;;0;100
Updated on 01/09/2021

Was this article helpful?

Ficou com alguma dúvida?

Perguntas & Respostas

Participe da nossa comunidade e tire dúvidas ou compartilhe respostas e ideias.

Participar

Professional Support

Não encontrou a resposta que procura? Não se preocupe, estamos aqui para ajudar!

Abrir chamado

Treinamento Online

Através da plataforma Udemy, você encontra todos os treinamentos das nossas soluções.

Inscreva-se