SQL Queries Result Graphs (Plugin + Templates + Script)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

web_rene
Posts: 21
Joined: Fri Apr 20, 2007 5:31 am
Contact:

SQL Queries Result Graphs (Plugin + Templates + Script)

Post by web_rene »

Hi there,

I'm quite new to Cacti and the Plugin Architecture and have just created my first complete Plugin which I wanted to share with you.

The Idea was, to Manage a set of files with a number of Queries from within Cacti to use them as a Datasource combined with a fitting Script and some fitting templates.

Before Setting up a new Graph, you can create a Queryfile with several Database Queries. In my Case I have some count(*) selects, to get the number of entries in specific tables.
When Setting up the Graph you can choose, which Queryfile to use, and how the Single Fields should be Called in the Graphs' description.

Please be aware that this is my first Plugin and that there is no warranty at all, but please also don't hesitate to post your comments.


-- Open Points --
The Update Plugin from Cactiusers.org always shows that there is an update available... don't have a clue why...
Attachments
Example of creating a Graph out of the Query File.
Example of creating a Graph out of the Query File.
cacti_sql2.jpg (92.83 KiB) Viewed 27215 times
Screenshot of sqlqueries plugin
Screenshot of sqlqueries plugin
cacti_sql.jpg (235.12 KiB) Viewed 28170 times
sqlqueries_v_02.tar.gz
Version 0.2 of sqlqueries Plugin
(9.86 KiB) Downloaded 1549 times
Last edited by web_rene on Fri Nov 09, 2007 5:28 am, edited 4 times in total.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I strongly suggest that you look at things like Reinhard's poller statistics Template for accessing arbitrary data in SQL. I think it fit's better into that model.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

TheWitness wrote:I strongly suggest that you look at things like Reinhard's poller statistics Template for accessing arbitrary data in SQL.
Find it at http://forums.cacti.net/viewtopic.php?t ... statistics
Reinhard
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have rethought my position. However, I want this to be core. Are you prepared to take development direction and are you prepared to sign off on GPL?

Regards,

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
web_rene
Posts: 21
Joined: Fri Apr 20, 2007 5:31 am
Contact:

Post by web_rene »

Thanks for your offer.
Since I received no reply on my PM I guess you have rethought your position again!?

Anyways, I hope that there are some people out there who can make a use of this plugin.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Sorry, I am so busy, I have lost track of things. Let me collect my thoughts. What is your locality (time zone)?

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
web_rene
Posts: 21
Joined: Fri Apr 20, 2007 5:31 am
Contact:

Post by web_rene »

8)
My Timezone is GMT+1.

Greetings from Germany.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

So, how's your noonish tomorrow sound. That would be about 7:00am my time? I would like to conduct a meeting using preferably Skype (I am TheWitness there too), or I can call Germany via Vonage pretty cheap.

PM me with your availability and contact information.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
web_rene
Posts: 21
Joined: Fri Apr 20, 2007 5:31 am
Contact:

Update

Post by web_rene »

Updated Versio
n
Now also compatible with Cacti 0.8.7

Could perhaps someone tell be how the Update-Plugin works, since it keeps telling me that there is an update available for my plugin!? :-(
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have updated the Rosetta with your information thanks!!

http://forums.cacti.net/viewtopic.php?t=14985

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
billporte
Posts: 2
Joined: Thu Nov 22, 2007 12:29 pm

Post by billporte »

Hello, I tried your plugin, but I've got errors:
Nothing come on graph and cacti log give me

11/22/2007 06:15:06 PM - CMDPHP: Poller[0] Host[11] DS[384] CMD: c:/php/php.exe -q C:/Inetpub/wwwroot/cacti/scripts/mysql_query.php localhost 3306 'user' 'pw' 'example.sql', output: U
11/22/2007 06:15:06 PM - CMDPHP: Poller[0] Host[11] DS[384] WARNING: Result from CMD not valid. Partial Result: File does not exist

The example.sql is under C:\Inetpub\wwwroot\cacti\plugins\sqlqueries\queries

Everything seems goog, I tried to passed on cactid, but it's the same

Thanks for help
billporte
Posts: 2
Joined: Thu Nov 22, 2007 12:29 pm

Post by billporte »

It work now, but I've maid some modifications :
in the 4 template.xml, I remove the ' character which were on
'<username>' '<password>' '<query_file>'
<username> <password> <query_file>

and In the mysql_query.php I had to hardcode the path for my queries
$cacti_queries_path = "C:/Inetpub/wwwroot/cacti/plugins/sqlqueries/queries/";
aboyz
Cacti User
Posts: 56
Joined: Fri Jan 18, 2008 7:09 pm

I am not gettin SQL Query on Console

Post by aboyz »

Hi,

On top left under console. I don't see SQL Query? Know why its not showing up?
aboyz
Cacti User
Posts: 56
Joined: Fri Jan 18, 2008 7:09 pm

Help.!

Post by aboyz »

Anyone know what I am doing wrong? I tried to install the Plugin Architecture
Stable
: 1.4

I added a plugins into that folder but its now showing up in my CONSOLE. Anyone know what I'm doing wrong? Here is the step I did.

Clean installation of the Cacti 0.8.7a , and the new Plugin Architechture 1.4 which have the 0.8.7a, So basically I just drag plugin architechture into the cacti main folder and overwrite it. The plugin architureture say to edit the includes/config.php but it doesn't have the new one. It is cacit old config.php . Anyone know if I'm missing any step? Please advise.

Is there some stuff I'm missing?
Thanks!!
aboyz
Cacti User
Posts: 56
Joined: Fri Jan 18, 2008 7:09 pm

got it working

Post by aboyz »

Ok,

I got the plugins to show up, I created a sql queries, and graph it, but the graph is not showing up.

Anyway to test this.? or troubleshoot this?

Can someone help me out. Why my graph is not showing up here is my example.sql data.

select count(*) "WHERE customer_id != 0" from oscom.whos_online;
select count(*) "WHERE customer_id = 0" from oscom.whos_online;

Thanks!!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest