Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/network/ubiquiti_airos_
4 4
# Multigraph munin plugin to monitor Ubiquiti AirOS devices various parameters. It needs
5 5
# Perl's Net::Telnet or Net::OpenSSH to be able to connect.
6 6
#
7
# To use this plugin, copy it to the munin's plugin directory (eg. /usr/share/munin/plugins) 
7
# To use this plugin, copy it to the munin's plugin directory (eg. /usr/share/munin/plugins)
8 8
# under the name "ubiquiti_airos_". Don't change this filename! Follow these steps:
9 9
#
10 10
# 1. Give names to your devices, in fqdn style. Like "apo.wlan" or  "cli.wlan". To make the
......
53 53
#
54 54
# 5. Restart the munin node by 'service munin-node restart'.
55 55
#
56
#    If all went well, after 5 minutes or so you should have two additional nodes listed 
56
#    If all went well, after 5 minutes or so you should have two additional nodes listed
57 57
#    on the Web Interface of munin.
58 58
#
59
# To use the script with public keys authentication and no password, set env.NetMode SSHkey, and 
60
# create a pair of keys using command 'sudo ssh-keygen -t rsa'. This will generate in /root/.ssh 
61
# directory two files, id_rsa and id_rsa.pub. Upload id_rsa.pub to your Ubiquiti device using 
59
# To use the script with public keys authentication and no password, set env.NetMode SSHkey, and
60
# create a pair of keys using command 'sudo ssh-keygen -t rsa'. This will generate in /root/.ssh
61
# directory two files, id_rsa and id_rsa.pub. Upload id_rsa.pub to your Ubiquiti device using
62 62
# Services > SSH Server > Authorized Keys window. Try to log in to the device by command line
63 63
# first ('sudo ssh foobar@cli.wlan'), to save the RSA key fingerprint in the root account.
64 64
#
......
89 89
my $NetMode = $ENV{'NetMode'};
90 90
if ($NetMode =~ /Telnet/) {
91 91
  use Net::Telnet;
92
} 
92
}
93 93
elsif ($NetMode =~ /SSH/) {
94 94
  use Net::OpenSSH;
95 95
}
......
103 103
##############################################################################
104 104
## Define variables
105 105
my $graph_period = "second";
106
my ($load, $uptime, $ping_time, $packet_loss, $amc, $amq, $conn, $mt, $mf, $mb, $errlrcvd, $errltrans, $errwrcvd, $errwtrans, $ping_timelo, $packet_losslo); 
106
my ($load, $uptime, $ping_time, $packet_loss, $amc, $amq, $conn, $mt, $mf, $mb, $errlrcvd, $errltrans, $errwrcvd, $errwtrans, $ping_timelo, $packet_losslo);
107 107
my ($trflup, $trfldown, $trfwup, $trfwdown, $freq, $txccq, $acttimeout, $txsignal, $noisefloor, $txrate, $rxrate, $errnwid);
108 108
my ($errcrypt, $errfrag, $errretries, $errbmiss, $errother, $cpuuser, $cpusystem, $cpunice, $cpuidle, $cpuiowait, $cpuirq, $cpusoftirq);
109 109
$load = $uptime = $ping_time = $packet_loss = $amc = $amq = $conn = $mt = $mf = $mb = $errlrcvd = $errltrans = $errwrcvd = $errwtrans = $ping_timelo = $packet_losslo = "U";
......
454 454

  
455 455
elsif ($NetMode =~ /SSHPass/) {
456 456
  ## Initiate SSH Session using password authentication
457
  $SSH = Net::OpenSSH->new($Hostname, 
457
  $SSH = Net::OpenSSH->new($Hostname,
458 458
                           port => $Port,
459
                           user => $User, 
459
                           user => $User,
460 460
                           password => $Pass,
461 461
                           timeout => 10,
462 462
#                           master_stderr_discard => 1,
463 463
                           master_opts => [-o => "StrictHostKeyChecking=no"]);
464
  $SSH->error and 
464
  $SSH->error and
465 465
  #  warn "Couldn't establish SSH connection: " . $SSH->error;
466 466
    &printResults(); # Nothing happens, except printing undefined results to munin
467 467
}
468 468

  
469 469
elsif ($NetMode =~ /SSHKey/) {
470
  ## Initiate SSH Session using public key authentication  
470
  ## Initiate SSH Session using public key authentication
471 471
  $SSH = Net::OpenSSH->new($Hostname,
472 472
                           port => $Port,
473 473
                           user => $User,
......
666 666
$ping_timelo = ($1 / 1000) if ($pinglo =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
667 667
$packet_losslo = $1 if ($pinglo =~ /(\d+)% packet loss/);
668 668

  
669
chomp($load, $uptime, $ping_time, $packet_loss, $amc, $amq, $conn, $mt, $mf, $mb, $errlrcvd, $errltrans, $ping_timelo, $packet_losslo, 
670
	$errwrcvd, $errwtrans, $trflup, $trfldown, $trfwup, $trfwdown, $freq, $txccq, $acttimeout, $txsignal, 
669
chomp($load, $uptime, $ping_time, $packet_loss, $amc, $amq, $conn, $mt, $mf, $mb, $errlrcvd, $errltrans, $ping_timelo, $packet_losslo,
670
	$errwrcvd, $errwtrans, $trflup, $trfldown, $trfwup, $trfwdown, $freq, $txccq, $acttimeout, $txsignal,
671 671
	$noisefloor, $txrate, $rxrate, $errnwid, $errcrypt, $errfrag, $errretries, $errbmiss, $errother,
672 672
	$cpuuser, $cpusystem, $cpunice, $cpuidle, $cpuiowait, $cpuirq, $cpusoftirq);
673 673

  
......
688 688
  print "multigraph airos_ack\n";
689 689
  print "acttimeout.value " . $acttimeout . "\n";
690 690
  print "\n";
691
  
691

  
692 692
  print "multigraph airos_dbm\n";
693 693
  print "txsignal.value " . $txsignal . "\n";
694 694
  print "noisefloor.value " . $noisefloor . "\n";

Formats disponibles : Unified diff