[SOLVED]Use cacti mysql to find device graphs

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

Moderators: Developers, Moderators

Post Reply
eholz1
Cacti User
Posts: 254
Joined: Mon Oct 01, 2018 10:09 am

[SOLVED]Use cacti mysql to find device graphs

Post by eholz1 »

Hello,

Is there a way to find out how many graphs a cacti device has using MySQL?
I have checked various tables, etc but without success.

I have a need to find out if a device has graphs. The issue comes from a user going
in to cacti, and changing the ip and not the device name, breaks the graphs.

The only way I have found to fix it - is to delete the graphs from the device with new ip
and recrete the graphs,

Any suggestions?

eholz1
Last edited by eholz1 on Thu May 14, 2020 2:57 pm, edited 1 time in total.
Rno
Cacti Pro User
Posts: 714
Joined: Wed Dec 07, 2011 9:19 am

Re: Use cacti mysql to find device graphs

Post by Rno »

You can check into graph_local and make a linke with host using graph-local.host_id like that
SELECT * FROM host, graph_local WHERE host.id=graph_local.host_id AND host.id = 1


the host.id = 1 is the host you would like to have the graph listing
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Rno
Cacti Pro User
Posts: 714
Joined: Wed Dec 07, 2011 9:19 am

Re: Use cacti mysql to find device graphs

Post by Rno »

Or more optimized:
SELECT * FROM host INNER JOIN graph_local WHERE host.id=graph_local.host_id AND host.id = 1
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
eholz1
Cacti User
Posts: 254
Joined: Mon Oct 01, 2018 10:09 am

Re: Use cacti mysql to find device graphs

Post by eholz1 »

Hello,

Thanks for both of these tips! I was close, but now it works with your info.
I figured it would take a couple of tables to resolve the issue.

Thanks Again,

Eholz1
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests