1. Vous êtes ici :  
  2. Accueil
  3. Supervision

  • Accueil
  • Linux
    • Installation Webmin sur Centos
    • Installation de phpmyadmin sur Centos
  • Poste de travail Linux
    • Linux Mint 17.2
    • Remmina
    • Installation des Fontes Windows
    • Mise à jour Remmina
    • Installation Dell C1760nw
    • Partage réseau
  • Virtualisation
    • Installation VirtualBox sur Windows
    • Installation vmware player sur Windows
    • Installation de Centos 6.3
    • Upgrade Centos 6.3 vers 6.4
    • Installation Centos 6.4
    • Clonage de VM Centos
    • Utilisation de Gparted
    • Installation Centos 7.0
    • VirtualBox 5.0
    • VirtualBox 5.0 LinuxMint 17.2
    • Travail sur LVM
    • Installation Rocky Linux 8.5
    • Installation AlmaLinux 8.5
  • MySql
    • Réplication Maître/Maître avec phpmyadmin
    • Réplication Maître/Maître en ligne de commande
    • MySQL Workbench
    • Mysql Workbench : Utilisation
  • Supervision
    • Installation EON 3.1
    • Customisation EON 3.1
    • Installation EON V5.3
    • Scripts pour Freebox
    • Freebox Revolution sur Cacti : les bases
    • Freebox Revolution sur Cacti : méthode simple
    • Freebox Revolution sur Cacti : méthode complète
  • Hp Microserver Gen8
    • Introduction
    • Spécifications
    • Upgrade de mémoire
    • Upgrade processeur
    • Carte Raid P222
Freebox Revolution sur Cacti méthode simple

1 - Préambule

Nous allons maintenant détaillé la méthode pour grapher les valeurs du swich en émission.

2 - Script d'interrogation

Le script utilisé est le suivant : freeboxv6_adsl_api_switch_output.sh

#!/bin/sh
app_token=`grep "app_token" "/tmp/post_authorize.log" | cut -f 4 -d ':' | cut -f 1 -d ','| sed 's/\\\//g' |sed "s/\"//g"| sed "s/\r//g" | sed "s/\n//g"` 
curl -H "Content-type: application/json" -X GET http://mafreebox.freebox.fr/api/v1/login/>/tmp/challenge.log 2>/dev/null
challenge=`grep "challenge" "/tmp/challenge.log" | cut -f 5 -d ':' | cut -f 1 -d ','| sed 's/\\\//g' |sed "s/\"//g"| sed "s/\r//g" | sed "s/\n//g"` 
password=`echo -n $challenge | openssl dgst -sha1 -hmac $app_token`
curl -i -H "Content-type: application/json" -X POST http://mafreebox.freebox.fr/api/v1/login/session/ -d '
{
   "app_id": "fr.prestaopen.cacti",
   "password": "'$password'"
}    '>/tmp/session_token.log 2>/dev/null
session_token=`grep "session_token" "/tmp/session_token.log" | cut -f 3 -d ':' | cut -f 1 -d ','| sed 's/\\\//g' |sed "s/\"//g"| sed "s/\r//g" | sed "s/\n//g"` 
		curl -i  -X POST http://mafreebox.freebox.fr/api/v1/rrd/ -H "X-Fbx-App-Auth: $session_token" -d '
{
   "db": "switch",
   "fields": [ "tx_1" ],
   "precision": 1
}    '> /tmp/switch_tx_1.log 2>/dev/null
switch_tx_1=`cat /tmp/switch_tx_1.log | grep -oE "[^{]+$"| grep -oE ',".*,' | sed -n 's/\([^{]*:\)\([^,]*\),.*/\2/p' | sed 's/.\{2\}$//'`
		curl -i  -X POST http://mafreebox.freebox.fr/api/v1/rrd/ -H "X-Fbx-App-Auth: $session_token" -d '
{
   "db": "switch",
   "fields": [ "tx_2" ],
   "precision": 1
}    '> /tmp/switch_tx_2.log 2>/dev/null
switch_tx_2=`cat /tmp/switch_tx_2.log | grep -oE "[^{]+$"| grep -oE '":.*,' | sed -n 's/\([^:]*:\)\([^,]*\),.*/\2/p'`
		curl -i  -X POST http://mafreebox.freebox.fr/api/v1/rrd/ -H "X-Fbx-App-Auth: $session_token" -d '
{
   "db": "switch",
   "fields": [ "tx_3" ],
   "precision": 1
}    '> /tmp/switch_tx_3.log 2>/dev/null
switch_tx_3=`cat /tmp/switch_tx_3.log | grep -oE "[^{]+$"| grep -oE '":.*,' | sed -n 's/\([^:]*:\)\([^,]*\),.*/\2/p'`
		curl -i  -X POST http://mafreebox.freebox.fr/api/v1/rrd/ -H "X-Fbx-App-Auth: $session_token" -d '
{
   "db": "switch",
   "fields": [ "tx_4" ],
   "precision": 1
}    '> /tmp/switch_tx_4.log 2>/dev/null
switch_tx_4=`cat /tmp/switch_tx_4.log | grep -oE "[^{]+$"| grep -oE ',".*,' | sed -n 's/\([^{]*:\)\([^,]*\),.*/\2/p' | sed 's/.\{2\}$//'`
 printf "switch_tx_1:%s switch_tx_2:%s switch_tx_3:%s switch_tx_4:%s \n" $switch_tx_1 $switch_tx_2 $switch_tx_3 $switch_tx_4 ;

Toutes les 5 minutes, nous récupérons la dernière valeur pour chaque port du switch.

3 - Data Input Method

Data Input Method

 switch_tx_1

switch_tx_2

switch_tx_3

switch_tx_4

4 - Data Template

Data Template

tx_1

tx_2

tx_3

tx_4

5 - Graph Template

Graph Template

Graph Template Items

Nous allons voir en détail les items 9 à 12.

Item 9

Item 10

Item 11

Item 12

Pour les autres items, il faut se servir des écrans ci-dessus.

6 - Résultat

Après avoir assigné ce template à la Freebox, nous obtenons ceci :

Graphique données en émission

Si l'on regarde les graphiques affichés sur mafreebox.freebox.fr :

Port 3 en émission :

Port 3 en émission

Port 4 en émission :

Port 4 en émission

On voit que la tendance des courbes est la mais la précision n'y est pas.

Ce résultat imparfait vient du fait que le script ne garde que la dernière valeur fournie par l'API.

Nous allons voir comment utiliser toutes les valeurs fournies par l'API dans l'article suivant.

Page 6 sur 7

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

PrestaOpen
  • Basé sur template Learn Mate de Joomlead
  • Email: demo@joomlead.com

© 2025 Edu Joomla 4 Template. All rights reserved.