mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
small bug fixed in v1.1
This commit is contained in:
parent
d3c0b24204
commit
5d5cb34f1e
@ -1,16 +1,17 @@
|
||||
#!/usr/bin/php
|
||||
#!/bin/bash
|
||||
<?php
|
||||
|
||||
# plugin made by Dju
|
||||
# v1.1
|
||||
# allows to monitor the mirrors number and bandwidth from Launchpad for a specific country
|
||||
# saves the results in cache and connects to launchpad website every 3 hours
|
||||
# the country constant it=s the name of he country, as it appears on the launchpad page (bold, on a gray background)
|
||||
|
||||
define( 'URL', 'https://launchpad.net/ubuntu/+cdmirrors' );
|
||||
define( 'CACHE_FILE', '/var/lib/munin/plugin-state/ubuntu_mirrors.txt' );
|
||||
define( 'CACHE_FILE', 'ubuntu_mirrors.txt' );
|
||||
define( 'CACHE_UPTIME', 3 );
|
||||
define( 'COUNTRY', 'France' );
|
||||
|
||||
|
||||
function find_and_short( $str, &$html, $with_str=true )
|
||||
{
|
||||
$pos = strpos( $html, $str );
|
||||
@ -80,11 +81,12 @@ try
|
||||
}
|
||||
|
||||
if( isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] != '' ) {
|
||||
$arg = $_SERVER['argv'][1];
|
||||
if( $arg == 'autoconf' ) {
|
||||
switch( $_SERVER['argv'][1] ) {
|
||||
case 'autoconf':
|
||||
echo "yes\n";
|
||||
exit( 0 );
|
||||
} elseif( $arg == 'config' ) {
|
||||
break;
|
||||
case 'config':
|
||||
echo "graph_title Ubuntu Mirrors in ".COUNTRY."\n";
|
||||
echo "graph_category Ubuntu\n";
|
||||
echo "graph_args --base 1000 -l 0\n";
|
||||
@ -97,7 +99,8 @@ try
|
||||
$bwUnit = ( $CACHE == false ) ? '' : ' in '.$BW_UNIT;
|
||||
echo "bw.label Bandwidth".$bwUnit."\n";
|
||||
exit( 0 );
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
echo "Unknown arg: ".$arg."\n";
|
||||
exit( 2 );
|
||||
}
|
||||
@ -108,8 +111,8 @@ try
|
||||
set_cache( $MIRRORS, $BW_RATE, $BW_UNIT );
|
||||
}
|
||||
|
||||
echo "nbm.value $mirrors\n";
|
||||
echo "bw.value $bw\n";
|
||||
echo "nbm.value ".$MIRRORS."\n";
|
||||
echo "bw.value ".$BW_RATE."\n";
|
||||
exit( 0 );
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user