File: getdisk.pl

package info (click to toggle)
mrtg 2.9.17-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,140 kB
  • ctags: 1,517
  • sloc: perl: 22,688; ansic: 3,536; sh: 1,309; makefile: 319; php: 227; awk: 213; csh: 49; exp: 16
file content (30 lines) | stat: -rw-r--r-- 741 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl
# This script is used to establish a TCP connection with a host to get the 
# disk info provided by showdisk.pl.
#
# use: ./getdisk.pl <hostname> <disk number>
#
# By Steven Micallef <smic@wire.net.au> on the 24/4/1999.
# Externale bug fixed by Alon Goldberg <pyro@elapsed.net> 27/2/2000.

use Net::Telnet;

$hostname = $ARGV[0];
$disk_no = $ARGV[1];

# If you've changed the port showdisk.pl runs on, change it here too.
$port = 9047;

$i = 0;

if (!defined($disk_no)) { print "Usage: $0 <hostname> <disk number>\n"; exit }

$t = new Net::Telnet ( Host => $hostname, Port => $port);
$t->open("$hostname");

while ($i ne $disk_no) {
  $data = $t->getline(Timeout => 40);
  $i++;
  print $data, 0, "\n" if $i eq $disk_no;
}