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
Request on the Cacti SQL database
Moderators: Developers, Moderators
You do realize the graph data is actually stored in the rrd files, right?
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Yes, I think he knows that.BSOD2600 wrote:You do realize the graph data is actually stored in the rrd files, right?
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]
[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]
query
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
+----------------+---------+-----------+
| 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
Who is online
Users browsing this forum: No registered users and 8 guests