changing data templates not working correctly
Moderators: Developers, Moderators
changing data templates not working correctly
I'm running 0.8 and I was happy until a few minutes ago.
I've got 7 polling hosts, and 14 data sources (2 from each host against different IP interfaces). All 14 data sources have the same Data Input Method and Template Name. In the template, the name for the data source is |host_description| - Traffic. What I would like it to say is |host_description| - Traffic - |query_ifIP|. I went into the data template and changed it there and when I come back to the Data Sources screen they're all still |host_description| - Traffic with the exception of one of them, which shows up in the new format. Any ideas why one and not the rest?
I've got 7 polling hosts, and 14 data sources (2 from each host against different IP interfaces). All 14 data sources have the same Data Input Method and Template Name. In the template, the name for the data source is |host_description| - Traffic. What I would like it to say is |host_description| - Traffic - |query_ifIP|. I went into the data template and changed it there and when I come back to the Data Sources screen they're all still |host_description| - Traffic with the exception of one of them, which shows up in the new format. Any ideas why one and not the rest?
I fixed it, sort of
I pulled up one of the data sources that didn't assume the new name and clicked save. I didn't change anything, only clicked save, and it worked. I had to do it for each of them but it was a lot easier than going in and naming them by hand. God Bless Templates.
WAIT A MINUTE!!!
Now, under Graph Management, let's say it's a graph based on host 'Router5'. I go to add a graph item, now remember there are two data sources for each host, and FYI there are two items under each data source (traffic in, traffic out).
Step back a second, if you click 'Data Sources' you'd see something like this for the name...
Router5 - Traffic - 192.168.10.1
but if I'm adding a graph item, the dropdown box for data source has it listed like this...
Router5 - Traffic - |query_ifIP| (traffic_in)
Router5 - Traffic - |query_ifIP| (traffic_in)
Router5 - Traffic - |query_ifIP| (traffic_out)
Router5 - Traffic - |query_ifIP| (traffic_out)
There are two different IP interfaces to pick which is why I started the whole renaming thing to begin with. Please Help.
Step back a second, if you click 'Data Sources' you'd see something like this for the name...
Router5 - Traffic - 192.168.10.1
but if I'm adding a graph item, the dropdown box for data source has it listed like this...
Router5 - Traffic - |query_ifIP| (traffic_in)
Router5 - Traffic - |query_ifIP| (traffic_in)
Router5 - Traffic - |query_ifIP| (traffic_out)
Router5 - Traffic - |query_ifIP| (traffic_out)
There are two different IP interfaces to pick which is why I started the whole renaming thing to begin with. Please Help.
I think you have found a couple of bugs that should be fixed now. I will put a diff for each file changed below, I will also commit the changes to CVS.
-Ian
Code: Select all
diff -r -x '*.c' -x CVS -x cactid -x config.php -x install cacti-0.8.1/graphs.php cacti-0.8.2/graphs.php
719c719
< $header_label = "[edit graph: " . db_fetch_cell("select title from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]) . "]";
---
> $header_label = "[edit graph: " . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]) . "]";
738c738
< CONCAT_WS('',case when host.description is null then 'No Host' when host.description is not null then host.description end,' - ',data_template_data.name,' (',data_template_rrd.data_source_name,')') as name,
---
> CONCAT_WS('',case when host.description is null then 'No Host' when host.description is not null then host.description end,' - ',data_template_data.name_cache,' (',data_template_rrd.data_source_name,')') as name,
diff -r -x '*.c' -x CVS -x cactid -x config.php -x install cacti-0.8.1/include/config_arrays.php cacti-0.8.2/include/config_arrays.php
365c365
< "description" => "For use with VRULE and HRULE, <em>numbers</em< only."
---
> "description" => "For use with VRULE and HRULE, <em>numbers</em> only."
diff -r -x '*.c' -x CVS -x cactid -x config.php -x install cacti-0.8.1/include/functions.php cacti-0.8.2/include/functions.php
359a360,369
> function update_data_source_title_cache_from_template($data_template_id) {
> $data = db_fetch_assoc("select local_data_id from data_template_data where data_template_id=$data_template_id and local_data_id>0");
>
> if (sizeof($data) > 0) {
> foreach ($data as $item) {
> update_data_source_title_cache($item["local_data_id"]);
> }
> }
> }
>
381a392,401
> }
>
> function update_graph_title_cache_from_template($graph_template_id) {
> $graphs = db_fetch_assoc("select local_graph_id from graph_templates_graph where graph_template_id=$graph_template_id and local_graph_id>0");
>
> if (sizeof($graphs) > 0) {
> foreach ($graphs as $item) {
> update_graph_title_cache($item["local_graph_id"]);
> }
> }
diff -r -x '*.c' -x CVS -x cactid -x config.php -x install cacti-0.8.1/include/utility_functions.php cacti-0.8.2/include/utility_functions.php
346c346
< update_data_source_title_cache(db_fetch_cell("select local_data_id from data_template_data where local_data_template_data_id=" . $data_template_data["id"]));
---
> update_data_source_title_cache_from_template($data_template_data["data_template_id"]);
540c540
< update_graph_title_cache(db_fetch_cell("select local_graph_id from graph_templates_graph where local_graph_template_graph_id=" . $graph_template_graph["id"]));
---
> update_graph_title_cache_from_template($graph_template_graph["graph_template_id"]);
name_cache
I am using 0.8.5 and am experiencing the same thing the previous user had. I am changing the name of the data source. In the data source properties, the correct name appears, but from the main data source listing, the name_cache field in the data_template_data table does not appear to be updating.
I LOVE CACTI
I LOVE CACTI
name_cache
My apologies! I spent so long trying to figure out what the deal was that I tried to manually change the data using:
UPDATE data_template_data SET name_cache='myhostname: Disk: Space: C:\' WHERE id=yougetthepicture
That wasn't working, so I tried updating it to other values, which worked, and I figured out that you can't use the backslash in the sql update command. Any information on this? I couldn't find any references in any documentation, but everything works, so long as I dont use the backslash in the name... In singe quotes, double quotes, I even tried putting a forward slash (Reg Exp escape character) before it just for grins...
UPDATE data_template_data SET name_cache='myhostname: Disk: Space: C:\' WHERE id=yougetthepicture
That wasn't working, so I tried updating it to other values, which worked, and I figured out that you can't use the backslash in the sql update command. Any information on this? I couldn't find any references in any documentation, but everything works, so long as I dont use the backslash in the name... In singe quotes, double quotes, I even tried putting a forward slash (Reg Exp escape character) before it just for grins...
If you modify your query like the following, it should work.
-Ian
Code: Select all
UPDATE data_template_data SET name_cache='myhostname: Disk: Space: C:\'' WHERE id=yougetthepicture
Who is online
Users browsing this forum: No registered users and 1 guest