Thread snmpwalk: output verwenden.... (16 answers)
Opened by cheggler at 2005-05-16 13:58

renee
 2005-05-17 13:56
#54983 #54983
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
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
#! /usr/bin/perl

use strict;
use warnings;
use Chart::Plot;

my @infos;

my $result = qx{snmpwalk -v 1 -c public <ip-address> ifLastChange};
my @lines = split(/\n/,$result);

for my $line(@lines){
  my ($port) = $line =~ /ifLastChange\.(\d+)/;
  my ($time) = $line =~ /Timeticks:\s\((\d+)\)/;
  push(@infos,$port,$time);
}

#--
#  create a chart
#--

my $chart = Chart::Plot->new();
$chart->setData(\@infos);

my $output = '/sandia/vol0/home/cheggler/test.gif';
open(GIF,">$output") or die $!;
binmode GIF;
print GIF $chart->draw('gif');
close GIF;
\n\n

<!--EDIT|renee|1116323973-->
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread snmpwalk: output verwenden....