Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Script to update ifAlias/ifDescr title via cron
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests
Author Message
bsdboy
Cacti User


Joined: 22 May 2006
Posts: 69

PostPosted: Thu Apr 12, 2007 2:38 pm    Post subject: Script to update ifAlias/ifDescr title via cron Reply with quote

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: 502
Location: Canada

PostPosted: Wed Apr 18, 2007 9:45 am    Post subject: Reply with quote

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

PostPosted: Wed Apr 18, 2007 9:55 am    Post subject: Reply with quote

Great, I'll give it a go!
Back to top
aleu
Cacti User


Joined: 11 Dec 2006
Posts: 108

PostPosted: Fri May 04, 2007 1:03 pm    Post subject: Reply with quote

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: 12206
Location: Muenster, Germany

PostPosted: Fri May 04, 2007 2:58 pm    Post subject: Reply with quote

What happens, if you reindex a single host using the script?
Reinhard
Back to top
pokai



Joined: 19 Jul 2007
Posts: 2

PostPosted: Thu Jul 19, 2007 5:08 am    Post subject: Reply with quote

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: 9671
Location: MI, USA

PostPosted: Thu Jul 19, 2007 7:50 am    Post subject: Reply with quote

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: 9671
Location: MI, USA

PostPosted: Thu Jul 19, 2007 8:16 am    Post subject: Reply with quote

This might work. I have not debugged. If you find any syntax errors, repost

TheWitness



poller_graphs_reapply_names.zip
 Description:

Download
 Filename:  poller_graphs_reapply_names.zip
 Filesize:  2.17 KB
 Downloaded:  226 Time(s)

Back to top
pokai



Joined: 19 Jul 2007
Posts: 2

PostPosted: Thu Jul 19, 2007 11:00 pm    Post subject: Reply with quote

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

PostPosted: Fri Jul 20, 2007 12:01 am    Post subject: DOH! Reply with quote

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: 9671
Location: MI, USA

PostPosted: Fri Jul 20, 2007 11:42 am    Post subject: Reply with quote

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

PostPosted: Fri Jul 20, 2007 3:49 pm    Post subject: Reply with quote

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

PostPosted: Mon Aug 27, 2007 7:26 am    Post subject: Reply with quote

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: 12206
Location: Muenster, Germany

PostPosted: Mon Feb 04, 2008 10:44 am    Post subject: Reply with quote

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

PostPosted: Tue May 27, 2008 3:32 am    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group