Page 1 of 1

Updating thresholds from command line/script

Posted: Tue Aug 17, 2021 8:45 am
by nms
Hi

We're looking at trying to allow some of the team update thresholds, without giving access to all the CCM menus.

I've checked a lot of pages around API usage (like here https://x.x.x.x/nagiosxi/help/api-confi ... it-service ), Nagios Exchange and various other sites giving things like command lines which use sql to check thresholds, but I can't seem to find anything that I could adapt to actually update them, given that for some checks we have a lot more arguments than others and we just want the thresholds updated nothing else.

Could anyone point me in the direction of something that could help please?

Thanks!

Re: Updating thresholds from command line/script

Posted: Tue Aug 17, 2021 3:03 pm
by gsmith
Hi,

Unfortunately there is no easy way to do this, since the thresholds vary so much.

One way would to be have a script for each service that you want to allow threshold modification to,
and the steps would be something like:

1. api call to get config/command
2. parse the command_line returned from the api call and show existing warning and critical settings
3. prompt user for new warning and critical settings
4. validate the new thresholds (not just syntactically but also logically)
5. create new command_line based on new thresholds
6. api call to put config/command to update the command and apply the config

You would also want some logging built-in to keep track of changes and errors that occur.


The above method provides some safety since all changes are going through the api.

I would NOT try to manipulate settings via the database.

Thanks