Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Forum locked  This topic is locked, you cannot edit posts or make further replies.
Author Message
PostPosted: Wed Mar 16, 2005 2:05 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
By request of satyap, I've extended the bw-xml scriptto include more data.

Code:
http://www.linode.com/members/bw/?user=[linodeUsername]
http://www.linode.com/members/info/?user=[linodeUsername]

Since this is XML, the old /bw/ URL returns the identical data.

The http request must come from one of the IPs of [linodeUsername]. There is no access control other than this. If that's an issue, let me know.

Example Output:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<linData>
        <host>
                <host>host41.linode.com</host>
                <hostLoad>low</hostLoad>
                <pendingJobs>0</pendingJobs>
        </host>
        <upSince>2005-03-16 11:49:34</upSince>
        <cpuConsumption>0.01</cpuConsumption>
        <bwdata>
                <year>2005</year>
                <month>3</month>
                <max_avail>39728447488</max_avail>
                <rx_bytes>4692233</rx_bytes>
                <tx_bytes>2963967</tx_bytes>
                <total_bytes>7656200</total_bytes>
        </bwdata>
</linData>


Enjoy!
-Chris


Top
   
 Post subject:
PostPosted: Tue Jan 23, 2007 3:24 pm 
Offline
Junior Member

Joined: Sat Apr 30, 2005 3:38 am
Posts: 23
^bump^ only because this was mentioned on linode IRC and I had *no* clue it existed.


Top
   
 Post subject:
PostPosted: Wed Jan 24, 2007 12:46 am 
Offline
Senior Newbie

Joined: Mon Oct 27, 2003 5:33 pm
Posts: 17
Then I guess I'll remind folk about this:

http://forever.broked.net/~jason/bw.pl.txt

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:

http://www.linode.com/forums/viewtopic.php?t=776

-jbl


Top
   
 Post subject:
PostPosted: Wed Jan 24, 2007 2:08 am 
Offline
Senior Member
User avatar

Joined: Wed Jan 24, 2007 12:04 am
Posts: 90
Website: http://www.smiffysplace.com
Location: Rural South Australia
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.


Top
   
 Post subject:
PostPosted: Tue Jan 30, 2007 9:09 pm 
Offline
Senior Member
User avatar

Joined: Wed Jan 24, 2007 12:04 am
Posts: 90
Website: http://www.smiffysplace.com
Location: Rural South Australia
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:

Code:
<linData>
   <linode id='my-linode-id'>
       <host>
         <hostname>host65536.linode.com</hostname>
         <hostLoad>meltdown</hostLoad>
         <pendingJobs>0</pendingJobs>
       </host>     
       ...blah...
       ...blah...
       ...blah...
   </linode>
   <linode id='my-other-linode'>
      ....
   </linode>
</linData>


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.


Top
   
 Post subject:
PostPosted: Mon Dec 24, 2007 11:07 am 
Offline
Senior Newbie

Joined: Wed Nov 28, 2007 7:37 am
Posts: 5
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


Top
   
 Post subject:
PostPosted: Mon Dec 24, 2007 12:12 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
rick111 wrote:
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


All I really care about is network usage; don't want to go over! So for me the following in cron.daily is sufficient
Code:
#!/bin/bash

# Your linode user name
USER=xxxx

# Where to report mail
EMAIL=yyyy

URL="http://www.linode.com/members/bw/?user=$USER"

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
  echo Allowance: $max Mbytes
  echo Used: ${pct}%
} | /bin/mail -s "Linode bandwidth report" $EMAIL

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Tue Dec 25, 2007 8:14 am 
Offline
Senior Newbie

Joined: Wed Nov 28, 2007 7:37 am
Posts: 5
thanks man


Top
   
 Post subject:
PostPosted: Sat Dec 06, 2008 2:56 pm 
Offline
Senior Member

Joined: Wed Apr 11, 2007 8:23 pm
Posts: 76
Hey guys,

I had played with this script at points in the past (6+ months ago) and used the URL format:

Code:
http://www.linode.com/members/bw/?user=[linodeUsername]
http://www.linode.com/members/info/?user=[linodeUsername]


I recently decided to try playing with the XML script (mostly to make a gadget for my iGoogle Homepage) and found that I kept get access denied errors when trying to view it from a Linode IP.

After some poking around and with some help in the IRC channel, we figured out that you now need to use your Linode ID. This can be found on the Console tab of the Dashboard for the Linode you need information for. It will be in the format of:

Code:
ssh linode#####@locationXXX.linode.com


Your Linode ID is the "linode#####" part. For instance say you are on linode12345, you would put the following as your bandwidth URL:

Code:
http://www.linode.com/members/bw/?user=linode12345
http://www.linode.com/members/info/?user=linode12345


I suspect this was changed when Linode announced support for multiple Linodes on one account.

Thanks,
Smark


Top
   
 Post subject:
PostPosted: Thu Apr 30, 2009 1:16 pm 
Offline
Junior Member

Joined: Fri Dec 12, 2008 1:24 pm
Posts: 23
I'm trying to parse the xml output and noticed this:

Code:
<linData>
        ...etc...
        <upSince>2009-04-23 21:58:40.0</upSince>
        ...etc...
</linData>


What does the .0 at the end of the timestamp refer to?

I'm trying to parse it and I admit I've no idea what the .0 stands for? 40 seconds to the dot ...?


Top
   
 Post subject:
PostPosted: Thu Apr 30, 2009 2:28 pm 
Offline
Senior Member

Joined: Sat Feb 14, 2009 1:32 am
Posts: 123
smiffy wrote:
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.


I agree. I plan on using a separate host to monitor my servers on Linode using Nagios and other scripts. Sure would be nice to be able to obtain the information without having to traverse a Linode first.


Top
   
 Post subject:
PostPosted: Thu Apr 30, 2009 2:29 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
melz wrote:
What does the .0 at the end of the timestamp refer to?


That'd be 40.0 seconds past 21:58. The date/time library in use probably just throws that in there. Be glad it's not 40.000 ;-)


Top
   
 Post subject:
PostPosted: Thu Jul 16, 2009 7:17 pm 
Offline
Senior Member

Joined: Thu Apr 03, 2008 12:02 am
Posts: 103
AOL: derole
bw and info are the same nowadays ?


Top
   
 Post subject:
PostPosted: Fri Jul 17, 2009 10:59 am 
Offline
Senior Member

Joined: Sat Feb 14, 2009 1:32 am
Posts: 123
carmp3fan wrote:
smiffy wrote:
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.


I agree. I plan on using a separate host to monitor my servers on Linode using Nagios and other scripts. Sure would be nice to be able to obtain the information without having to traverse a Linode first.


Has there been any indication that this might be changed so that we can access the stats from outside of our Linodes? If so, when?


Top
   
 Post subject:
PostPosted: Fri Jul 17, 2009 11:21 am 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
The API is coming along which will replace this. Also, I'd appreciate it if people don't constantly poll this thing (like wiring it up to graphs and whatnot). That's kind of annoying, and you can do a better job of gathering stats and generating graphs from inside your Linode...

-Chris


Top
   
Display posts from previous:  Sort by  
Forum locked  This topic is locked, you cannot edit posts or make further replies.


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group