Auteur Sujet: Plugin munin pour iperf3  (Lu 5988 fois)

0 Membres et 1 Invité sur ce sujet

vivien

  • Administrateur
  • *
  • Messages: 46 992
    • Twitter LaFibre.info
Plugin munin pour iperf3
« Réponse #12 le: 07 février 2020 à 21:56:48 »
J'ai un souci avec un plugin que j'ai crée, je n'arrive pas à avoir des logs pour comprendre pourquoi mon graphique reste vide...

J'ai un plugin capable de générer deux graphiquies :
- ln -s /usr/share/munin/plugins/ubuntu_support_ /etc/munin/plugins/ubuntu_support_total => Statistiques des versions d’Ubuntu
- ln -s /usr/share/munin/plugins/ubuntu_support_ /etc/munin/plugins/ubuntu_support_percent => Répartition des versions d’Ubuntu

Le script munin va chercher des données qui sont dans un fichier .csv "Open data" qui est mis à jour chaque matin.
#!/bin/bash
# License: GPLv2
# Author:  Vivien Guéant

FILE_STAT_NB=/home/ubuntu-archive/stats/open-data/consolidated_statistics_ubuntu-fr_nb.csv
FILE_STAT_PCT=/home/ubuntu-archive/stats/open-data/consolidated_statistics_ubuntu-fr_pct.csv

type=`cut -d "_" -f 2 <<< "$0"`
if [ "$1" == "config" ]
then
        if [ "$type" = "total" ]
        then # Separate computers
                cat <<'EOF'
graph_title Statistiques des versions d’Ubuntu
graph_vlabel Nombre d’ordinateurs distincts
graph_category ubuntu
graph_args --base 1000 --upper-limit 100 -l 0
support.label Utilisateurs de versions d'Ubuntu pris en charge
support.min 0
support.type DERIVE
support.draw AREA
end.label end bps
end.min 0
end.type DERIVE
end.draw STACK
total.label Total bps
total.min 0
total.type DERIVE
total.draw LINE1
EOF
        else # Percentage
                cat <<'EOF'
graph_scale no
graph_title Répartition des versions d’Ubuntu
graph_vlabel Pourcentage des ordinateurs utilisant Ubuntu
graph_category ubuntu
graph_args --upper-limit 100 -l 0 -r
support.label % versions d'Ubuntu pris en charge
support.min 0
support.draw AREA
end.label end %
end.min 0
end.draw STACK
EOF
        fi
else
        if [ "$type" = "total" ]
        then # Separate computers
                echo "support.value `tail -n 1 $FILE_STAT_NB | cut -d ',' -f 4 | cut -d '"' -f 2`"
                echo "end.value `tail -n 1 $FILE_STAT_NB | cut -d ',' -f 3 | cut -d '"' -f 2`"
                echo "total.value `tail -n 1 $FILE_STAT_NB | cut -d ',' -f 2 | cut -d '"' -f 2`"
        else # Percentage
echo "support.value `tail -n 1 $FILE_STAT_PCT | cut -d ',' -f 4 | cut -d '"' -f 2`"
echo "end.value `tail -n 1 $FILE_STAT_PCT | cut -d ',' -f 3 | cut -d '"' -f 2`"
        fi
fi

Quand j’exécute à la main mes script, j'ai bien les bonnes données :
$ sudo munin-run ubuntu_support_total
support.value 672014
end.value 187919
total.value 859933

$ sudo munin-run ubuntu_support_percent
support.value 78.147
end.value 21.852

Coté graphique,

Celui sur les données sans pourcentage reste vide sans que je comprenne pourquoi.


Ceui sur les pourcetage est ok :

hwti

  • Abonné Orange Fibre
  • *
  • Messages: 2 237
  • Chambly (60)
Plugin munin pour iperf3
« Réponse #13 le: 08 février 2020 à 00:06:32 »
Le --upper-limit 100 n'est pas bon, mais je ne sais pas si c'est ça qui casse aussi les statistiques en dessous du graphe (peut-être qu'il ignore les données hors de l'intervalle affiché).

vivien

  • Administrateur
  • *
  • Messages: 46 992
    • Twitter LaFibre.info
Plugin munin pour iperf3
« Réponse #14 le: 08 février 2020 à 10:27:03 »
Trouvé, c'est le "xxxxx.type DERIVE" qui fait la différence entre la valeur n et la valeur n-1.

Sans que je comprenne pourquoi, cela fonctionne bien avec graph_args --base 1000 --upper-limit 100 -l 0