This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docpublic:reseaux:services:monitorix_custom [2020/04/21 16:24] procacci@tem-tsp.eu [RRD file for the module] |
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 manage | + | That's the purpose of this page to explain how I managed |
+ | |||
+ | I want to get In and Out traffic like that : | ||
+ | |||
+ | {{: | ||
Line 21: | Line 26: | ||
====== Custom device ====== | ====== Custom device ====== | ||
- | In this page I will demonstrate how I manage to monitor In and Out bandwith | + | In this page I will demonstrate how I manage to monitor In and Out bandwidth |
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 66: | Line 71: | ||
From the differents information provided by this web interface, | From the differents information provided by this web interface, | ||
- | ====== | + | ====== |
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' | 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' | ||
Line 72: | 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 : |
< | < | ||
Line 102: | Line 107: | ||
</ | </ | ||
- | ===== dev environement | + | ===== dev environment |
- | After you have check that monitorix | + | After you have checked |
< | < | ||
Line 116: | Line 121: | ||
</ | </ | ||
- | 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 |
- | this happens | + | this happens |
==== add module to monitorix.conf ==== | ==== add module to monitorix.conf ==== | ||
Line 132: | Line 137: | ||
url = http:// | url = http:// | ||
port = 80 | port = 80 | ||
- | rule = 24100 | ||
rigid = 0, 0, 0 | rigid = 0, 0, 0 | ||
limit = 100, 100, 100 | limit = 100, 100, 100 | ||
Line 165: | Line 169: | ||
</ | </ | ||
- | run it in debug mode to be ale to see potential errors | + | execute |
< | < | ||
- | # / | + | # / |
</ | </ | ||
Line 192: | Line 196: | ||
</ | </ | ||
- | 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 |
< | < | ||
Line 217: | Line 221: | ||
===== fbxcfr.pm | ===== fbxcfr.pm | ||
- | as explained earlier , I copied the nginx module to create mine fbxcfr module . I follows | + | as explained earlier , I copied the nginx module to create mine fbxcfr module . I followed |
==== Frame ==== | ==== Frame ==== | ||
Line 249: | Line 253: | ||
- | ==== collected values ===== | + | ==== collected values |
- | I change | + | I changed |
+ | < | ||
$reqs: | $reqs: | ||
+ | </ | ||
+ | |||
+ | from these only the 2 last ones (in/ | ||
+ | |||
+ | not to confused with the original values/ | ||
+ | |||
+ | here are the main changes I did : | ||
+ | |||
+ | < | ||
+ | sub fbxcfr_update { | ||
+ | ... | ||
+ | my $fbxcfr = $config-> | ||
+ | ... | ||
+ | my $in = 0; | ||
+ | my $out = 0; | ||
+ | my $din = 0; | ||
+ | my $dout = 0; | ||
+ | |||
+ | my $url; | ||
+ | |||
+ | if($fbxcfr-> | ||
+ | $url = $fbxcfr-> | ||
+ | } else { | ||
+ | $url = " | ||
+ | } | ||
+ | ... | ||
+ | # | ||
+ | #get line starting with 2 spaces then WAN string and match the 2 digit (\d+) values before string ko/s | ||
+ | if(/ | ||
+ | $din = $1; #print "din: $din\n"; | ||
+ | $dout = $2; #print "dout: $dout\n"; | ||
+ | $din *= 1024; | ||
+ | $dout *= 1024; | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | ... | ||
+ | |||
+ | sub fbxcfr_cgi { | ||
+ | ... | ||
+ | push(@output, | ||
+ | push(@output, | ||
+ | } | ||
+ | # comment out everything related to request , total, reads, writes , wait from the nginx values around line 387 | ||
+ | | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | ... | ||
+ | @riglim = @{setup_riglim($rigid[2], | ||
+ | undef(@tmp); | ||
+ | undef(@tmpz); | ||
+ | undef(@CDEF); | ||
+ | =END | ||
+ | =cut | ||
+ | # end comment up until around line 626 (quite long !) | ||
+ | |||
+ | # to begin with our In and Out values to graph | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmp, " | ||
+ | push(@tmpz, " | ||
+ | push(@tmpz, " | ||
+ | push(@tmpz, " | ||
+ | push(@tmpz, " | ||
+ | push(@tmpz, " | ||
+ | push(@tmpz, " | ||
+ | ... | ||
+ | return @output; | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | </ | ||
+ | |||
+ | ==== fbxcfr.pm file ==== | ||
+ | |||
+ | here is the full module file (unzip to get the .pm ) | ||
+ | |||
+ | {{: | ||
- | from these only the last ones are of interest to me | + | |
+ | ==== image result zoom ==== | ||
+ | {{: | ||