X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=web%2Ftempfetch.pl;h=0a25bc55c815f1b43aedb3bac084be05a8964c63;hb=065361daac62b4cdb33cf19caa534e29ac1dfde0;hp=542b4d67786111cddd58a575d1f85f7bac88ebd0;hpb=9180f8278b332f8eb6c65a11d6f284f5facf6722;p=nms diff --git a/web/tempfetch.pl b/web/tempfetch.pl index 542b4d6..0a25bc5 100644 --- a/web/tempfetch.pl +++ b/web/tempfetch.pl @@ -72,7 +72,7 @@ while (1) { if (!defined($conn)) { print "Could not connect to switch ".$switch->{'switch'}."\n"; } - my @data = switch_exec('sys monitor status', $conn); + my @data = nms::switch_exec('sys monitor status', $conn); my @fields = split(/\s+/, $data[2]); # The temp fields are 6, 7, 8 my $avgtemp = ($fields[6] + $fields[7] + $fields[8]) / 3; @@ -90,21 +90,6 @@ while (1) { $dbh->commit; } -sub switch_exec { - my ($cmd, $conn) = @_; - - # Send the command and get data from switch - my @data = $conn->cmd($cmd); - my @lines = (); - foreach my $line (@data) { - # Remove escape-7 sequence - $line =~ s/\x1b\x37//g; - push (@lines, $line); - } - - return @lines; -} - sub mylog { my $msg = shift; my $time = POSIX::ctime(time);