|
|
| Author |
Message |
bsdboy Cacti User
Joined: 22 May 2006 Posts: 69
|
Posted: Thu Apr 12, 2007 2:38 pm Post subject: Script to update ifAlias/ifDescr title via cron |
|
|
So I've got about 3k worth of switchports that the name changes from time to time. I've asked in the general forum if this feature/script was available without manually going in and "ReApplying Suggested Names" and was directed to the feature request forum.
Would be great to have a utility that we could add to cron and forget
thanks!
|
|
| Back to top |
|
 |
Linegod Developer
Joined: 20 Feb 2003 Posts: 517 Location: Canada
|
Posted: Wed Apr 18, 2007 9:45 am Post subject: |
|
|
| poller_reindex_hosts.php and rebuild_poller_cache.php should do what you need.
|
|
| Back to top |
|
 |
bsdboy Cacti User
Joined: 22 May 2006 Posts: 69
|
Posted: Wed Apr 18, 2007 9:55 am Post subject: |
|
|
| Great, I'll give it a go!
|
|
| Back to top |
|
 |
aleu Cacti User
Joined: 11 Dec 2006 Posts: 108
|
Posted: Fri May 04, 2007 1:03 pm Post subject: |
|
|
| bsdboy wrote: | | Great, I'll give it a go! |
This does not work for me. The only way I am able to update graph titles is via Graph Management--Selecting device's traffic graphs and choosing "Reapply Suggested Names". Somebody mentioned that it would work if you click on a small green circle when creating new graphs (to reload the Data Query) but it does not work for me either.
Please advise, I have around 2000 nodes which need to be relabeled.
Thanks
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Fri May 04, 2007 2:58 pm Post subject: |
|
|
What happens, if you reindex a single host using the script?
Reinhard
|
|
| Back to top |
|
 |
pokai
Joined: 19 Jul 2007 Posts: 2
|
Posted: Thu Jul 19, 2007 5:08 am Post subject: |
|
|
I have problem too.
I can use poller_reindex_hosts.php and rebuild_poller_cache.php to update ifAlias.
But if I remove Description(ifAlias) on switch and update it. I suppose the title will become such as "lab-sw - Traffic - Fa0/6" , but it become "lab-sw - Traffic - Fa0/6 -|query_ifAlias|".
If I click "Reapply Suggested Names" manually, this problem will be fixed.
But how can I fix this problem not by hand?
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9697 Location: MI, USA
|
Posted: Thu Jul 19, 2007 7:50 am Post subject: |
|
|
That's easy, write a script. Let's see how much energy I have this morning.....
TheWitness
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9697 Location: MI, USA
|
|
| Back to top |
|
 |
pokai
Joined: 19 Jul 2007 Posts: 2
|
Posted: Thu Jul 19, 2007 11:00 pm Post subject: |
|
|
It works with little bug.
The error message as below.
Notice: Undefined variable: filter in /usr/share/cacti/site/poller_graphs_reapply_names.php on line 84
|
|
| Back to top |
|
 |
claymation
Joined: 19 Jul 2007 Posts: 2 Location: Atlanta, GA
|
Posted: Fri Jul 20, 2007 12:01 am Post subject: DOH! |
|
|
Running the script seems to have *removed* all of the ifAlias names from my graph titles!
I had just edited the graph template title to include |query_ifAlias| and was faced with the prospect of manually reapplying suggested names to thousands of interfaces, so I figured I'd give this script a go. But not only has the script removed the ifAlias names from the few interfaces that had them, now manually reapplying suggested names on a handful of interfaces does not add the ifAlias port description.
Could you describe what api_reapply_suggested_graph_title() actually does, and why the graph titles aren't just generated dynamically every time the graph is rendered?
Thanks!
Clay
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9697 Location: MI, USA
|
Posted: Fri Jul 20, 2007 11:42 am Post subject: |
|
|
It takes the "most" appropriate suggested name from the data query definition and renames the graphs. It does "EXACTLY" what the user interface does. So, you must have done something else.
TheWitness
|
|
| Back to top |
|
 |
claymation
Joined: 19 Jul 2007 Posts: 2 Location: Atlanta, GA
|
Posted: Fri Jul 20, 2007 3:49 pm Post subject: |
|
|
| TheWitness wrote: | It takes the "most" appropriate suggested name from the data query definition and renames the graphs. It does "EXACTLY" what the user interface does. So, you must have done something else.
|
Correction: Whether I use the web interface or your script, the ifAlias values are removed. Editing and saving the graph template causes them to reappear, along with bogus |query_ifAlias| text for switch interfaces without descriptions.
I see that your script and the web interface both call api_reapply_suggested_graph_title(), so I'm curious if that function might not be correct. I'll dig through the source to see what I can find.
In any case, I'm curious why the graph titles aren't always dynamically generated. Why does this function exist? Why are graph titles "suggested" and not "defined"?
Thanks,
Clay
|
|
| Back to top |
|
 |
uno
Joined: 27 Aug 2007 Posts: 8
|
Posted: Mon Aug 27, 2007 7:26 am Post subject: |
|
|
| claymation wrote: | | TheWitness wrote: | It takes the "most" appropriate suggested name from the data query definition and renames the graphs. It does "EXACTLY" what the user interface does. So, you must have done something else.
|
Correction: Whether I use the web interface or your script, the ifAlias values are removed. Editing and saving the graph template causes them to reappear, along with bogus |query_ifAlias| text for switch interfaces without descriptions.
I see that your script and the web interface both call api_reapply_suggested_graph_title(), so I'm curious if that function might not be correct. I'll dig through the source to see what I can find.
In any case, I'm curious why the graph titles aren't always dynamically generated. Why does this function exist? Why are graph titles "suggested" and not "defined"?
Thanks,
Clay |
I get exactly the same behaviour as previous user. When running poller_graphs_reapply_names.php, all ifAliases are removed. When I edit and save the graph template, they reappear, unchanged from before I ran the script.
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Mon Feb 04, 2008 10:44 am Post subject: |
|
|
Please verify using current 087a release. Sould be fine, now. Else, please file a bug as given by http://www.cacti.net/bugs.php
Reinhard
|
|
| Back to top |
|
 |
thierry.chich
Joined: 14 Jun 2005 Posts: 24
|
Posted: Tue May 27, 2008 3:32 am Post subject: |
|
|
I have small problems to try the solutions given here:
find / -name poller_graphs_reapply_names.php
or find / -name poller_reindex_hosts.php
is giving nothing to me.
I use Version 0.8.7b of cacti coming form the lenny package.
Is there a new soltion to this problem ?
|
|
| Back to top |
|
 |
|