eLuna Graph System

eLuna Graph System is an application written in Perl based on RRDTool and distributed under GNU General Public License. Its aim is collection, and then presentation in graphic form, of data, to aid in monitoring of a Linux machine.

By default, the application allows monitoring of the load, the CPU usage as a percent, memory use as a percent, number of processes, quantity of data transmitted via eth0 (In/Out) and percentage of disc space in use on /. It is nevertheless possible to add personalized elements to this.

An application demo is available online at the following address: http://graphs.eluna.org. For more detailed information, please consult the README file.

Prerequisite

Screenshots

Comments

122 comments
matao,
05/12/2006, 00:05
Bravo pour ce logiciel très simple d'utilisation et très bien écrit et pensé.
Je suis actuellement en train de le tester, et n'ai qu'un seul regret : celui de ne pas avoir par défaut l'ensemble des graphs présentés dans la démo. Néamoins, cela me permettra de me creuser un peu la tête pour trouver comment récupérer le nombre de Hits Apache

Merci
05/12/2006, 14:43
Salut matao,

Merci pour ton commentaire !

Pour les graphs non disponibles, en fait la raison est la suivante: je n'ai mis que les graphs qui me semblaient être suffisamment génériques pour fonctionner sur une grande variété de systèmes, sans avoir à faire de modifications dessus, ou alors des modifications mineures.

Pour apache, j'utilise personnellement un truc qui me semble être un peu du bricolage, et donc je ne l'ai pas inclus dans le soft

Si cela t'intéresse, je fais comme cela:

root@eluna 10_apache_hits # cat create.sh
#!/bin/bash

rrdtool create apache_hits.rrd
--start `date +%s`
--step 300
DS:hits:DERIVE:600:0:U
RRA:AVERAGE:0.5:1:2016
RRA:AVERAGE:0.5:6:1344
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:144:1460

root@eluna 10_apache_hits # cat graph.pm
$GRAPH_TITLES{'apache_hits'} = "{#server#} - Apache Hits";
$GRAPH_CMDS{'apache_hits'} = <<"AH_GRAPH_CMD";
--title "{#server#} - Apache Hits"
--vertical-label="Hits Per Minute"
--units-exponent 0
--lower-limit 0
DEF:hits={#path#}apache_hits.rrd:hits:AVERAGE
CDEF:hits_mn=hits,60,*
AREA:hits_mn{#color2#}:"Hits Per Minute "
GPRINT:hits_mn:LAST:"Current\: %5.0lf "
GPRINT:hits_mn:AVERAGE:"Average\: %5.0lf "
GPRINT:hits_mn:MAX:"Maximum\: %5.0lf\n"
LINE1:hits_mn{#linecolor#}
AH_GRAPH_CMD

1; # Return true

root@eluna 10_apache_hits # cat update.pl
#!/usr/bin/perl

$dummy = `www-browser -dump http://localhost/server-status/ | grep "Total accesses"`;
$dummy =~ /.*Total accessess*:s*([0-9]*)s*/;

system("rrdtool update apache_hits.rrd -t hits N:$1");

Comme tu peux le voir, j'utilise le module server-status d'apache pour récupérer l'info... Y'a sans doute mieux à faire !
matao,
06/12/2006, 17:30
Salut Steph,
en effet, le module server-status, c'est pas très générique...
du coup, j'ai réécrit le update.pl pour qu'il soit plus générique, ce qui donne :

$ cat update.pl
#!/usr/bin/perl

$logpath="/usr/local/apache2/logs/access_log";
$daten=`date --rfc-2822`;
if($daten=~ m/^.*,s(.*)s(.*)s(.*)s(.*):(.*):(.*)s+(.*)$/gi){
$d=$1;$m=$2;$y=$3;$h=$4;$mn=$5;
$daten="$d/$m/$y:$h:$mn";
$daten1="$d/$m/$y:$h:".($mn-1);
$daten2="$d/$m/$y:$h:".($mn-2);
$daten3="$d/$m/$y:$h:".($mn-3);
$daten4="$d/$m/$y:$h:".($mn-4);
$daten5="$d/$m/$y:$h:".($mn-5);
}
open FICH, $logpath;
@filec= <FICH>;
close FICH;
$nbhits=0;
foreach $fich(@filec){
if ($fich =~ /$daten/){$nbhits++;}
if ($fich =~ /$daten1/){$nbhits++;}
if ($fich =~ /$daten2/){$nbhits++;}
if ($fich =~ /$daten3/){$nbhits++;}
if ($fich =~ /$daten4/){$nbhits++;}
if ($fich =~ /$daten5/){$nbhits++;}
}
system( "rrdtool update apache_hits.rrd -t hits N:$nbhits" );

du coup, il y a juste à lui fournir le chemin du log apache, et le tour est joué... en plus, ca marche aussi pour les erreurs.
(ici, j'ai pris pour postulat que le cron est lancé toutes les 5 minutes...)

Sinon, j'ai aussi écrit un graph netstat, qui donne le nombre de connexions réseaux ouvertes à un moment donné. Ca donne :

$ cat create.sh
#!/bin/bash

rrdtool create netstat.rrd
--start `date +%s`
--step 300
DS:netstat:GAUGE:600:U:U
RRA:AVERAGE:0.5:1:2016
RRA:AVERAGE:0.5:6:1344
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:144:1460

$ cat graph.pm
$GRAPH_TITLES{'netstat'} = "{#server#} - Nombre de connexions reseau";
$GRAPH_CMDS{'netstat'} = <<"NETSTAT_CMD";
--title "{#server#} - Nombre de connexions reseau"
--vertical-label="nb de connexions"
--lower-limit 0 --upper-limit 100
DEF:netstat={#path#}netstat.rrd:netstat:AVERAGE
AREA:netstat{#color5#}:"Nombre de connexions "
GPRINT:netstat:LAST:"Current\: %3.0lf "
GPRINT:netstat:AVERAGE:"Average\: %3.0lf "
GPRINT:netstat:MAX:"Maximum\: %3.0lf\n"
LINE1:netstat{#linecolor#}
NETSTAT_CMD

1; # Return true

$ cat update.pl
#!/bin/perl

$dummy = `netstat -net -4 |grep -v Active |grep -v Proto|wc -l`;
$dummy=~ /(.*)/;
system("rrdtool update netstat.rrd -t netstat N:$1");


Voilà.

Sinon, j'ai apporté quelques modifications à index.pl et template/index.html pour faire un affichage des graphs sur 2 colonnes. Si tu veux, je peux te les envoyer par mail
06/12/2006, 21:02
Salut matao,

Le problème de la solution que tu donnes est qu'elle ne fonctionne pas dans le cas relativement courant où l'on héberge un grand nombre de sites avec pour chacun un fichier de log individuel, ce qui est notamment mon cas ! Il doit y avoir également des problème de logrotate qui doivent survenir à mon avis...

De plus, je ne sais pas comment fonctionne le module server-status, mais j'imagine que ça doit être plus performant que de parser un ou plusieurs fichiers de logs qui peuvent être relativement volumineux.

Pour les 2 colonnes, oui je veux bien que tu me les envoies par mail (steph@eluna.org), dès que j'ai un moment j'essaierai d'intégrer cette option
12/12/2006, 00:06
Excellent script !!!

Par contre pour le nombre de connexion active sur le serveur WEB.
J'ai pondu cette commande :

netstat -tn | grep ESTABLISHED | grep :80 | wc -l

Comment placer cette comment dans la variable $dummy car je comprends pas trop le 2eme $dummy

Exemple :

$dummy = `netstat -net -4 |grep -v Active |grep -v Proto|wc -l`;
$dummy=~ /(.*)/;

Puis-je utiliser la même structure rrd que la solution de matao ?

Merci et dsl pour ces quesions qui sont peut être stupide.

12/12/2006, 10:18
@Matao: désolé Matao, j'avais lu trop vite ton post, j'avais pas vu ton graph pour le nombre de connexions réseau ! Je l'incluerai dans la prochaine version du script
12/12/2006, 10:22
Salut Gregory,

... une question n'est jamais stupide

Dans le cas des commandes :

netstat -tn | grep ESTABLISHED | grep :80 | wc -l
netstat -net -4 |grep -v Active |grep -v Proto|wc -l

elles retournent directement le résultat sans "fioritures", et donc le "deuxième dummy" ne sers à rien.

Tu peux à la place faire ça:

$dummy = `netstat -net -4 |grep -v Active |grep -v Proto|wc -l`;
system( "rrdtool update apache_hits.rrd -t hits N:$dummy" );

(Attention à bien remplacer $1 par $dummy dans l'appel système par contre !)

Sinon oui, tu peux utiliser la même structure rrd que matao qui s'y prête parfaitement.
12/12/2006, 11:38
Merci pour ta réponse aussi rapide. et encore bravo pour ce script. Je testerais dans la journée.

PS : Le site web est tout aussi propre que que le script
12/12/2006, 11:46
Merci
12/12/2006, 17:40
Tu t'es trompé dans le update.pl: tu as mis:

DEF:apache_hits={#path#}apache_hits.rrd:netstat:AVERAGE

au lieu de :

DEF:apache_hits={#path#}apache_hits.rrd:apache_hits:AVERAGE

12/12/2006, 18:08
Je l'ai vu avant et c'est bon ca marche. Thanks
12/12/2006, 23:32
J'ai un soucis par contre par rapport au nombre de Hits sur Apache.

netstat -tn | grep ESTABLISHED | grep :80 | wc -l me donne ce nombre la a un moment x. Si le script d'update s'execute a x+1 peut être que ce nombre aura changé. Si le script s'execute entre les connexions, mes graphs vont être foireux non ? Un moyen de remedier a cela ?
13/12/2006, 09:53
Oui exactement

Tu peux pour remédier à cela utiliser une des deux solutions présentées dans les commentaire ci-dessus.

1/ Ma solution (2ème commentaire) :

Performante, mais demande d'installer et de configurer le module server-status d'apache.

2/ La solution de Matao (3ème commentaire) :

Moins performante et valable que si tu n'as qu'un seul fichier de log d'apache. Par contre plus facile à mettre en place, car pas besoin du module server-status.
14/12/2006, 22:00
J'ai fais des copier-coller de ton script et a chaque fois, je prend une erreur quand je lanc ele script d'update. j'ai donc essayé de lancer manuellement le create.sh et je prend un ERROR: Invalid DS type, je comprend pas. Ca me fait uniquement sur ton script. Tous les droits sont bons....
14/12/2006, 23:25
Y'avait un espace en trop, c'est pour ça... j'ai modifié mon commentaire, tu peux re-copier/coller !

Ovidiu,
14/01/2007, 14:36
Salut Steph,
J'ai installe eLuna Graph et suivi les conseils d'installation, mais les images des graphs ne sont pas affiches . J'ai la page index.pl mais a la place des images j'ai de "broken links". Est-ce que tu as une idee ?

Merci
14/01/2007, 14:46
Salut Ovidiu,

Pas vraiment d'idée, mais essayes de vérifier ça:

- Est-ce que les fichiers /rrd/*/*.rrd sont bien mis à jour par lors du cron ? pour le savoir, vérifie si les dates de dernière modification sont bien mises à jour par exemple

- Est-ce lorsque tu affiches index.pl des fichiers png sont bin créés dans le répertoires "graphs" ? Si ce n'est pas le cas, es tu sûr que l'utilisateur qui exécute le script index.pl (apache ? nobody ? www-data ?) a bien les droits d'écriture dans ce répertoire ? ou a bien accès à rrdtool ?

- Si les images png sont bien générées, est-ce que le dossier est bien accessibles en lecture par l'utilisateur du qui exécute le script index.pl ?

Tiens moi au courant
Ovidiu,
15/01/2007, 14:09
Salut Steph,
J'ai instllé cf. aux instructions et j'ai les problemes suivantes :
- le cron ne s'execute pas car il n'y a pas de fichier rrd generé
- en accessant http://localhost/graphs le fichier index.pl n'est pas executé mais il m'est proposé pour telechargement .

Sur Apache 2.0.55(Ubuntu Desktop 6.10) j'ai les modules suivantes activées : svn, python, php, ssl, mod_perl.
Les repertoires sont en ecriture pour l'utilisateur www-data.

Merci pour ton aide
15/01/2007, 14:24
Pour l'histoire du script index.pl proposé en téléchargement, es-tu sûr d'avoir correctement configuré apache comme indiqué dans le README ? c'est à dire d'avoir mis quelque chose du genre:

<Directory /var/www/graphs/>
AddHandler cgi-script .pl
Options +ExecCGI
DirectoryIndex index.pl
</Directory>

Si oui, as-tu bien redémarré apache ensuite ?

Pour le problème du crontab... je sais pas quoi dire...

Quelques pistes:

- As-tu bien installé, comme c'est marqué dans le fichier README les modules DateTime et HTML::Template::Expr ?

- As-tu bien installé RRDTool ?

- Si tu lances le fichier update.pl à la main, crée-t-il les fichiers rrd ? (dans ce cas le problème vient de la tâche cron, qui ne fait rien d'autre qu'éxécuter périodiquement ce script).

- Où as-tu spécifié la tache cron ? dans /etc/crontab ?
Ovidiu,
15/01/2007, 20:30
Oui les modules sont bien installees. J'ai execute update.pl a la main. et il m'a cree les bases rrd. J'ai redemare la machine , maintenant le index.pl est bien execute mais il toujours pas d'images ...
Est'ce que les images sont genere a la vole ou genere une fois et "cached" pour quelques minutes ?


Ovidiu
16/01/2007, 13:08
Les images sont cachées pendant 10 secondes par défaut je crois. Les images générées le sont dans le dossier graphs. Ton dossier graphs est-il vide ou bien y'a-t-il des fichiers png dedans ?
Matthieu,
29/01/2007, 08:48
Bonjour,

J'essaye d'installer le script eluna graph sur mon serveur ... mais en vain
quand je vais sur http://monsite/graphs/ j'obtiens : 500 Internal Server Error
j'ai bien suivi les instructions d'installation, mais j'ai du rater quelque chose quelque part ...
j'ai un serveur apache 2, perl avec les modules requis, rrdtool, ...
quand le lance index.pl en ligne de commande j'obtiens seulement le message "This script must be executed as a web script" mais pas d'autres erreur, donc ca semble etre ok
et quand je regarde les logs apache, j'ai ce message d'erreur : "Premature end of script headers: index.pl" et c'est tout

merci de m'eclairer parce que la je bloque completement
MAtthieu
29/01/2007, 11:29
Salut Matthieu,

A vue de nez, je dirais problème de droits: est-ce que le script est bien exécutable ? est-ce que l'utilisateur est correct ?

Pour tester, si tu fais un petit fichier de test avec les même permissions et le même user/group, cela fonctionne ?

Exemple de fichier de test:

#!/usr/bin/perl
print "Content-type: text/html

";
print "<H1>Hello World</H1>
";
Matthieu,
29/01/2007, 12:01
salut Steph,

et a vue de nez tu as absolument raison
les fichiers appartenaient a root ... j'ai changé les droits et ca marche parfaitement !

allez, maintenant je m'attaque à essayer de créer des graphs personalisés. et hop.

merci pour ta reponse rapide et désolé d'avoir posté pour un problème aussi simple mais linux en général est très nouveau pour moi (mais ca me plait de plus en plus !)
29/01/2007, 14:13
c'est bien simple, sous Linux, à chaque fois que j'ai eu des problèmes à première vue incompréhensibles, dans 80% des cas, c'était des problèmes de droits
08/02/2007, 21:50
Salut tout le monde,

Je partage un peu mon expérience sous OS debian, et le problème des images qui s'affiche pas que j'ai fini par résoudre.

Pour debian : voici les paquets à installer :
#apt-get install perl libhtml-template-expr-perl libdatetime-perl rrdtool
Les dépendances suivront (bien sur). Les paquets à installer sont surement les mêmes ou presque sur les autres distribs.
Si le fichier index.pl se propose en téléchargement au lieu de s'afficher dans le navigateur, lancé la commande ./index.pl dans le rep d'install via la console, il doit retourner "This script must be.....", Si ça affiche autre chose, c'est qu'un paquet manque (je me suis rendu compte ainsi de l'absence de libhtml-template-expr-perl).

Problème d'image :
Je suis pas un pro d'apache (2.2) ni de perl, mais j'avais écrit ça dans mon 000-default :
ScriptAlias /eluna/ /var/www/eluna/
<Directory /var/www/eluna/>
AddHandler cgi-script .pl
Options +ExecCGI
DirectoryIndex index.pl
</Directory>
Je ne sais pas pourquoi, mais avec cette config, les images ne s'affichent pas du tout.
Tout fonctionne correctement une fois qu'on a commenté la ligne :
#ScriptAlias /eluna/ /var/www/eluna/

Après quoi, tout fonctionne correctement. Ormis les statistiques eth0 ?? Il y a marqué "nan" à la place des valeurs. Ce sera mon combat de demain

++ Stephanfo
08/02/2007, 22:30
Oui effectivement, fallait faire comme indiqué dans le README, pas mettre de ScriptAlias

Merci pour ce retour d'expérience en tout cas ! ... et vive Debian
09/02/2007, 08:51
Effectivement, j'ai mis un script alias, car c'était en général toujours ainsi dans mon fichier avant un directory. Je me ferais pas avoir deux fois. (débutant en config apache, le copier-coller, ça marche pas toujours ).

Sinon, autre combat, autre victoire.
Concernant les traffics ETH0 IN et OUT, je viens de comprendre pourquoi ça marchait pas. Je suis sous debian testing "etch". Le cron génère un environnement différent de la console. Aussi, le répertoire /sbin n'est pas inclut dans $PATH. Résultat, ifconfig .... n'est pas trouvé. Une fois que j'ai mis le chemin complet (/sbn/ipconfig ....) dans le fichier ~/rrd/05_eth0_out/update.pl , ça fonctionne.

Je pense faire un script pour les quotas. Si j'y arrive, je le posterai.

++ Stéphane

PS : Je suis d'accord, vive debian .
09/02/2007, 21:31
Comme promis, petit script pour suivre un quota. Je suis pas un pro du perl (j'ai découvert ce matin), ni de rrd (j'ai commencé a comprendre le fonctionnement ce matin aussi), donc c'est surement perfectible.

create.ssh :
#!/bin/bash

rrdtool create quota.rrd
--start `date +%s`
--step 300
DS:current:GAUGE:600:0:U
DS:soft:GAUGE:600:0:U
DS:hard:GAUGE:600:0:U
RRA:AVERAGE:0.5:1:2016
RRA:AVERAGE:0.5:6:1344
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:144:1460


update.pl :
#!/usr/bin/perl

$user = "server-cs";

$dummy = `/usr/bin/quota $user | tail -n 1`;
$dummy =~ s/s+/ /g;
$dummy =~ / (.*) (.*) (.*) (.*) (.*) (.*) (.*) /;

system("rrdtool update quota.rrd -t current:soft:hard N:$2"."000:$3"."000:$4"."000");


graph.pm :
$GRAPH_TITLES{'quota'} = "{#server#} - Quota de server-cs";
$GRAPH_CMDS{'quota'} = <<"QUOTA_GRAPH_CMD";
--title "{#server#} - Quota de server-cs"
--vertical-label="octets"
--units-exponent 9
--lower-limit 0

DEF:current={#path#}quota.rrd:current:AVERAGE
DEF:soft={#path#}quota.rrd:soft:AVERAGE
DEF:hard={#path#}quota.rrd:hard:AVERAGE

CDEF:currentmo=current,1000,/,1024,/
CDEF:softmo=soft,1000,/,1024,/
CDEF:hardmo=hard,1000,/,1024,/

AREA:current{#dcolor1#}:"Used Space "
GPRINT:currentmo:LAST:"Current\: %3.0lfMo "
GPRINT:currentmo:AVERAGE:"Average\: %3.0lfMo "
GPRINT:currentmo:MAX:"Max\: %3.0lfMo\n"
LINE2:soft{#color2#}:"Limit soft "
GPRINT:softmo:LAST:"Current\: %3.0lfMo "
GPRINT:softmo:AVERAGE:"Average\: %3.0lfMo "
GPRINT:softmo:MAX:"Max\: %3.0lfMo\n"
LINE3:hard{#color3#}:"Limit hard "
GPRINT:hardmo:LAST:"Current\: %3.0lfMo "
GPRINT:hardmo:AVERAGE:"Average\: %3.0lfMo "
GPRINT:hardmo:MAX:"Max\: %3.0lfMo\n"
QUOTA_GRAPH_CMD

1; # Return true

Voila, c'est surement perfectible, mais ça peut être une bonne base.

++ Stephanfo
16/02/2007, 14:48
Merci pour cette contribution !
22/02/2007, 17:15
Hi! Great script!
22/02/2007, 18:18
thanks
mamat,
13/03/2007, 18:57
Bonjour,

voila je me suis fait un script pour monitorer le serveur de mail.
Ca fonctionne avec qmail sur gentoo, je ne sais pas ce que ca donne sur d'autres systemes ...
si ca interresse qqn voila le code :

create.sh :
#!/bin/bash

rrdtool create qmail.rrd
--start `date +%s`
--step 300
DS:all:GAUGE:600:0:U
DS:notyet:GAUGE:600:0:U
RRA:AVERAGE:0.5:1:2016
RRA:AVERAGE:0.5:6:1344
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:144:1460


graph.pm :
$GRAPH_TITLES{'qmail'} = "{#server#} - qmail queue";
$GRAPH_CMDS{'qmail'} = <<"QMAIL_GRAPH_CMD";
--title "{#server#} - qmail queue"
--vertical-label="Nb Messages"
--units-exponent 0
--lower-limit 0
DEF:all={#path#}qmail.rrd:all:AVERAGE
DEF:notyet={#path#}qmail.rrd:notyet:AVERAGE
AREA:all{#color3#}:"messages in queue"
GPRINT:all:LAST:"Current\: %5.0lf "
GPRINT:all:AVERAGE:"Average\: %5.0lf "
GPRINT:all:MAX:"Maximum\: %5.0lf\n"
AREA:notyet{#color1#}:"messages in queue but not yet preprocessed"
GPRINT:notyet:LAST:"Current\: %5.0lf "
GPRINT:notyet:AVERAGE:"Average\: %5.0lf "
GPRINT:notyet:MAX:"Maximum\: %5.0lf"
QMAIL_GRAPH_CMD

1; # Return true


update.sh :
#!/bin/bash

ALL=`/var/qmail/bin/qmail-qstat |grep "queue:" |cut -d":" -f2 |cut -d" " -f2`
NOTYET=`/var/qmail/bin/qmail-qstat |grep "preprocessed:" |cut -d":" -f2 |cut -d" " -f2`

rrdtool update qmail.rrd -t all:notyet N:$ALL:$NOTYET

13/03/2007, 20:35
Super, merci ! ... Je vais l'utiliser d'ailleurs
badassspammass,
20/03/2007, 08:34
sorry but i'm just testing your t3 comments extension for a spam filter

the graph system looks nice! in fact the whole webby does!


back to the essentials!

BUY VIAGRA BUY VIAGRA BUY VIAGRA
20/03/2007, 09:22
There's no spam filter at this time... but soon captcha t3 extension will be usable on it
29/03/2007, 15:30
Salut Steph,

Comme je suis un Hollandais je préfère écrire en Anglais, j'espère que tu comprends cela

First of all, very nice work! It looks very well.
However, I installed it using your readme, and here is the result: graph.chrysaor.nl.
As you can see, there are no reals graphs because there are no lines in the images. And the text in the images shows 'nan' everywhere. Am I missing something? I'd be glad if you could help me out.

Merci d'avantage
29/03/2007, 15:38
hi Sander,

Thanks for your feedback.

Might be a problem of crontab not executed every 5 minutes. If you execute the update.pl script manually, does it works ? if yes => crontab problem. If not, what's happen exactly ? error ? When it works, *.rrd files must be updated every update (manually or crontab), does they ?
29/03/2007, 19:56
Steph,

Running the script manually gave no errors and indeed I didn't configure cron correctly. But now it does. Thank you so much!

Sander
29/03/2007, 20:20
You're welcome
29/03/2007, 22:37
Steph,

I tried to create the Apache_hits graph, so I enabled server-stats and created a folder 08_apache_hits in the rrd folder. In 08_apache_hits I created the files you mentioned above.
When I execute the 'main' update.pl, no errors are echoed. But when I open the page in my browser, the Apache hits graph is not shown and it is not in the graphs folder too.
What should I do?

I also noticed that no more graphs are created for the network traffic, all other graphs go fine.

Thanks,
Sander
30/03/2007, 09:39
Well, hard to debug without access


For the network traffic, try to see if the command executed in the rrd/05_eth0_out/update.sh file returns a number that increases each time

Command is: ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1

Or maybe your interface is not named eth0 ?


For the apache hits, are you sure that you correctly configure it ? are you sure that www-browser http://localhost/server-status/ display server-status page ?

If yes, and so if the command www-browser -dump http://localhost/server-status/ | grep "Total accesses" works, try to see if you have created all files with correct rights / owners.
30/03/2007, 22:58
Steph, thanks for your answer.

The network traffic command returns a number, here is the output:
root@alpha:~# ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1
453149737
root@alpha:~# ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1
453193979
root@alpha:~# ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1
453223291
root@alpha:~# ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1
453240455

The graphs have worked some time, but suddenly the disapeared after running the update script and they didn't come back. They still don't.

I figured out that I had to add "ExtendedStatus On" to my apache config file. Now running www-browser -dump http://localhost/server-status/ | grep "Total accesses" does give output. And after chowning the main graph tool folder to www-data, the apache graph shows up

Thanks mate
31/03/2007, 10:36
Maybe an idea (that I have corrected in my devel version, which will be released soon, with an english readme) :

try to replace ifconfig by /sbin/ifconfig in update.sh files

Example:

#!/bin/bash

rrdtool update eth0_out.rrd
-t out
N:`/sbin/ifconfig eth0 |grep bytes|cut -d":" -f3|cut -d" " -f1`

Hope it works !
31/03/2007, 13:42
It works indeed. However this is strange, because ifconfig is exactly the same as /sbin/ifconfig/.

Now I've got another problem, again with the network graps. When there has been some high traffic, for example 12 MByte, it looks like there is no traffic when there is a normal network activity, for example 38 KByte, because of the automatic scaling.
Is there a solution for this?
31/03/2007, 14:08
Yes, but it's because you have /sbin in your path, that's not the case for the crontab.

For the second thing, there's no solution that I know...
04/04/2007, 19:14
What should I change in the apache_hits folder to make it show requests/hour instead of requests/minute?
05/04/2007, 08:45
Well, don't really understand why you want to do do this, but maybe you can change this line:

CDEF:hits_mn=hits,60,*

to:

CDEF:hits_hr=hits,3600,*

(and replace hits_mn by hits_hr in the rest of the file)
Sander,
05/04/2007, 17:28
It was was meant just as a little excercise to get familiar with the graph system. But it does'nt work in the way you suggested.

05/04/2007, 17:34
my apologize for that, haven't tested

Sander,
06/04/2007, 13:50
No problem, I will try something else
Sander,
06/04/2007, 14:41
I created a graph that shows my active TorrentFlux torrents. Scripts are below:


************ update.sh ************
#!/bin/bash

a=`ps aux | grep btphptornado| wc -l | sed -e "s/ //g"`
a=`expr $a - 1`

rrdtool update torrent.rrd
-t all
N:$a



************ graph.pm ************
$GRAPH_TITLES{'torrent'} = "{#server#} - Active Torrents";
$GRAPH_CMDS{'torrent'} = <<"PROC_GRAPH_CMD";
--title "{#server#} - Active Torrents"
--vertical-label="Torrents"
--units-exponent 0
--lower-limit 0
DEF:all={#path#}torrent.rrd:all:AVERAGE
AREA:all{#color3#}:"Torrents "
GPRINT:all:LAST:"Current\: %5.0lf "
GPRINT:all:AVERAGE:"Average\: %5.0lf "
GPRINT:all:MAX:"Maximum\: %5.0lf\n"
PROC_GRAPH_CMD



************ create.sh ************
#!/bin/bash

rrdtool create torrent.rrd
--start `date +%s`
--step 300
DS:all:GAUGE:600:U:U
RRA:AVERAGE:0.5:1:2016
RRA:AVERAGE:0.5:6:1344
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:144:1460
06/04/2007, 16:17
Thanks for your contribution !
18/04/2007, 23:40
Génial, simple et efficace ... bravo.
J'ai l'intention d'utiliser ton appli pour monitorer des serveurs web distants.
Cela fonctionne en integrant des commandes SSH dans les update.pl et update.sh
Juste un détail, y a t'il un endroit où je puisse modifier le nom du serveur apparaissant sur les graphs, sans devoir modifier tous les fichiers graph.pm ?

Merci et encore bravo
19/04/2007, 09:01
Merci Herve !

Si j'ai bien compris ta question, le nom du serveur est modifiable dans la section "configuration", au début du fichier "index.pl". C'est ce nom de serveur qui sera utilisé ensuite dans les graphs.
Herve,
19/04/2007, 10:47
Merci,
Je n'avais pas regardé dans ce fichier !!!
J'en profite pour te poser une nouvelle question car je débute en rrdtool, y a t'il une commande pour vider les donnèes dans une base rrd, histoire de repartir sur un bon pied après différents tests ?

Merci,
19/04/2007, 15:42
Supprime les fichiers *.rrd (par exempe rrd/01_load/load.rrd), le script de mise à jour recréera la base rrd automatiquement s'il ne la trouve pas.
Herve,
02/05/2007, 18:23
C'est bon pour le "reset" des données.
Par contre, je tente d'ajouter un graphe pour avoir uniquement le load average des 5 dernieres minutes et je n'y arrive pas ! J'ai duplique rrd/01_load en rrd/01_load5mn.
Le fichier .rrd se crée bien, mais pas les fichiers graphe !
Voici mes fichiers de conf :

# cat create.sh
#!/bin/bash

rrdtool create load5mn.rrd
--start `date +%s`
--step 300
DS:load5mn:GAUGE:600:0:U
RRA:AVERAGE:0.5:6:1344

# cat graph.pm
$GRAPH_TITLES{'load5mn'} = "{#server#} - Load Average 5mn";
$GRAPH_CMDS{'load5mn'} = <<"LOAD5MN_GRAPH_CMD";
--title "{#server#} - Load Average 5mn"
--vertical-label=""
--units-exponent 0
--lower-limit 0
DEF:load5mn={#path#}load5mn.rrd:load5mn:AVERAGE
CDEF:mysum=load5mn,+
STACK:load5mn{#dcolor2#}:"load average 5mn"
GPRINT:load5mn:LAST:"Current\: %5.2lf "
GPRINT:load5mn:AVERAGE:"Average\: %5.2lf "
GPRINT:load5mn:MAX:"Max\: %5.2lf\n"
LINE1:mysum{#linecolor#}
LOAD5MN_GRAPH_CMD

1; # Return true

# cat update.sh
dummy=`ssh xxxwww.www.www "cat /proc/loadavg"`

V1=`echo $dummy | cut -d" " -f1`
V2=`echo $dummy | cut -d" " -f2`
V3=`echo $dummy | cut -d" " -f3`

rrdtool update load5mn.rrd -t load5mn N:$V2

-------

J'ai du faire une ou des erreurs

Merci de ton aide ...
28/05/2007, 15:35
Oups désolé, j'ai oublié de répondre à ton commentaire !

... tu t'en es sorti ?
BARKA,
06/07/2007, 13:31
Bonjour,

Est ce que quelqu'un a essayé d'installer eluna en multi-server.

Mecri pour vos réponse.
BARKA,
25/08/2007, 18:36
Bonjour,

Est ce que une personne parmis vous peut m'aider, je souhaite faire le graph du trafic réseau sous solaris avec un netstat -i je recupere le nombre de packets et je l'insere dans la base eth0_in, Est ce que quelqu'un peut me dire quel mode je peux creer la base eth0_in en gauge ou counter, en sachant que mon script de collect toure tous les 5min et comment je peux afficher mon graph avec le nombre de packets par seconde.

merci par avane.
belvedere,
20/09/2007, 16:17
Alors voilà, je fais un test.
J'espère simplement que notre ami Steph n'aura pas oublié de programmer un backoffice pour dégager tous les comments foireux comme celui-ci !!!
26/09/2007, 15:33
très bon système
Guenther,
16/11/2007, 22:14
Excuse me for writing in English. While I do read French a peu pres my writing is quite terrible.

A few comments about this nice and very usefull script:
- Sander 31/03/2007
rrdtools actually supports logarithmic scaling which with nowadays Gb networking works better than linear graphs, e.g. for log(kBytes/s):
DEF:out2={#path#}eth0_out.rrd:out:AVERAGE
CDEF:out3=out2,1000,/
CDEF:out4=out3,LOG
CDEF:out=out4,0.43429448,*
LINE3:out{#color3#}:"Outbound "
No very elegant. It should be possible to put all in one line.

I would be very pleased to find a simple Eluna script which checks postfix and cyrus IMAP server for ingoing, outgoing and rejected mails. Mailgraph exists, but it would be nice to have it all in one set of scripts and webpages.

Also monitoring SUN Gridengine Queuing system might be interesting: nb. of jobs running in different queues and nb. of jobs waiting.

Finally I'm a bit confused about the fact that the scripts should be run with root privileges. Even for a web server with restricted access this might be a security issue. And as for the update scripts in the Eluna sample package: none of them requires root access if one replaces 'ifconfig' with '/sbin/ifconfig'. I simply run them under a system wide user 'eluna'.
20/11/2007, 15:37
Hi,

First, thanks for your feedabck... and my turn to be sorry, my english writing is quite awful ^^

I just have read your comment but I don't have many time for now, so quick answer :

- For logarithmic scaling, can you explain a bit more ? (why do you divide by 1000, and what is 0.43429448 ?) - no time to understand myself, sorry

- For other scripts, the goal of this soft is to provide a few "universal" scripts, and let users make their own scripts. For example, the two scripts you want would be useless for me. But feel free if you make some custom scripts to send them to me. Maybe I can put a section on this page "custom scripts made by users".

- For the root privileges, maybe you're right ! ... Don't have the time to check this for now, but I'll probably make a new version later with this idea. But I'm not agree with the security issue. If configured like it's said in the README file, I don't think there is.

For now, a new version will be available soon, but it's just one with a new README file translated in english. A translator is working on the translation of the website and the softwares.
Guenther,
20/11/2007, 23:03
- For logarithmic scaling, can you explain a bit more ? (why do you divide by 1000, and what is 0.43429448 ?)

My preferred unit is kByte, not Byte. The machine is part of a network with quite some background noise, so there is always something going on. As for the factor: CDEF calculates the logarithmic function with Euler's number as base, that is LN or LOG_e. In order to get LOG_10 one has to multiply with LOG_10 e: LOG_10 X = LOG_10 e * LN X.

As for the "costum scripts": I consider this to be a very interesting idea to have individual solutions for specific problems available on eluna.org. In fact I did choose your script from the examples at Tobi Oetiker's web site because Eluna is so flexible. I will use it for a networked system where on different machines different values are of interest for monitoring. So while the principle structure is the same the directories in ./rrd will differ, and I can still have the same index.pl for creating the web pages. Very nice.

Up to now I just did minor changes and wrote a rrd subdirectory for a temperature and humidity sensor. Here the work was mainly in getting the output of this specific sensor which might not be of general interest. But if I manage to write a script for the Gridengine system I will leave a message here and can send an example. This might take some time as I'm busy with other projects right now.
21/11/2007, 14:34
Ok, thanks again for your comments !

I'll look at the logarithmic thing as soon as I'll get a little bit of time
13/02/2008, 11:18
Hello,
i installed your extension page comments in a website.
all is allright.
but i have noch idea how to display all comments and the form by default.
also not by using the link maybe "Comments"
is this possible
and when how?

many greeting

Ulrike
13/02/2008, 11:28
Hi,

Not really the page for a comment on this extension (this page is dedicated to the software eLuna Graph System), but no problemo


To display all comments and the form by default, you juste have to erase the default value of startCode (that is "LINK")

So in your template, put the line :

plugin.tx_elunapagecomments_pi1.startCode =

Clear all caches, and it will be ok

Hope it helps !
spirit,
20/02/2008, 02:13
Tout d'abord bravo pour ce super soft! Je cherchais une petite appli (je dis bien petite car j'ai testé les super usines telles que cacti, collectd, munin... ) pour monitorer mon serveur web et force est de constater que j'ai trouvé

Je vous écris ce message pour savoir si vous aviez enregistré des comportements étranges sur l'<Inbound Traffic>. En effet, j'ai essayé de copier un fichier de 700Mo de mon PC à mon serveur. ; le graphe ne monte pas au dessus de 100 k... alors que je devrais plutot avoir plusieurs Mo... des idées ?

Je pense ajouter qq "plugins" à la solution. Je les posterai ici quand je les aurai faits.

Merci!
20/02/2008, 09:11
Bonjour spirit et merci pour ton commentaire !

Pour l'<Inbound Traffic>, non, aucune idée... c'est bizarre : je l'utilise également sur un serveur local chez moi, et donc sur lequel les taux de transferts sont assez gros, et le <Inbound Traffic> est bien correct.

Pour les plugins, oui, n'hésite pas à les poster ici !

A bientôt donc
spirit,
20/02/2008, 13:06
Ah, en fait j'ai êut ête confondu. L'<Inbound Traffic> mesure en fait le nombre de bits sur l'interface. Ensuite rrdtool fait une moyenne sur les intervalles de temps et en déduit le nbr de bits par seconde. Du coup mon fichier de 700 Mo était chargé aux alentours de 90 Ko/s ce qui apparait comme tel sur le graphe. C'est bien ça que fait ce graphe ?

Si oui comment pourrait on avoir la quantité de donnée transférée ?
20/02/2008, 13:20
Ah oui, c'est tout à fait ça !

J'avais pas compris que tu ne parlais pas de ça, mais effectivement, c'est ce que ce graphe fait.

Pour ce qui est de la quantité de données transférées, tu l'as en fait : 90 Ko multiplié par la période de temps en secondes doit correspondre à 700 Mo ... je vois pas comment l'afficher autrement ? par une courbe qui monte en permanence ? pour avoir la quantité de données transférées depuis l'installation du soft ? Ca me semble moins judicieux
spirit,
20/02/2008, 13:48
Quelle rapidité de réponse . En fait je pense que ce que je souhaite faire ne peut être réalisé grâce à rrdtool. Ce que je voudrais idéalement c'est la quantité de données transférée par heure/jour voire mois et non la moyenne de bits par seconde. Possible avec rrdtools ?
20/02/2008, 15:15
Pour être tout à fait honnête, j'ai pas touché à RRDTool depuis un petit bout de temps...

Mais ceci dit, ce dont tu parles (la quantité de données transférée sur des périodes assez longues) aurait plus sa place dans un tableau récapitulatif que dans un graphe avec un axe de temps qui se veut continu non ? Sinon comment afficher ce types de données ? en extrapolant ? ce serait étrange...
spirit,
21/02/2008, 10:56
Non en effet, après vérification sur les mailing lists de rrd, c'est pas le top rrdtool pour afficher ce genre d'information (ce qui se comprend d'ailleurs). Je vais voir comment faire ça autrement. Merci pour le support en tout cas.
21/02/2008, 11:02
You're welcome
Shadow aok,
03/04/2008, 22:42
Bonjour,

Le calcul du traffic réseau est erroné au niveau de la génération du graphique.
Ex: Pour le traffic sortant, dans graph.pm
Il faut rajouter cette ligne après le DEF=
CDEF:outo=out,8,*
Et changer les 5 références suivantes à out en outo

Sinon le taux affiché ne correspond pas à la réalité (vérifié avec iptraf).
Il faut en faire de même pour le trafic entrant (avec in et ino)
03/04/2008, 22:54
Salut Shadow aok,

Merci pour ton feedback.

Il est bien marqué sur les graphiques du traffic réseau que c'est des bytes qui sont affichés, c'est à dire des octets. En multipliant par 8 tu obtiens des bits, et non des bytes (j'imagine que iptraf t'affiche lui des bits, mais ici, c'est bien des octets que je veux afficher).

Si tu conserve cette multiplication par 8, n'oublie pas de changer la légende de bytes à bits
Shadow aok,
03/04/2008, 23:03
Je poursuis avec le script d'affichage de la consommation de ressource.
N'ayant pas de dans mon /proc/meminfo sur gentoo, le calcul s'en retrouve faussé.
J'ai donc changé le calcul pour $mem de la façon suivante dans update.pl :
my $mem = ($total?100-(int(($memfree/$total)*100)):0);

(méthode reprise du calcul de la consommation de swap)
Shadow aok,
03/04/2008, 23:06
Autant pour moi, il s'agit bien de bits.
(Je me suis laissé avoir par l'interface réseau et par la bande passant de mon serveur qui sont à 100Mbits/s).

Je vais donc revenir en arrière
Shadow aok,
04/12/2008, 16:26
Quelqu'un a-t-il réussi à réaliser un graph de ping, façon smokeping ?
J'avais tenté de le faire il y a quelques temps mais j'obtenais toujours des erreurs, à cause du format numérique de la valeur renvoyée par ping en perl, me semble-t-il.

Merci.
12/02/2009, 21:19
Je t'avoue que depuis la création du soft j'ai pas retouché à RRDTool, je ne me souviens plus bien de ses subtilités d'utilisation

... essaye peut-être la documentation officielle : http://oss.oetiker.ch/rrdtool/doc/index.en.html
13/02/2009, 01:08
salut Steph,

j'ai finalement trouvé une solution qui fonctionne :
# rrdtool dump mysql_queries.rrd > aaa.xml
editer aaa.xml à la main pour enlever la valeur pic
# rrdtool restore aaa.xml mysql_queries.rrd
13/02/2009, 09:43
Merci du tuyau
Robert,
21/04/2009, 07:58
Bonjour,

Je suis en train de tester eLuna sur Ubuntu 8.10 sur x86_64 : très joli. J'ai un curieux problème sur Intrepid : on dirait qu'une commande cron n'est pas exécutée si on la fait précéder du nom de l'utilisateur ? il a fallu que je fasse sauter 'root' dans crontab pour que ça marche ? Ça aura été le seul ennui.
04/05/2009, 22:37
J'avais oublié de le faire... merci à toi pour cette super appli, facilement extensible! Après quelque tweaks divers et variés je suis arrivé à avoir un skin sympa et quelque mesures en plus -> http://www.statsdigger.com
04/05/2009, 22:59
Salut Robert, salut Spirit,

Merci à vous deux pour vos feedbacks.

@spirit : très sympa le skin en effet ... peux-tu m'envoyer par email ta source ? je serais intéressé par ajouter dans une prochaine version tes deux graphs sur MySQL. Merci d'avance
Benoit,
23/12/2009, 11:54
Bonjour,

J'ai implémenté les graphs apache_hits à partir des scripts donnés dans les commentaires. Mais j'ai eu quelques problèmes :
- dans la version proposée par matao il y a 3 ans, il manque le create.sh, le RRD doit être en ABSOLUTE et non pas en DERIVE comme la version de Steph, puisque dans la version de matao on ne traite que le nombre de connexions sur les 5 dernières minutes et non pas le total des connexions.
- c'est lent si les fichiers de logs sont gros.
- le filtre de logs par date n'est pas forcément correct suivant l'heure à laquelle c'est appelé.

Je propose donc la version suivante, utilisant grep :
$ cat ../08_apache_hits/create.sh
#!/bin/bash

rrdtool create apache_hits.rrd \
--start `date +%s` \
--step 300 \
DS:hits:ABSOLUTE:600:0:U \
RRA:AVERAGE:0.5:1:2016 \
RRA:AVERAGE:0.5:6:1344 \
RRA:AVERAGE:0.5:24:732 \
RRA:AVERAGE:0.5:144:1460

$ cat ../08_apache_hits/update.pl
#!/usr/bin/perl

$logpath="/var/log/apache2/pps.ipercom.lan-access_log";

$daten1 = `date -d 'now - 1 min' '+%d/%h/%Y:%H:%M'`;
$daten2 = `date -d 'now - 2 min' '+%d/%h/%Y:%H:%M'`;
$daten3 = `date -d 'now - 3 min' '+%d/%h/%Y:%H:%M'`;
$daten4 = `date -d 'now - 4 min' '+%d/%h/%Y:%H:%M'`;
$daten5 = `date -d 'now - 5 min' '+%d/%h/%Y:%H:%M'`;

chomp $daten1 ;
chomp $daten2 ;
chomp $daten3 ;
chomp $daten4 ;
chomp $daten5 ;

$nbhits = `grep -c -e $daten5 -e $daten4 -e $daten3 -e $daten2 -e $daten1 $logpath` ;

chomp $nbhits ;

system( "rrdtool update apache_hits.rrd -t hits N:$nbhits" );

$ cat graph.pm
$GRAPH_TITLES{'apache_hits'} = "{#server#} - Apache Hits";
$GRAPH_CMDS{'apache_hits'} = <<"AH_GRAPH_CMD";
--title "{#server#} - Apache Hits"
--vertical-label="Hits Per Minute"
--units-exponent 0
--lower-limit 0
DEF:hits={#path#}apache_hits.rrd:hits:AVERAGE
CDEF:hits_mn=hits,60,*
AREA:hits_mn{#color2#}:"Hits Per Minute "
GPRINT:hits_mn:LAST:"Current\\: %5.0lf "
GPRINT:hits_mn:AVERAGE:"Average\\: %5.0lf "
GPRINT:hits_mn:MAX:"Maximum\\: %5.0lf\n"
LINE1:hits_mn{#linecolor#}
AH_GRAPH_CMD

1; # Return true
Steph,
23/12/2009, 12:03
Merci pour ta contribution !
test,
05/05/2010, 17:19
only a test
05/05/2010, 18:03
@"test" : are you dumb enough not to see that it's a real website ? ... go make your tests elsewhere !
Justin,
30/05/2010, 05:25
For some reason the graphs are not showing up on my system. I get an image not found error, a little help would be appreciated!
Steph,
30/05/2010, 09:53
Well, maybe you can be a little more specific ?
Justin,
30/05/2010, 18:55
@steph I'm not too sure what kind of information you need to diagnose this issue, if you could let me know I will try my best to provide it.

Also when I try to run update.pl I get the following error:

eth0: error fetching interface information: Device not found
./update.sh: line 3: rrdtool: command not found
Error while trying to update RRD 'eth0_out'
eth0: error fetching interface information: Device not found
./update.sh: line 3: rrdtool: command not found
Error while trying to update RRD 'eth0_in'
./update.sh: line 9: rrdtool: command not found
Error while trying to update RRD 'process'

Could these two issues be connected?

Here's a screenshot of what I see: http://img85.imageshack.us/img85/4920/picture63s.png
Steph,
30/05/2010, 19:48
Well, I'm not 100% sure if it is connected or not, but for sure, you should start by correcting that !

... If update.pl doesn't work correctly, there's no sense of going further ^^

And so :

- Check that rrdtool is installed
- Check that the dir in which rdtool is installed is in the path

The strange thing is that you've got only errors for this 3 rrds ?

For the images, are they generated ?

If they are generated, (png files in the "graphs" directory), the problem come from web server rights.
Justin,
30/05/2010, 20:04
The "graphs" directory is empty and the images are not generating. I installed rrdtool without any issues and was able to create a test graph.

How can I "check that the dir in which rdtool is installed is in the path"?

Thanks for the help!
Steph,
30/05/2010, 20:16
... you must have a minimum knowledge of how your system works...

I don't really have the time to help you more sorry.

Juste check :

- Which user is executing update.pl
- Is this user can execute rrdtool without specifying the path ? If not, you must add the rrdtool directory (/usr/bin ?) to the user PATH variable

... For the rest google is your friend
Justin,
30/05/2010, 20:57
Thanks for all the help! I will continue to trouble shoot the problem and hopefully I can find a fix. You guys should make an auto install file for retards like me
Steph,
30/05/2010, 21:31
03/08/2010, 15:55
Hi! Thank you for adding this! I have heard a lot about eLuna Graph System but I have some problems and hence the question - How can I install eLuna having Ubuntu?
03/08/2010, 18:00
The standard installation procedure in the README file doesn't work for Ubuntu ?
Roy,
02/01/2011, 17:59
Hello,

Can some one give me an example of how to show used space on /home folder. I tried to cp and edit the 08_space folder. But I had no suc6.

Thanks
Steph,
02/01/2011, 22:35
Hello,

You may give more details. What did you try ?

The command used is :

df | grep /home

Does this command work on your system ?
Roy,
02/01/2011, 22:46
I tried:

$dummy = `df | grep /dev/sdb1\$`;
$dummy=~ /(.*) (.*)%/;

in update.pl.

The output of "df | grep /dev/sdb1" is:
/dev/sdb1 1.8T 123G 1.7T 7% /media/data_a

There is no plot in the graph. You can find all my files below.

create.sh:
#!/bin/bash

rrdtool create sdb1.rrd \
--start `date +%s` \
--step 300 \
DS:space:GAUGE:600:U:U \
RRA:AVERAGE:0.5:1:2016 \
RRA:AVERAGE:0.5:6:1344 \
RRA:AVERAGE:0.5:24:732 \
RRA:AVERAGE:0.5:144:1460

update.pl:
#!/bin/perl

$dummy = `df | grep /dev/sdb1\$`;
$dummy=~ /(.*) (.*)%/;

system("rrdtool update sdb1.rrd -t space N:$2");

graph.pm:
$GRAPH_TITLES{'sdb1'} = "{#server#} - Used Space On /media/data_a";
$GRAPH_CMDS{'sdb1'} = <<"SPACE_GRAPH_CMD";
--title "{#server#} - Used Space On /media_data_a"
--vertical-label="Percent"
--lower-limit 0 --upper-limit 100
DEF:space={#path#}sdb1.rrd:space:AVERAGE
AREA:space{#color2#}:"Used Space "
GPRINT:space:LAST:"Current\\: %3.0lf%% "
GPRINT:space:AVERAGE:"Average\\: %3.0lf%% "
GPRINT:space:MAX:"Maximum\\: %3.0lf%%\\n"
LINE1:space{#linecolor#}
SPACE_GRAPH_CMD

1; # Return true


Steph,
02/01/2011, 22:51
It seems that "/dev/sdb1 1.8T 123G 1.7T 7% /media/data_a" is not supposed to be the output of "df" command, but the output of "df -h" command.

"df | grep /home" on my system give :

"/dev/sda2 721075720 147186264 537549336 22% /home"

Sizes are in bytes, not in "human readable" format.

Hope it helps
Roy,
02/01/2011, 23:09
In my .bashrc was an alias for df with the -h option. I removed it. Now my output is. But still no good graph. What could be the problem?

df output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 29461480 3017476 24947428 11% /
none 1542208 264 1541944 1% /dev
none 1547808 284 1547524 1% /dev/shm
tmpfs 1547808 12 1547796 1% /tmp
none 1547808 676 1547132 1% /var/run
none 1547808 0 1547808 0% /var/lock
tmpfs 1547808 0 1547808 0% /var/tmp
/dev/sdb1 1922860900 192979372 1729881528 11% /media/data_a
/dev/sdc1 1922859912 200028 1922659884 1% /media/data_b
Roy,
02/01/2011, 23:11
df output with a grep

df | grep /media/data_a
/dev/sdb1 1922860900 205056396 1717804504 11% /media/data_a
Steph,
02/01/2011, 23:16
That should works fine... Without more details, I don't think I can help you.

Did you try to reinit it (by deleting the .rrd file) and wait for 10 minutes ? (two crontab tasks)
Roy,
02/01/2011, 23:20
yes i deleted the .rrd file. And waited for more then two crontabs. What information do you need to help me?

Thanks

Steph,
02/01/2011, 23:31
Well, I don't know... You should first try to replace system by print in the update.pl file, and then execute it to see if the command line is good.

It should be : rrdtool update sdb1.rrd -t space N:11
Roy,
02/01/2011, 23:40
Thanks for you help. I fixed the problem. I had an user:group rights problem. Now it is working good.
09/03/2011, 14:32
Minor fix in update.pl :
@@ -59,4 +59,4 @@
}
chdir('../../');
}
-chdir(origdir);
+chdir($origdir);
Steph,
09/03/2011, 15:30
Thanks!
12/07/2011, 17:33
Now this is a nice Comments Function!
A Page Browser would be nice.
It would be also nice to be able to hide the comments again.

www.test.de
Steph,
12/07/2011, 17:37
Thanks for your comment. It would be nice, indeed

... but please, this page is about eLuna Graph System, not about the comment extension!
21/03/2012, 15:26
Thanks!
Sebas,
04/05/2012, 15:51
merci
evok,
12/09/2012, 11:54
test of comments extension
Steph,
12/09/2012, 11:57
This page is NOT a test page for the comments extension, you moron!
Kuno,
13/12/2012, 19:58
Hey, super...!
Leave a comment

CAPTCHA image for SPAM prevention