How Do You Use DSStats

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
gsaray101
Cacti User
Posts: 233
Joined: Thu May 17, 2007 9:18 am

dsstats

Post by gsaray101 »

I install this plugin, how does this work?
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

DSStats collects data into several tables:

Transient Tables
data_source_statistics_hourly_cache
data_source_statistics_hourly_last

Permanent Statistical Tables:
data_source_statistics_hourly
data_source_statistics_daily
data_source_statistics_weekly
data_source_statistics_monthly
data_source_statistics_yearly

The hourly cache and the last tables are memory tables. The hourly cache can bet big, depending on the number of data sources. The last table contains prior measurements of data for counters and derive type RRDfile data sources types.

If you want to get the last sampled data for anything:

Code: Select all

SELECT value FROM data_source_statistics_hourly_cache 
WHERE local_data_id=??? AND rrd_name=??? 
ORDER BY time DESC 
LIMIT 1;
If you want to get the max and average for the last hour:

Code: Select all

SELECT average, peak FROM data_source_statistics_hourly 
WHERE local_data_id=??? AND rrd_name=???
If you want to get the top ten "traffic_in" for the last hour:

Code: Select all

SELECT average, peak FROM data_source_statistics_hourly
WHERE rrd_name='traffic_in'
ORDER BY average DESC
LIMIT 10;
As I mentioned in the release notes, this plugin is really an INFRASTRUCTURE plugin, so if you are not a Plugin Developer, it will serve no purpose but to confuse you.

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?
henkwiedig
Posts: 8
Joined: Thu Aug 06, 2009 1:32 pm
Location: Germany

Post by henkwiedig »

TheWitness wrote: If you want to get the top ten "traffic_in" for the last hour:

Code: Select all

SELECT average, peak FROM data_source_statistics_hourly
WHERE rrd_name='traffic_in'
ORDER BY average DESC
LIMIT 10;
I'm trying to write a Superlink Page which diplays this 10 DS/Graphs. Therefor i need the GraphID to build the correct URLs.

What would be the best join to select the corresponding GraphID.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

I'd like to know the answer to this too. I know how to do it for a single local_data_id, but not as a join for a list....

Here's how to get a local_graph_id that contains a local_data_id:

Code: Select all

select graph_templates_item.local_graph_id as lgi FROM graph_templates_item,graph_templates_graph,data_template_rrd where graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id  and task_item_id=data_template_rrd.id and local_data_id =$local_data_id LIMIT  1;
So that's the first graph that contains a graph_item that refers to your local_data_id. It all goes a bit wrong once you start adding extra tables to the join though (for me anyway).
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
henkwiedig
Posts: 8
Joined: Thu Aug 06, 2009 1:32 pm
Location: Germany

Post by henkwiedig »

Howie posted here http://forums.cacti.net/viewtopic.php?p=174235#174235 a Superlink Page which answers this question.

Code: Select all

SELECT 
DISTINCTROW dss.rrd_name, 
dss.calculated,
graph_templates_graph.local_graph_id, 
data_template_rrd.local_data_id, 
dtd.name_cache 
FROM 
graph_templates_item, 
graph_templates_graph, 
data_template_rrd, 
data_template_data dtd, 
data_source_stats_hourly_last dss 
WHERE  
graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id
and dtd.local_data_id = dss.local_data_id
and graph_templates_item.task_item_id=data_template_rrd.id
and dtd.local_data_id = data_template_rrd.local_data_id 
and dss.calculated > 0 
and (rrd_name='errors_in' or rrd_name='errors_out') 
order by name_cache, rrd_name
Graphing a whole lot of Siebel stuff !
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Yeah, I finally figured out where my query was going wrong :-)
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Post by Netcooler »

Guys - would I be wrong at this point to think that if I installed this plugin I could then connect to the MySQL DB with Crystal Reports and graph\display the data?

Am I misunderstanding that? and for Howies sake blah blah... :lol:
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

My understanding is that DSStats give you just one data item.

E.g. the last error counter of an interface

and averages for hour(?) day week ...


But it does not have all data of today, or a week.

I think that is what the "Transporter" plugin is for, which actually saves the polled data into the mysql database ( which then gets quite hudge ... )

Correct me if I am wrong here :-)
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

It aggregates. So, you have X samples of actual values, Y hours of hourly averages, Z days of daily averages, etc... for every data source there is. The value of Y is configurable.

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?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests