Page 1 of 1
Add argument using bulk modification tool
Posted: Tue Nov 29, 2016 9:36 am
by jsharris
Is it possible to add an argument to a service check using the bulk modification tool without changing any of the current arguments? We have a large number of checks using the check_esx3 command and would like to add the timeout option to $ARG3. However, $ARG1 and $ARG2 do not have the same value across all of the checks. When I attempt to use the tool to add $ARG3 but leave 1 and 2 blank it adds 3 but erases 1 and 2.
Re: Add argument using bulk modification tool
Posted: Tue Nov 29, 2016 3:28 pm
by avandemore
I don't know of a way to do this directly through the bulk modification tool. You can create separate services for the command with different args, and apply to hosts via templates as appropriate. I can submit a Feature Request for the functionality in the Bulk Modification Tool, but the template method is the intended use.
Re: Add argument using bulk modification tool
Posted: Wed Nov 30, 2016 8:13 am
by jsharris
I am not sure that templates would work in this instance. We are checking the status of our VM hosts with each check having 2 arguments. So say we have 5 hosts and each of those has 5 checks where $ARG1 for each host is the same but $ARG2 is different. We couldn't create a template for each host as $ARG2 and we couldn't create a template for the specific check (CPU, VMFS, etc.) because for each $ARG1 would be different.
Or should I create a template which only specifies $ARG3 and apply that to each of the existing service checks? We have not done much with templates, unfortunately.
Re: Add argument using bulk modification tool
Posted: Wed Nov 30, 2016 10:13 am
by avandemore
Perhaps you can share a couple of specific examples so I can better understand. Macros and user macros can handle at least part of what you are referring too.
https://assets.nagios.com/downloads/nag ... acros.html
https://assets.nagios.com/downloads/nag ... olist.html
Also here is a soon to be published link:
https://assets.nagios.com/downloads/nag ... ponent.pdf
Re: Add argument using bulk modification tool
Posted: Wed Nov 30, 2016 11:22 am
by jsharris
We use the check_esx3 plugin to monitor our VM hosts with each service currently configured to have two arguments. $ARG1 is the path to the credentials used to connect to the host (this is different for each host but the same for each check per host). $ARG2 is the resource being checked (we have seven resources being checked on each host: CPU, VMFS, IO, MEM, NET, SERVICE, and RUNTIME). So we would have (I hope this is what you are asking for):
Host: Host1
$ARG1: path to credentials 1
$ARG2: CPU
Host: Host1
$ARG1: path to credentials 1
$ARG2: MEM
Host: Host1
$ARG1: path to credentials 1
$ARG2: IO
etc., and:
Host: Host2
$ARG1: path to credentials 2
$ARG2: CPU
Host: Host2
$ARG1: path to credentials 2
$ARG2: MEM
Host: Host2
$ARG1: path to credentials 2
$ARG2: IO
etc.
All told we have 35 hosts with 7 services each for a total of 245 service checks. We can add the argument manually to each of them but if there is a more efficient way I'd prefer that.
Currently the only template assigned to these services is the xiwizard_generic_service template. I am not familiar with how templates are applied, particularly as regards multiple templates (do they stack? what is the order they are applied in? and so on). If I created a new template which configured only $ARG3 and applied it to the above checks, would it leave everything configured at the service itself alone and just add the value in the $ARG3 field?
Re: Add argument using bulk modification tool
Posted: Wed Nov 30, 2016 3:09 pm
by tgriep
Yes, the templates do stack so creating a template and adding the settings in the $ARG3$ field should work for you.
If all you need to do is to add the timeout setting for that command, just edit the command and add it there. That is the simplest way to do it.
Go to the Core Config Manager > Commands menu and edit the following command
Change the command line from
Code: Select all
$USER1$/check_esx3.pl -H "$HOSTADDRESS$" -f "$ARG1$" -l "$ARG2$" $ARG3$
to
Code: Select all
$USER1$/check_esx3.pl -H "$HOSTADDRESS$" -t 59 -f "$ARG1$" -l "$ARG2$" $ARG3$
Save it and apply the config. That will change the timeout to 59 seconds for all of the checks that use that command.
Re: Add argument using bulk modification tool
Posted: Thu Dec 01, 2016 6:49 am
by jsharris
I hadn't even considered just rolling the argument directly into the command like that. That is perfect. Thanks!
With regard to the stacking of templates, how is priority decided? If two or more templates have different values for the same item which is used?
Re: Add argument using bulk modification tool
Posted: Thu Dec 01, 2016 11:46 am
by avandemore
This is the most definitive answer to that question aside for real time testing:
https://assets.nagios.com/downloads/nag ... tance.html
Re: Add argument using bulk modification tool
Posted: Thu Dec 01, 2016 12:09 pm
by jsharris
Thank you! I'll take a look through that and I think we can call this one solved.
Re: Add argument using bulk modification tool
Posted: Thu Dec 01, 2016 1:37 pm
by avandemore
Great, if you have further issues or questions please open a new thread.