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    


Sql Queries Script

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
tetu_024



Joined: 20 Jun 2007
Posts: 31

PostPosted: Wed Jan 23, 2008 3:24 am    Post subject: Sql Queries Script Reply with quote

Hi,

I have a problem with the sqlqueries script. When i want to create a graph with Mysql 5 count queries the field host name isn't being displayed. I'm attaching screen shots.

Et



Mysql 5 count queries.JPG
 Description:
 Filesize:  61.21 KB
 Viewed:  2061 Time(s)

Mysql 5 count queries.JPG



data input method.JPG
 Description:
 Filesize:  69.38 KB
 Viewed:  2061 Time(s)

data input method.JPG


Back to top
web_rene



Joined: 20 Apr 2007
Posts: 21

PostPosted: Mon Feb 18, 2008 10:00 am    Post subject: Hi Reply with quote

Hi and sorry for the Late reply.

The Hostname is taken from the Host you create the Graph for.

Means, if you create a graph for

db1.yourdomain.com he will use this hostname in the mysql-connect string as targethost.
Back to top
tetu_024



Joined: 20 Jun 2007
Posts: 31

PostPosted: Mon Feb 18, 2008 1:13 pm    Post subject: Reply with quote

Thanks for the reply. is the query good for postgres sql server?
Back to top
web_rene



Joined: 20 Apr 2007
Posts: 21

PostPosted: Tue Feb 19, 2008 7:21 am    Post subject: Reply with quote

Up to know, it only supports mysql.

But if you have some experience with scripting in php with databaseconnects to pg, I think it should be no Problem.
Back to top
dass_ba



Joined: 31 Mar 2008
Posts: 2

PostPosted: Mon Mar 31, 2008 7:12 pm    Post subject: Sql Queries Script Reply with quote

can you post this SQLquery script and any xml template if one available ?

Thanks
Back to top
web_rene



Joined: 20 Apr 2007
Posts: 21

PostPosted: Tue Apr 01, 2008 2:39 am    Post subject: Reply with quote

There is another Post which holds the files you are looking for:

http://forums.cacti.net/about20757.html&highlight=SQLQueries
Back to top
dass_ba



Joined: 31 Mar 2008
Posts: 2

PostPosted: Tue Apr 01, 2008 1:24 pm    Post subject: Reply with quote

Thank you web_ren - I think this sqlquery is very close to what I'm looking for. I need to make a template and produce the graph for sql 2005 transaction query - hope this one will serve the purpose.

Thanks
Back to top
ceyounger



Joined: 10 Feb 2006
Posts: 35
Location: San Jose, CA USA

PostPosted: Tue Apr 01, 2008 4:22 pm    Post subject: Reply with quote

dass_ba wrote:
Thank you web_ren - I think this sqlquery is very close to what I'm looking for. I need to make a template and produce the graph for sql 2005 transaction query - hope this one will serve the purpose.

Thanks


Did you have any luck with querying from a SQL 2005 server? PHP just hangs when I attempt to run this from CLI.
Back to top
web_rene



Joined: 20 Apr 2007
Posts: 21

PostPosted: Wed Apr 02, 2008 4:39 am    Post subject: Reply with quote

Actually the PHP Script uses MySQL Connect, so I guess it won't work with SQL2005 Server...
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9736
Location: MI, USA

PostPosted: Wed Apr 02, 2008 4:51 am    Post subject: Reply with quote

The correct approach here is to use a Script Server script that contains the SQL and the connect logic. That script would use PHP's internal database functions to execute your queries inside of your Script Server scripts.

PHP Supports connectivity to Postgress and Microsoft SQL Server without issue. By default, Cacti's API does not. I would suggest that the aformentioned template was designed specifically for MySQL.

From my perspective this is not the best approach, although a creative one, and something to think about for future enhancements to Cacti.

There are several examples of Script Server scripts that have been written to obtain information from a database. If you need help, I would goto the PHP.Net website and look at the various database connectors for examples.

Regards,

TheWitness
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group