Bulk Change "config name"
Bulk Change "config name"
I want to rename a bunch of services that are currently named "_multiple_hosts" from when I imported them, Bulk renaming tool doesn't cover the config name change, only the service name. Is there a way to do this in bulk, like a mysql update command, will that hurt anything? If that will work, anyone want to write the command out for me so I don't have to spend an hour figuring out the proper context 
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
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
Re: Bulk Change "config name"
When you rename a host via the Bulk Renaming Tools, it would rename the config file name for the services as well. All configs will be renamed in "/usr/local/nagios/etc/hosts" and "/usr/local/nagios/etc/services".
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Bulk Change "config name"
This isn't for any host. This is the "config name" field on a bunch of services that have hostgroups assigned to them. I want to change "_multiple_hosts" to something that describes the services better.
You do not have the required permissions to view the files attached to this post.
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
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
Re: Bulk Change "config name"
Well, the table tbl_service in the nagiosql database has a field called "config_name" which stores the flat file name. You would probably need to match the config name to the host name, or pick an arbitrary name as long as it is consistent. Observe:
Grab id, flat file name, and service description
Layout of table matching services to hosts
Grab all service<->host associations (service is Master, host is Slave)
Grab all host ids and names
Now you can see which services match to which hosts, and start coming up with names. There is a better way to do this with joins but that is a bit more tricky and I'd like to save those big guns for if you can't script this out.
Grab id, flat file name, and service description
Code: Select all
mysql> select id,config_name,service_description from tbl_service;
+----+---------------+-------------------------+
| id | config_name | service_description |
+----+---------------+-------------------------+
| 1 | localhost | PING |
| 2 | localhost | Root Partition |
| 3 | localhost | Current Users |
| 4 | localhost | Total Processes |
| 5 | localhost | Current Load |
| 6 | localhost | Swap Usage |
| 7 | localhost | SSH |
| 8 | localhost | HTTP |
| 10 | localhost | Always Fails |
| 14 | 192.168.4.163 | Ping |
| 15 | 192.168.4.163 | Weblogic Heap |
| 16 | 192.168.4.163 | Weblogic Thread Pool |
| 17 | 192.168.4.163 | Weblogic Transactions |
| 18 | 192.168.4.163 | Weblogic Connections |
| 19 | 192.168.4.163 | Weblogic Queue |
| 71 | Arduino | Security Alert - Window |
+----+---------------+-------------------------+
16 rows in set (0.00 sec)
Code: Select all
mysql> describe tbl_lnkServiceToHost;
+----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+-------+
| idMaster | int(11) | NO | PRI | NULL | |
| idSlave | int(11) | NO | PRI | NULL | |
+----------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Code: Select all
mysql> select * from tbl_lnkServiceToHost;
+----------+---------+
| idMaster | idSlave |
+----------+---------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
| 5 | 1 |
| 6 | 1 |
| 7 | 1 |
| 8 | 1 |
| 10 | 1 |
| 14 | 4 |
| 15 | 4 |
| 16 | 4 |
| 17 | 4 |
| 18 | 4 |
| 19 | 4 |
| 71 | 6 |
+----------+---------+
16 rows in set (0.00 sec)
Code: Select all
mysql> select id,host_name from tbl_host;
+----+-----------+
| id | host_name |
+----+-----------+
| 1 | localhost |
| 4 | WebLogic |
| 6 | Arduino |
+----+-----------+
3 rows in set (0.00 sec)
Former Nagios employee