[mrtg] Re: Newbie data analysis / script question
DANIEL MAGNUSZEWSKI
dmagnuszewski at mandtbank.com
Thu Jul 29 20:30:37 MEST 2004
Dan,
Pity has been taken:
<CODE>
#!/usr/bin/perl
# curl the data into a file (assuming the data you provided is the
format of
# the output of curl)
system("/usr/bin/curl http://url | grep \"Signal Strength\"
>/full/path/to/dishdatafile");
open FILE, "/full/path/to/dishdatafile" or die "Can't open
dishdatafile\n";
while (<FILE>)
{
if (/Signal Strength[\.]+[\s]([\d]+)/)
{
print "$1\n$1\nuptime\ndevice\n";
}
}
</CODE>
This *should* give you the following output:
80
80
uptime
device
I hope this helps.
Daniel Magnuszewski
CCNA
M & T Bank
dmagnuszewski at mandtbank.com
>>> "Dan Tappin" <dan.tappin at orourke-eng.com> 7/29/2004 12:56:55 PM
>>>
I have a system with a high speed satellite connection. The ISP
provides a handy local webpage with spits out various stats on the
system. A curl of the page results in a plain html page with following
data that I want to use via MRTG:
Signal Strength.............. 80 Stream Msg-Ackd/Nakd........
824997/34
Flags............... 0x00000020 NonStream Msg-Ackd/Nakd.....
4123/119
UpTime (d:h:m:s).. 001:14:53:52 Aloha Starts................
4123
The Sequencer Timeout........ 0 Ranging Starts.............. 0
Transport Alarm Bit.......... None Frames Received.............
12356891
Addresses Open............... 7 Frame Errors: CRC/Bad Key... 0/0
Carrier Info........ 091:W:1350 Miscellaneous Problems...... 1
Rate Code.................... 2 No Receive Outroute Lock.... 10
Inroute Group................ 5 No FLL Lock................. 237
Inroute...................... 13 No Network Timing Sync...... 56
For example I would like to plot 'Signal Strength' so I need to awk /
cut / grep / sed etc this file and spit out the required data
for MRTG in this case it would be: 80 80
The first part is easy:
curl http://myurl | grep "Signal Strength" which will get the line
containing my required data. From here I am lost.
Can someone please take pity on me and give me an example of a script
that can do this.
Thanks,
Dan
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list