Make graph from data of a file containing some metric values

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
User avatar
william925
Posts: 5
Joined: Mon Jan 03, 2011 5:49 am
Location: Nantes (France)

Make graph from data of a file containing some metric values

Post by william925 »

Hi everybody, I wish you a happy new year :D

I plan to make graphs, with a refresh every minute, of the different queries (SELECT, UPDATE, INSERT INTO ...) performed on the tables of a database from a file, automatically generated by a script that runs in the background.


Listing generated file containing the values of the metrics database:

www!27828777!44602272!22954!7626034!108094106!1099764!1184207!3040046!12730913!0!14236734!5767!147605000!25!1136533792!174996603!44602428!7626034!91!7565778 etc. ...

This file is generated every minute by a script running in the background (for Oracle databases and progress databases)


I need your help, I spent time searching already but I found nothing, or I did not understand :(
Thank you in advance.


I use:
CentOS Linux 5.5 (On VMWare Server 1.0.3)
Cacti 0.8.7g
Net-SNMP 5.x
RRDTool 1.4.x

I already have graphs of the bandwidth of my network interface (SNMP - Interface Statistics) with a refresh than a minute. (File .conf changed: * / 1 * * * *............).

(sorry for my English, I am a french user of cacti)


__________________________________________________________________________________________


(En version française)

Bonjour à tous et bonne année :D

J'envisage de mettre en place une solution qui permettrai de «grapher» minute par minute les différentes requêtes (SELECT, UPDATE, INSERT INTO...) effectuées sur les tables d'une base de données, à partir d'un fichier généré automatiquement par un script qui s'exécute en tache de fond.


Exemple de fichier généré contenant les valeurs des métriques de la base de données :

www!27828777!44602272!22954!7626034!108094106!1099764!1184207!3040046!12730913!0!14236734!5767!147605000!25!1136533792!174996603!44602428!7626034!91!7565778 etc...

Ce fichier est généré toutes les minutes par un script tournant en arrière plan (pour les bases oracle et progress)


J'ai besoin de votre aide, j'ai passé du temps à chercher déjà mais en vain :(
Merci d'avance


J'utilise :
Linux CentOS 5.5 (En machine virtuelle VMWare Server 1.0.3)
Cacti 0.8.7g
Net-SNMP 5.x
RRDTool 1.4.x

J'ai déjà des graphes de la bande passante de mon interface réseau (SNMP - Interface Statistics ) avec un rafraichissement d'une minute.
(fichier .conf modifié : */1 * * * *............).
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Make graph from data of a file containing some metric va

Post by gandalf »

This is explained at 1st link of my sig. The keyword to search is "Data Input Method". This allows you to create scripts that spit out any numbers you like. In your case, the script will query your database. Cacti will now in turn call your script to fetch the data out of your database
R.
User avatar
william925
Posts: 5
Joined: Mon Jan 03, 2011 5:49 am
Location: Nantes (France)

Re: Make graph from data of a file containing some metric va

Post by william925 »

Ah... thank you very much dude :)

:D GOD BLESS YOU "GANDALF" :D
User avatar
william925
Posts: 5
Joined: Mon Jan 03, 2011 5:49 am
Location: Nantes (France)

Re: Make graph from data of a file containing some metric va

Post by william925 »

Hi everyone !

I've successfully created graph with "DATA QUERY" (Get SNMP Data (Indexed)).
I created the .xml file... and I used the OID .1.3.6.1.4.1.2021.8

I follow this tutorial : "SNMP Data Query Walkthrough"

I have 1 graph with 1 value.


But in my project I have 21 values to graph.
So, I looked at this topic "[HOWTO] Install and configure the Net-SNMP agent for Unix"

And I saw this :
_______________________________________________________________________
Now let's run this second script, which returns more than one result :

Code: Select all

$ /tmp/bar.sh
456
789
It returns two values, one per line (this is important).
Another way to call scripts from snmpd.conf is by specifying an OID, like this :

Code: Select all

exec .1.3.6.1.4.1.2021.555 /bin/sh /tmp/bar.sh
Run this query :

Code: Select all

$ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.555
UCD-SNMP-MIB::ucdavis.555.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.555.2.1 = STRING: "/bin/sh"
UCD-SNMP-MIB::ucdavis.555.3.1 = STRING: "/tmp/bar.sh"
UCD-SNMP-MIB::ucdavis.555.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.555.101.1 = STRING: "456"
UCD-SNMP-MIB::ucdavis.555.101.2 = STRING: "789"
UCD-SNMP-MIB::ucdavis.555.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.555.103.1 = ""
First line returned by the script will be available at .1.3.6.1.4.1.2021.555.101.1, second one at .1.3.6.1.4.1.2021.555.101.2, and so on.
_______________________________________________________________________

But I don't understand..

For 1 value, when I executed "snmptable" with the OID .1.3.6.1.4.1.2021.8, I have extIndex, extOutput, extResult, etc... and I can use these on cacti.
(exec shelltest /bin/sh /tmp/my_script.sh)

But for 21 values, when I executed "snmptable" with the OID .1.3.6.1.4.1.2021.555, I received the message "Was that a table?" Nothing usable on cacti..
But the "snmpwalk" works very well and my 21 values were displayed..
(exec .1.3.6.1.4.1.2021.555 /bin/sh /tmp/my_script.sh)

Please help me.
Thanks in advance
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Make graph from data of a file containing some metric va

Post by gandalf »

I do not understand your last move.
We were talking about Data Input Method. This will even work if the script spits out multiple values in a row. You won't need a data query for that.
R.
User avatar
william925
Posts: 5
Joined: Mon Jan 03, 2011 5:49 am
Location: Nantes (France)

Re: Make graph from data of a file containing some metric va

Post by william925 »

Hi.

Yes Gandalf, it works perfectly with Data Input Method.
All values are "graphed".

I abandoned the Data Query.


Now I have my graphs, but there is a problem in my opinion..

I link two pictures, the first is my original graph, and the second my original graph with lines on integer.

I wish I had to have graphs with only integers because the scripts returns integer only...
How Cacti can "graph" decimals, whereas the script returns only integers ??

Thx in advance
Attachments
Original graph.JPG
Original graph.JPG (50.99 KiB) Viewed 775 times
Graph.JPG
Graph.JPG (56.05 KiB) Viewed 775 times
Last edited by william925 on Mon Feb 07, 2011 11:17 am, edited 3 times in total.
User avatar
william925
Posts: 5
Joined: Mon Jan 03, 2011 5:49 am
Location: Nantes (France)

Re: Make graph from data of a file containing some metric va

Post by william925 »

An other problem...

I link a third graph..

"milli-values" were "graphed"

I think... Cacti is supposed to "graph" 0 not 0.010 or 0.050 etc...
Attachments
Graph2.JPG
Graph2.JPG (50.01 KiB) Viewed 774 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Make graph from data of a file containing some metric va

Post by gandalf »

This is default rrdtool consolidation. Have a read at the rrdtool site, http://www.vandenbogaerdt.nl and/or 1st link of my sig (rrdtool chapter)
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests