Anyone that's better at mysql than me want to help me out
I have a list of 233 services that have an IP in their $ARG8$. Can someone show me the proper sql to use to update that field with a different IP. Basically update $ARG8$ with 10.10.10.2 where $ARG8$=10.10.10.1
Thanks!
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
You might need to alter the script a bit to mess with the table names, but I wrote this a month ago to change passwords stored in ARGs.
Edit: As JR mentioned, not strictly supported. But I know that won't stop you :) Just make sure as always to take backups. My script comes with very little safety netting.
That said the arguments aren't stored explicitly in the service's check_command defintion. They are stored in the same fashion they would be in the .cfg file. If you can be certain that a search and replace would work for you without searching and replacing the wrong thing something as simple as this would work:
update tbl_service set check_command = replace(check_command,'10.10.10.1','10.10.10.2');
If that string is going to be elsewhere in other check_commands on your system (or even elsewhere in the same check_command) you'll have to be a bit more elaborate with a where clause. That where clause depends on what information you have available to narrow the scope.
So are you guys saying this isn't supported? I just want to be sure
I can be 100% sure it won't exist anywhere else, so JR's line will work great! Lock this sucker up!
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github