Community discussions

MikroTik App
 
garabed
just joined
Topic Author
Posts: 7
Joined: Thu Aug 11, 2011 3:05 am

mikrotikwirelessinterface_ and Munin

Thu Aug 18, 2011 10:31 pm

I am attempting to monitor my devices with Munin and the mikrotikwirelessinterface_ script. I keep getting warning alerts (100 for the day now!) that the txccq has dropped to 0.0. I am looking for some assistance if anyone has seen this issue, or may be able to point me in the right direction.


#!/usr/bin/perl
###############################################################################
use diagnostics;
use Net::Telnet::Cisco;
use strict;
use warnings;
##############################################################################
my $TelnetPort = "23";
my $TelnetUser = "xx";
my $TelnetPass = "xxxx";

###############################################################################
## Determine Hostname
my $Host = undef;
$0 =~ /mwi_(.+)*$/;
unless ($Host = $1) {
exit 2;
}

###############################################################################
## Initiate Telnet Session
my $MT = Net::Telnet::Cisco->new(Host => $Host,
Port => $TelnetPort,
Prompt => '/[\>\#] $/',
Timeout => 50);

###############################################################################
## Configuration
if ($ARGV[0] && $ARGV[0] eq "config") {
print "host_name " . $Host . "\n";
print "graph_args -l 0 --lower-limit -100 --upper-limit 100\n";
print "graph_title Wireless Interface Quality (MACAddress)\n";
print "graph_vlabel Comms Quality\n";
print "graph_category network\n";
print "graph_info This graph shows the wireless interface statistics\n";
print "graph_order txccq rxccq txsignal txrate rxrate acttimeout noisefloor\n";
print "txccq.warning 40:\n";
print "rxccq.warning 40:\n";

print "graph_scale no\n";
print "txccq.label TX CCQ (%)\n";
print "rxccq.label RX CCQ (%)\n";
print "txsignal.label TX Signal Strength (dBm)\n";
print "acttimeout.label ACT Timeout (us)\n";
print "noisefloor.label Noise Floor (dBm)\n";
print "txrate.label TX Rate (Mbps)\n";
print "rxrate.label RX Rate (Mbps)\n";

exit;
}

###############################################################################
## Execution
if (!defined($MT->login($TelnetUser . "+ct", $TelnetPass))) {
die "Croaking: $MT->error";
} else {
my @Output = $MT->cmd("/interface wireless monitor 0 once\nD\n");
my ($rest, $tmp, $txccq, $rxccq, $txsignal, $stn, $otxccq, $acttimeout, $noisefloor, $txrate, $rxrate) = undef;
foreach my $Line (@Output) {
if (($Line =~ /tx-ccq/ && $Line !~ /overall-tx-ccq/) && $Line =~ m/(\d+)/) {
$txccq = $1;
}
if ($Line =~ /rx-ccq/ && $Line =~ m/(\d+)/) {
$rxccq = $1;
}
if ($Line =~ /tx-signal-strength/ && $Line =~ m/(.\d+)/) {
$txsignal = $1;
}
if ($Line =~ /current-ack-timeout/ && $Line =~ m/(.\d+)/) {
$acttimeout = $1;
}
if ($Line =~ /noise-floor/ && $Line =~ m/(.\d+)/) {
$noisefloor = $1;
}
if ($Line =~ /tx-rate/ && $Line =~ m/(\d+)/) {
$txrate = $1;
}
if ($Line =~ /rx-rate/ && $Line =~ m/(\d+)/) {
$rxrate = $1;
}
}
print "txccq.value " . $txccq . "\n";
print "rxccq.value " . $rxccq . "\n";
print "txsignal.value " . $txsignal . "\n";
print "acttimeout.value " . $acttimeout . "\n";
print "noisefloor.value " . $noisefloor . "\n";
print "txrate.value " . $txrate . "\n";
print "rxrate.value " . $rxrate . "\n";
exit;


}
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: mikrotikwirelessinterface_ and Munin

Fri Aug 19, 2011 11:15 am

telnet is all sweet and nice, but i would suggest you to use Application Programmable Interface as that is made for use by applications, in short - API

http://wiki.mikrotik.com/wiki/API

and can use perl to get to ROS using API and then, get the values you want to get.
 
garabed
just joined
Topic Author
Posts: 7
Joined: Thu Aug 11, 2011 3:05 am

Re: mikrotikwirelessinterface_ and Munin

Mon Aug 22, 2011 11:13 pm

Thank you, I correct the issue temporarily by adjusting the time out in munin-node.
 
garabed
just joined
Topic Author
Posts: 7
Joined: Thu Aug 11, 2011 3:05 am

Re: mikrotikwirelessinterface_ and Munin

Tue Aug 23, 2011 1:26 am

If I use the API I will only be able to get values that are available via SNMP correct? I am attempting to get CCQ values which from all the information I have been able to gather is not available via SNMP.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: mikrotikwirelessinterface_ and Munin

Thu Sep 08, 2011 3:39 pm

using API you can get everything that is in CLI. At the moment CLI provides a lot more information that SNMP.

/interface/wireless/print

/interface/wireless/monitor
=name=<interface-name>

also, commands you executed through the perl -> telnet can be executed. maybe needs minor adjustments to comply with API spec.

Who is online

Users browsing this forum: No registered users and 41 guests