Page 1 of 2

Smart way to configure same service checks for multiple host

Posted: Tue Nov 27, 2018 9:23 am
by junkertf
Hello,

Is there a smart way to configure service checks to our sql instances for the follofing situation.

We have approximative 20 hosts and cca. 40 SQL instances to monitor with 5-10 service checks per instances, the instances are running staticly os the servers so that part i must configure by hand, that which server will be the part of which hostgroup.

I thinked on how that ammount of check can be configured fast and smart. I think the answer is somewhere the free variables, os user configured macros, but dont find a good way yet.

The currently way i think, that i make a hostgroup for the servers running same instances, what i connect eighter to a service group or to a service (template), but in that case i lost the option that have Host specific free variables. Other side if i use the free variable on service side then i must configure all the cca 300 service by hand.

Is there a good solution for that situation?

Thank you, best regards,

Ferenc

Re: Smart way to configure same service checks for multiple

Posted: Tue Nov 27, 2018 5:00 pm
by npolovenko
Hello, @junkertf. Let me reiterate what you said. You have 40 MYSQL Instances located on various servers. Each one is using the same 5-10 service checks? Or are the service checks going to be different? Can you provide an example of two "similar" MYSQL checks for 2 instances?

Re: Smart way to configure same service checks for multiple

Posted: Wed Nov 28, 2018 3:31 am
by junkertf
Hello,

You understand right. 40 SQL instances, on various servers, same 8 service check.
Not all the nodes running all the nstances, but the group of nodes can be declared for the same instance.

Service running on MSSQL windows servers checked with ncpa. (the \$INSTANCE is the name of our 40 instances)
example for ncpa check:

-M "windowscounters/MSSQL\$INSTANCE:Buffer Manager/Buffer cache hit ratio" -q "sleep=1"
-M "windowscounters/MSSQL\$INSTANCE:General Statistics/Processes blocked" -q "sleep=1"

Thank you!
Best regards,

Ferenc

Re: Smart way to configure same service checks for multiple

Posted: Wed Nov 28, 2018 4:55 pm
by npolovenko
@junkertf, You could just prepare/copy the config definitions in a text file, and then import them using the Import Config Files tool. It could be relatively quicker to multiply configs and replace instance names in a text file then in the CCM. Or put the config file in the static directory.

Otherwise, you could use a solution with free variables. You'd need to create a new host config for each instance, and put 1 instance name as a free variable for each host. Put all these hosts in a host group.
Then create 5 services and replace $INSTANCE with the free variable name. Assign each service to a hostgroup.

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 4:36 am
by junkertf
Hello,

Can be the following way operative?

1) HOSTGROUP (HG) HG_INSTANCE for the hosts running same instances.

2) Standalone Service templates for each metric (8 pcs)

3) One service for each instance
- hostgroup will be connected to same HG as described above
- will use all the 8 servicetemplate created for monitoring metrics we need to monitor
- on service level we add a free variable as for example $_SERVICEINSTANCE$ what we will use in ServiceTemplate

thank you best regards,

Ferenc

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 12:57 pm
by npolovenko
@junkertf, So you want to use service templates with instance names under free variables.
When you assign a service to multiple service templates, Nagios won't just create separate services, but instead, it'll put all settings into one service(and that's not what we want). Does this answer your question?

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 2:27 pm
by junkertf
Hello npolovenko!

The big question is that, what we loose with that configuration? Actually all the service parameters can be overwritten at service level what is declared at template level. But.... What is the counterpart of these configuration?

Can you give me examples?

Thank you, best regards,

Ferenc

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 2:59 pm
by jacek
Hi junkertf, normally if you would create a service for each check for example:
1. Checking diskspace on drive C
2. Checking diskspace on drive D

then you can assign these services to hostgroups (for example "all_windows_servers_with_c_and_d_drive").
Then both services will get assigned to each host within the hostgroup.

The issue with your checks is the instancename in the check itself.
Maybe there is a way to call the hostname or alias in the check?

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 3:44 pm
by junkertf
Hello jacek!

These is a bit more complicated, or i just simply not understand what you wrote, sorry...

We will monitor 8 metrics / collecting performance counters for each instance.
Have more than 40 instances. And, has cca. 20 pcs servers running these instances.
There is no rule that which instance running on which node, but can be configured, that on node 1 3 4 6 8 running the instance ONE, node 1 2 4 8 running the instance TWO, etc....

Actually i can write all the 40 instances x 8 metrics service definition, also the HG creation is not a challange and populating the hostgroups with nodes are no problem... but also think that is there a more sophisticated way for creating that configuration with more latency, more smartness.

The method i wrote, i am almost sure will work for that pourpose for the pourpose i wrote, but @npolovenko wrote something what i will know, that it will have some counterpart also what i surely not know :), but what is that?

best regards,

Ferenc

Re: Smart way to configure same service checks for multiple

Posted: Tue Dec 04, 2018 4:37 pm
by npolovenko
@junkertf, I reread your previous post. There were a couple of things that confused me at first but I think I understand your idea now. Yes, the setup you described should work and it seems to be better then what I suggested on the Nov 28. At the end of the day, you should use whichever setup you think makes more sense and easier to manage.