Page 1 of 1
MySQL Query to update Service Check Arguments
Posted: Thu Apr 20, 2017 10:26 am
by Sampath.Basireddy
I am looking for a MySQL Query to update Arguments or part of Argument for Services in Nagios XI.
Can anyone please help me with the query and respective tables and any additional details which can help me in modifying service arguments in bulk.
Thank You.
Re: MySQL Query to update Service Check Arguments
Posted: Thu Apr 20, 2017 2:53 pm
by cdienger
services are defined in the nagios database in the nagios_services table. I would not recommend making any changes directly to the database though. What is it that you're trying to achieve exactly? If you need to change an argument used by a service check, you can do so from the web UI under Configure > CCM > Tools > Bulk Modifications Tool > Change Command and Arguments.
Re: MySQL Query to update Service Check Arguments
Posted: Mon Apr 24, 2017 10:05 am
by Sampath.Basireddy
Thank you for the response cdienger.
All am trying to do is update password in DB service checks where we manually mentioned password in each of checks. I know its not a good practice as the password will be visible and a time consumer when it comes to updating the password.
For the existing service checks which were created quiet sometime back, all the required details along with password are mentioned in $ARG1$ which makes it difficult to go via your suggestion. That is the reason we looking to see if there any MySql query which can help.
Thank You.
Re: MySQL Query to update Service Check Arguments
Posted: Mon Apr 24, 2017 11:39 am
by cdienger
The password isn't stored in a unique column in the database, adding a couple steps to the process of just modifying the password. In this case it would be in the 'check_command_args' column of the nagios_services table(along with the other arguments). I suppose you could extract the table with:
mysqldump -uroot -pnagiosxi nagios nagios_services > dump.sql
Modify the arguments accordingly, and then import the table with:
mysql -uroot -pnagiosxi nagios < dump.sql
****NOTE: I haven't tested this thoroughly. If you decide to do this, run and test this on a non production system first.