Script to update ifAlias/ifDescr title via cron
Moderators: Developers, Moderators
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!
Would be great to have a utility that we could add to cron and forget
thanks!
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.bsdboy wrote:Great, I'll give it a go!
Please advise, I have around 2000 nodes which need to be relabeled.
Thanks
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?
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?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
That's easy, write a script. Let's see how much energy I have this morning.....
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
This might work. I have not debugged. If you find any syntax errors, repost
TheWitness
TheWitness
- Attachments
-
- poller_graphs_reapply_names.zip
- (2.17 KiB) Downloaded 847 times
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
-
- Posts: 2
- Joined: Thu Jul 19, 2007 11:41 pm
- Location: Atlanta, GA
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
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
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
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
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
-
- Posts: 2
- Joined: Thu Jul 19, 2007 11:41 pm
- Location: Atlanta, GA
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.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.
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.claymation wrote: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.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.
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
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
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
Reinhard
-
- Posts: 24
- Joined: Tue Jun 14, 2005 7:58 am
Who is online
Users browsing this forum: No registered users and 1 guest