Request on the Cacti SQL database

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
nicolargo
Posts: 6
Joined: Tue Oct 10, 2006 3:37 am

Request on the Cacti SQL database

Post by nicolargo »

I want to write an external script (in PHP) in order to export the graph of an existing Cacti's host. This script only knows the IP address of the host.

Do you know the SQL request to make on the CACTI SQL database in order to get the local_graph_id values from the IP address of the host ?

Thanks in advance

Nicolas
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

You do realize the graph data is actually stored in the rrd files, right?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

BSOD2600 wrote:You do realize the graph data is actually stored in the rrd files, right?
Yes, I think he knows that. :)

So, to clarify, you want to have a query that returns the graphs id (local_graph_id) of a particular host? Right?

That is actually a simple query... Although, I want clarification before I sit down and write it.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
nicolargo
Posts: 6
Joined: Tue Oct 10, 2006 3:37 am

Post by nicolargo »

@rony: yes, it is exactly what i need.

Thanks in davance.

Nicolas
smilerpt
Posts: 30
Joined: Tue Apr 24, 2007 8:00 pm
Location: Portugal, Lisbon

query

Post by smilerpt »

mysql> select graph_local.id as local_graph_id, host.id as host_id, host.hostname as hostname from (graph_local, host) where graph_local.host_id=host.id and host.hostname='127.0.0.1';
+----------------+---------+-----------+
| local_graph_id | host_id | hostname |
+----------------+---------+-----------+
| 1 | 1 | 127.0.0.1 |
| 2 | 1 | 127.0.0.1 |
| 3 | 1 | 127.0.0.1 |
| 4 | 1 | 127.0.0.1 |
| 172 | 1 | 127.0.0.1 |
+----------------+---------+-----------+
5 rows in set (0.00 sec)

Hope I got it right :-)

rs
nicolargo
Posts: 6
Joined: Tue Oct 10, 2006 3:37 am

Post by nicolargo »

@smilerpt: thank you very much !
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests