My problem is this:
I have to generate a statistical graph ( maybe with Cacti ) from a mySQL table with looks like this:
+----------------+-------------+---------------------+
| BoardID | ActiveCalls | CurrentTime |
+----------------+-------------+---------------------+
| dti(RTC SS7 2) | 0 | 2004-03-16 19:47:44 |
| dti(RTC SS7 1) | 0 | 2004-03-16 19:47:44 |
| dti(ALCATEL) | 0 | 2004-03-16 19:47:44 |
| dti(ORANGE) | 1 | 2004-03-16 19:47:44 |
| dti(RT-ISDN) | 2 | 2004-03-16 19:47:44 |
+----------------+-------------+---------------------+
The actual data is stored in ActiveCalls and every minute another five rows like this are inserted into my table with new values and ofcourse a new date_time. My question is if I can use Cacti to generate graph with data from this table - for hour, day, month and so on.
Any suggestion ( maybe another software ) or whatever will be appreciate.
Possible with Cacti ?
Moderators: Developers, Moderators
You could have a script that Cacti calls to retrieve the data from MySQL. Something like:
I've got something similar in my Cacti.
Code: Select all
#!/bin/bash
# $1 - boardid
CALLS=`echo "SELECT ActiveCalls FROM tablename WHERE BoardID = '$1' ORDER BY CurrentTime DESC LIMIT 1" | mysql -u username -ppassword database`
echo $CALLS
Could you be a little more specific please Speedster ?
Because today is my first day with cacti and i'm not quite sure how to use what you gave me.
I supose i have to load this in a script but with this query i can select only last record for only one boardID. the boardID part I understand, or atleast i think i can do this five times for each boardid. but how about the time part ?
eg: hour, day, month .. ?
Because today is my first day with cacti and i'm not quite sure how to use what you gave me.
I supose i have to load this in a script but with this query i can select only last record for only one boardID. the boardID part I understand, or atleast i think i can do this five times for each boardid. but how about the time part ?
eg: hour, day, month .. ?
Without being more specific on what you want to graph there's not much more specific I can get
That bash script will get the most recent value for whatever BoardID you give it. When cacti calls it the value will be stored in an RRA from which you can get various time-series graphs from it (day, week, month, year).
That bash script will get the most recent value for whatever BoardID you give it. When cacti calls it the value will be stored in an RRA from which you can get various time-series graphs from it (day, week, month, year).
Ok, to be more specific on my problem.
#
# Table structure for table `Statistics`
#
CREATE TABLE Statistics (
BoardID varchar(128) NOT NULL default '',
ActiveCalls int(11) NOT NULL default '0',
CurrentTime datetime NOT NULL default '0000-00-00 00:00:00',
KEY BoardID (BoardID)
) TYPE=MyISAM;
This is my table from where i want to create graph by hour. day, month.
BoardID ActiveCalls CurrentTime
dti(ORANGE) 4 2004-04-19 19:12:55
Something like that will be insert in this table each minute with different values for ActiveCalls.
Now, what i want is to export somehow this data from mysql to rrd and then use cacti to draw the graph.
Can't explain it other that this way : )
Hope to be usefull if you want to give me sugestions on my problem.
#
# Table structure for table `Statistics`
#
CREATE TABLE Statistics (
BoardID varchar(128) NOT NULL default '',
ActiveCalls int(11) NOT NULL default '0',
CurrentTime datetime NOT NULL default '0000-00-00 00:00:00',
KEY BoardID (BoardID)
) TYPE=MyISAM;
This is my table from where i want to create graph by hour. day, month.
BoardID ActiveCalls CurrentTime
dti(ORANGE) 4 2004-04-19 19:12:55
Something like that will be insert in this table each minute with different values for ActiveCalls.
Now, what i want is to export somehow this data from mysql to rrd and then use cacti to draw the graph.
Can't explain it other that this way : )
Hope to be usefull if you want to give me sugestions on my problem.
Who is online
Users browsing this forum: No registered users and 1 guest