Skip to main content
BlogLinodeStatistiques Linode récupérables par HTTP (en XML)

Statistiques Linode récupérables par HTTP (en XML)

À la demande de satyap, j'ai étendu le script [url=]bw-xml [/url]pour inclure plus de données.

Comme il s'agit de XML, l'ancienne URL /bw/ renvoie les mêmes données.

La requête http doit provenir d'une des IP de [linodeUsername]. Il n'y a pas d'autre contrôle d'accès. Si cela pose un problème, faites-le moi savoir.

Example Output:
[code]<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<upSince>2005-03-16 11:49:34</upSince>

Profitez-en !

Commentaires (7)

  1. Author Photo

    ^bump^ only because this was mentioned on linode IRC and I had *no* clue it existed.

  2. Author Photo

    Then I guess I’ll remind folk about this:

    It’s what I had in mind when I (others?) asked caker for bandwidth utilization figures via XML. I just did a quick update to fix a couple of bugs, change requested URL to /info from /bw and parse/print out parent host/load figures.

    Original post on this is located at:


  3. Author Photo

    How about an alternative, losing the user=, running it through https, with basic authentication, and picking the user name up from there.

    The idea being that I can pick it up from my local machines rather than having to have the extra hop of going through my Linode.

  4. Author Photo

    Just looking at the output – should host be nested in host?

    Also, thinking to the future when we can have more than one Linode per account, maybe it should be something like:

    <linode id=’my-linode-id’>
    <linode id=’my-other-linode’>

    Having the <linode/> element here and now would help with amalgamating data from several hosts.

    I am going to get the data from each host, then fire them back to my office server, which will aggregate, store and alert me about anything nasty that might be going on.

  5. Author Photo

    what do you guys use this for? I’ve got it ouputting the data to stats.php but not really finding it useful?

    Cheers lads
    have a good one

  6. Author Photo

    [quote:83000eaf58=”rick111″]what do you guys use this for? I’ve got it ouputting the data to stats.php but not really finding it useful?

    Cheers lads
    have a good one[/quote]

    All I really care about is network usage; don’t want to go over! So for me the following in cron.daily is sufficient

    # Your linode user name

    # Where to report mail


    data=$(lynx –dump $URL)

    year=${data#*\<year\>} ; year=${year%%\<*}
    month=${data#*\<month\>} ; month=${month%%\<*}
    max=${data#*\<max_avail\>} ; max=${max%%\<*}
    tx=${data#*\<tx_bytes\>}; tx=${tx%%\<*}
    rx=${data#*\<rx_bytes\>}; rx=${rx%%\<*}
    total=${data#*\<total_bytes\>}; total=${total%%\<*}

    let pct=100*total/max

    let tx=tx/1048576
    let rx=rx/1048576
    let total=total/1048576
    let max=max/1048576

    echo Report for $year/$month
    echo Transmitted: $tx Mbytes
    echo Received: $rx Mbytes
    echo Total: $total Mbytes
    echo Allowance: $max Mbytes
    echo Used: ${pct}%
    } | /bin/mail -s "Linode bandwidth report" $EMAIL

  7. Author Photo

Laissez un commentaire

Votre adresse électronique ne sera pas publiée. Les champs obligatoires sont marqués d'un *.