Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


finding out local_graph_id from local_data_id???

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: General
Author Message
pgb205



Joined: 10 Nov 2008
Posts: 17

PostPosted: Fri Nov 14, 2008 4:03 pm    Post subject: finding out local_graph_id from local_data_id??? Reply with quote

How would I find out what the local_graph_id is for a certain data source.
So basically how would i find out what the graph_templates_graph.local_graph_id is from knowing the local_data_id??
Can't figure out how to join the tables to retrieve the data.

thanks
Back to top
browniebraun
Cacti User


Joined: 13 Jun 2006
Posts: 341
Location: Cologne, Germany

PostPosted: Fri Nov 14, 2008 4:33 pm    Post subject: Reply with quote

Code:
    $local_data_id = 12345;

    $sql = "SELECT DISTINCT c.local_graph_id
             FROM data_template_data AS a
             INNER JOIN data_template_rrd AS b
             ON b.local_data_id = a.local_data_id
             INNER JOIN graph_templates_item AS c
             ON c.task_item_id = b.id
             WHERE a.local_data_id = $local_data_id";

    $local_graph_id = db_fetch_cell($sql);


That's the way I do it.

Best regards
-Andreas-
Back to top
pgb205



Joined: 10 Nov 2008
Posts: 17

PostPosted: Mon Nov 17, 2008 9:21 am    Post subject: Reply with quote

well, I don't really understand how your query works but it works for me. Thanks a bunch.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: General All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group