How to get the URL of any interface graph in cacti

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
lcano
Cacti User
Posts: 190
Joined: Thu Oct 09, 2008 5:46 pm
Location: Spain

How to get the URL of any interface graph in cacti

#1 Post by lcano » Thu May 27, 2010 5:27 am

I sometimes need to know the specific URL of any graph interface for several reasons. May be nobody else had this needed before, or probably nobody thought about it. In my case, I had some different network maps (home made network maps, not weather maps), where I had to link the traffic for each interface.

Even, this script allows you to use that URLs for external use, not associated with cacti.

I'm not sure if somebody else can be interested, but once I had it, I think it's a good idea to share with all of you. Who knows if in the future is useful.

An example:

I have one device named: menp1x1.wnet
This device has several FastEthernet interfaces.

Let's say I need to know the URL associated to the graph which shows the traffic of interface FastEthernet1/9/1 in that device. This script allows you to get it automaticaly only with the hostname and the if_name.

Format: ./get_cacti_graph.sh <hostname> <if_name>

$ ./get_cacti_graph.sh menp1x1.wnet Fa1/0/1

Host Name=menp1x1.wnet|Host ID=4|IFace Index=10001|Graph ID=64

URL = http://127.0.0.1/cacti/graph.php?local_graph_id=64


The script is a really simple query to the mysql database to get the needed info.

The script is running in Linux 2.6.
Attachments
get_cacti_graph.sh
(1.54 KiB) Downloaded 333 times

User avatar
Sirup
Cacti Moderator
Posts: 348
Joined: Tue Mar 02, 2010 9:03 am

#2 Post by Sirup » Thu May 27, 2010 6:40 am

Move from "Help: Linux/Unix Specific" to "Scripts and Templates".
[size=67]Cacti version: 0.8.7e5
OS: FreeBSD 7.2
Plugin Architecture: 2.6
Plugins: aggregate 0.74, autom8 0.33, loginmod 1.0

[url=http://docs.cacti.net/manual:087]Official Cacti Documentation[/url]
[url=http://docs.cacti.net/manual:087:4_help.2_debugging#debugging]Gandalfs Official Debugging Help[/url]
[/size]

Post Reply