Looking for a way to search a device in URL string

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Looking for a way to search a device in URL string

Post by Netcooler »

<a href="https://servername/cacti/graph.php?acti ... raph_id=69">

Is there a way to do something simlar to the above code but use a search based on a hosts name and or IP as entered in the "Hostname" field of a device in cacti??

I ask this as I would like to pass this through a netcool right click tool based on the IP address and have it pull up the graph tree view in a new window. I can do the netcool part to pass everything I need via URL but wanted to know if I would search cacti like that via the hostname field.
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Not directly.

What I would do is look at the preview page instead - https://servername/cacti/graph.php?acti ... &host_id=1

That page uses the host id. It wouldn't be that difficult to create a plugin or just hack the code to allow for hostname instead of host_id
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
TheHack
Posts: 28
Joined: Fri Apr 28, 2006 4:02 am

Post by TheHack »

It is already build into Cacti:
Try:

<a href="https://servername/cacti/graph_view.php ... lter=<your host name or search string comes here>>


There is one issue with this approach: If there are multiple pages of graphs, you may not be able to select the next page for whatever reason.
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Post by Netcooler »

AHH OK thanks Hack.. will give that a try ans see if that is what I am looking for
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Post by Netcooler »

So that will only filter on what is present in a "graph" and not a specific hostname as specified in the device properties it would appear.

I'd be OK if every one of my graphs has the hostname in it as opposed to description.... but I need the hostname.. drats! Linegod - I will be looking into your suggestion as well but the I do not see in the graph.php where it even calls out hsot_id...
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Look at graph_view.php, not graphs.php

You pretty much have to pass a new variable (hostname) to graph_view.php, then create a function that sets host_id based on hostname.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Post by Netcooler »

OK - will give it a try - Can always backup the existing file right?? LOL!

Not 100% sure but I will see if I can look at some examples in the file and give it a shot. i appreciate the direction.

If you have any sugesstions on how or what to do please pass them aloing but I will start hacking away!
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests