MySQL Query to update Service Check Arguments

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

MySQL Query to update Service Check Arguments

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: MySQL Query to update Service Check Arguments

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: MySQL Query to update Service Check Arguments

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: MySQL Query to update Service Check Arguments

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked