how-to bulk change host template?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
MrRat
Cacti User
Posts: 135
Joined: Thu Jan 07, 2010 10:33 am

how-to bulk change host template?

Post by MrRat »

How can I change the host template on 100+ items in bulk? It doesnt seem the option is available from console/devices/actions menu. I have also tried using the cli script host_update_template.php but that doesnt change the devices host template.

Code: Select all

cli # php host_update_template.php --host-id=938 --host-template=38
         cli # mysql cacti
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2979477
Server version: 5.1.62-log Gentoo Linux mysql-5.1.62-r1

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT host_template_id FROM host WHERE id=938;
+------------------+
| host_template_id |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: how-to bulk change host template?

Post by gandalf »

When you've changed a host template (e.g. added new graphs to the host template), this cli will apply this change for all hosts related to that host template.

In case you want to change an existing host to use a DIFFERENT host template from now on, you may try to use the add_device.php using the new host template id. Nout sure, but worth a try
R.
MrRat
Cacti User
Posts: 135
Joined: Thu Jan 07, 2010 10:33 am

Re: how-to bulk change host template?

Post by MrRat »

That doesnt seem to work, Ive opened a feature request.
http://bugs.cacti.net/view.php?id=2239
User avatar
Xe03
Posts: 14
Joined: Wed May 09, 2012 10:24 am
Location: Scott Air Force Base

Re: how-to bulk change host template?

Post by Xe03 »

gandalf wrote:When you've changed a host template (e.g. added new graphs to the host template), this cli will apply this change for all hosts related to that host template.

In case you want to change an existing host to use a DIFFERENT host template from now on, you may try to use the add_device.php using the new host template id. Nout sure, but worth a try
R.

When I try to use this .. I get a out of cache error. Is there a limit of how many devices it will edit, using the same template? Or possibly did I run out of "max_connections" in the my.cnf ? --Mysql
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: how-to bulk change host template?

Post by gandalf »

Please provide exact error message
R.
User avatar
Xe03
Posts: 14
Joined: Wed May 09, 2012 10:24 am
Location: Scott Air Force Base

Re: how-to bulk change host template?

Post by Xe03 »

gandalf wrote:Please provide exact error message
R.

php host_update_template.php --host-id=all --host-template=9

"Allowed memory size of 33554432 bytes exhausted (tried to allocate 10 bytes)"

Centos 4.7 8GB RAM 4x2.4GZ 64bit "CactiEZ" -latest version

Upgraded to Cacti - 0.8.8a
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: how-to bulk change host template?

Post by gandalf »

What about increasing PHP memory limit, e.g. to 128 M, as recommended?
R.
User avatar
Xe03
Posts: 14
Joined: Wed May 09, 2012 10:24 am
Location: Scott Air Force Base

Re: how-to bulk change host template?

Post by Xe03 »

gandalf wrote:What about increasing PHP memory limit, e.g. to 128 M, as recommended?
R.

That worked. I changed it to 128MB
"
Note: Updating Data Queries. There were '1' Found
Note: Updating Host '10.1.1.7'
etc
etc
"

Thank you Sir!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest