--- cacti.old/host.php 2012-04-23 04:00:14.000000000 +0200 +++ cacti/host.php 2012-08-28 18:29:25.000000000 +0200 @@ -41,7 +41,8 @@ 3 => "Disable", 4 => "Change SNMP Options", 5 => "Clear Statistics", - 6 => "Change Availability Options" + 6 => "Change Availability Options", + 7 => "Reapply Host Template" ); $device_actions = api_plugin_hook_function('device_action_array', $device_actions); @@ -249,6 +250,32 @@ push_out_host($selected_items[$i]); } + }elseif ($_POST["drp_action"] == "7") { /* Reapply Host Template */ + for ($i=0; $i 0) { + foreach ($snmp_queries as $snmp_query) { + db_execute("replace into host_snmp_query (host_id,snmp_query_id,reindex_method) values ($selected_items[$i]," . $snmp_query["snmp_query_id"] . "," . DATA_QUERY_AUTOINDEX_BACKWARDS_UPTIME . ")"); + + /* recache snmp data */ + run_data_query($selected_items[$i], $snmp_query["snmp_query_id"]); + } + } + + $graph_templates = db_fetch_assoc("select graph_template_id from host_template_graph where host_template_id=$host_template_id"); + + if (sizeof($graph_templates) > 0) { + foreach ($graph_templates as $graph_template) { + db_execute("replace into host_graph (host_id,graph_template_id) values ($selected_items[$i]," . $graph_template["graph_template_id"] . ")"); + } + } + } }elseif ($_POST["drp_action"] == "1") { /* delete */ if (!isset($_POST["delete_type"])) { $_POST["delete_type"] = 2; } @@ -440,6 +467,14 @@

"; + $save_html = " "; + }elseif ($_POST["drp_action"] == "7") { /* Reapply Host Template */ + print " + +

To reapply Host Template for the following devices, press the \"yes\" button below.

+

+ + "; $save_html = " "; }elseif ($_POST["drp_action"] == "1") { /* delete */ print "