Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docpublic:reseaux:services:monitorix_custom [2020/04/21 16:54]
procacci@tem-tsp.eu [Custom Monitor]
docpublic:reseaux:services:monitorix_custom [2020/04/23 10:35] (current)
procacci@tem-tsp.eu
Line 10: Line 10:
 you may have to monitor a special device or application that is not yet integrated .  you may have to monitor a special device or application that is not yet integrated . 
  
-That's the purpose of this page to explain how I managed to monitor my personnal gateway to the Internet which doesn't have builtin graph capabilities .  +That's the purpose of this page to explain how I managed to monitor my personal gateway to the Internet which doesn't have builtin graph capabilities .  
  
-I want to get In and Out trafic like that : +I want to get In and Out traffic like that : 
  
 {{:docpublic:reseaux:services:monitorix-fbxcfr-jp.png|}} {{:docpublic:reseaux:services:monitorix-fbxcfr-jp.png|}}
Line 26: Line 26:
 ====== Custom device ====== ====== Custom device ======
  
-In this page I will demonstrate how I manage to monitor In and Out bandwith usage of my FreeBox-Crystal which is a French ADSL router .+In this page I will demonstrate how I manage to monitor In and Out bandwidth usage of my FreeBox-Crystal which is a French ADSL router .
 The device does provide an http service to get the status of its services . The device does provide an http service to get the status of its services .
 it replies on the Lan interface at the address of the router itself  it replies on the Lan interface at the address of the router itself 
Line 71: Line 71:
 From the differents information provided by this web interface,  the ones I want to graph is on the WAN interface the In trafic (here 63 Ko/s) and Out (9 ko/s)  From the differents information provided by this web interface,  the ones I want to graph is on the WAN interface the In trafic (here 63 Ko/s) and Out (9 ko/s) 
  
-====== custom module ======+====== Custom module ======
  
 I am not a monitorix developer , but with great and smart indication from Monitorix developers , as there is no generic module nor snmp capailities (anyway my Freebox doesn't provide such) , I was advise to create my own module based on an existing one that already collect and graph values from an http request . The Nginx module was my  starting point .  I am not a monitorix developer , but with great and smart indication from Monitorix developers , as there is no generic module nor snmp capailities (anyway my Freebox doesn't provide such) , I was advise to create my own module based on an existing one that already collect and graph values from an http request . The Nginx module was my  starting point . 
Line 77: Line 77:
 ===== copy nginx ===== ===== copy nginx =====
  
-you can check location of all the monitorix components by requesting file location of tha monitorix package with : +you can check location of all the monitorix components by requesting file location of the monitorix package with : 
  
 <code> <code>
Line 107: Line 107:
 </code> </code>
  
-===== dev environement =====+===== dev environment =====
  
-After you have check that monitorix work fine with native modules, to help debuging , I removed all modules from the main config file : monitorix.conf in order that logs shows only potential problem of my specific module here named fbxcfr (just after nginx) . +After you have checked that monitorix works fine with native modules, to help debugging , I disabled all modules from the main config file : monitorix.conf in order that logs shows only potential problem of my specific module here named fbxcfr (just after nginx) . 
  
 <code> <code>
Line 121: Line 121:
 </code> </code>
        
-duplicate all nginx parameters in the conf file to fbxcfr (or whatever name you give to your module) so that your module is taken into account by the monitorix daemon . +duplicate almost all nginx parameters in the conf file to fbxcfr (or whatever name you give to your module) so that your module is taken into account by the monitorix daemon . 
-this happens if different sections: //graph_enable, graph_name, graph_title and graphs//+this happens in different sections: //graph_enable, graph_name, graph_title and graphs//
  
 ==== add module to monitorix.conf ==== ==== add module to monitorix.conf ====
Line 137: Line 137:
         url = http://192.168.3.254/pub/fbx_info.txt         url = http://192.168.3.254/pub/fbx_info.txt
         port = 80         port = 80
-        rule = 24100 
         rigid = 0, 0, 0         rigid = 0, 0, 0
         limit = 100, 100, 100         limit = 100, 100, 100
Line 170: Line 169:
 </code> </code>
  
-run it in debug mode to be ale to see potential errors+execute it in debug and foreground mode to be able to see potential errors
  
 <code> <code>
-# /usr/bin/monitorix -c /etc/monitorix/monitorix.conf -p /run/monitorix.pid -d all+# /usr/bin/monitorix -c /etc/monitorix/monitorix.conf --d all
 </code> </code>
  
Line 197: Line 196:
 </code> </code>
  
-then after few second (at next minute) , here comes my two values In and Out inserted in the rrd file+then after few second (at next minute) , here comes my two values (converted to bytes)  In and Out inserted in the rrd file
  
 <code> <code>
Line 222: Line 221:
 ===== fbxcfr.pm  module code ===== ===== fbxcfr.pm  module code =====
  
-as explained earlier , I copied the nginx module to create mine fbxcfr module . I follows the same process of fetching a URL and parse it to collect interesting values to graph .+as explained earlier , I copied the nginx module to create mine fbxcfr module . I followed the same process of fetching a URL and parse it to collect interesting values to graph .
  
 ==== Frame ==== ==== Frame ====
Line 256: Line 255:
 ==== collected values code ===== ==== collected values code =====
  
-change a few lines in the code (a dozen ) and commented many . Indeed the nginx module collect all these :+changed a few lines in the code (a dozen ) and commented many . Indeed the nginx module collect all these :
  
 <code> <code>
Line 344: Line 343:
 ==== fbxcfr.pm file ==== ==== fbxcfr.pm file ====
  
-here is the full module file (zunip to get the .pm ) +here is the full module file (unzip to get the .pm ) 
  
 {{:docpublic:reseaux:services:fbxcfr.pm.zip|}} {{:docpublic:reseaux:services:fbxcfr.pm.zip|}}
docpublic/reseaux/services/monitorix_custom.1587488080.txt.gz · Last modified: 2020/04/21 16:54 by procacci@tem-tsp.eu
[unknown link type]Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0