As you probably already know, the CCQ value is not available via SNMP (AirOS 5.5.2), but of course it doesn’t mean it can’t be graphed using Cacti. To graph CCQ on Ubiquiti devices, you just need to use a simple script to read the desired value using the web interface.
First step
Create a read-only user with a password on Ubiquiti devices. This step is important for security reasons as it will be used in the script to read CCQ value.
Second step
Create ubiquiti_ccq.pl script in cacti scripts directory and replace USER and PASS with values defined in the previous step.
#!/usr/bin/perl
use strict;
#use warnings;
use LWP::UserAgent;
use HTTP::Cookies;
use JSON;
if (($#ARGV+1) ne 1) {
exit();
}
my $host = $ARGV[0];
my $cookie_jar = HTTP::Cookies->new();
my $browser = LWP::UserAgent->new();
my $response = '';
my $json = JSON->new();
$browser->cookie_jar($cookie_jar);
$response = $browser->get(
"https://${host}/login.cgi"
);
$response = $browser->post(
"https://${host}/login.cgi",
Content_Type => 'form-data',
Content => [
username => 'USER',
password => 'PASS',
],
);
$response = $browser->get(
"https://${host}/120816.1338/status.cgi"
);
print ($json->decode($response->content)->{wireless}->{ccq}/10 . "\n");
The script above will print the CCQ value:
$ perl ubiquiti_ccq.pl 1.2.3.4
98.4
Third step
Create a data input method as specified below.
Fourth step
Create a data template, as specified below.
Fifth step
Create a graph template, as specified below.
Sixth step
Create a new graph for the desired device.
Data will be gathered, stored, and graphed over time.
Notes – CCQ on Ubiquiti devices
If you want to graph different values, then look at the status.cgi file contents and modify the script accordingly.
{ "host": {
"uptime": 99289223,
"time": "2012-12-10 22:59:43",
"fwversion": "v5.5.2",
"hostname": "Home1",
"netrole": "bridge"
},
"wireless": {
"mode": "ap",
"essid": "Look! No wires!",
"hide_essid": 0,
"apmac": "00:27:22:11:12:13",
"countrycode": 616,
"channel": 104,
"frequency": "5520 MHz",
"dfs": "0",
"opmode": "11naht40minus",
"antenna": "Combined - 24 dBi",
"chains": "2X2",
"signal": -64, "rssi": 32, "noisef": -88,
"ack": 30,
"distance": 900,
"ccq": 984,
"txrate": "240", "rxrate": "240",
"security": "WPA2", "qos": "No QoS",
"rstatus": 5,
"count": 1,
"polling": {
"enabled": 0,
"quality": 0,
"capacity": 0,
"priority": 0,
"noack": 0,
"airsync_mode": 0, "airsync_connections": 0,
"airsync_down_util" : 0, "airsync_up_util" : 0,
"airselect" : 0, "airselect_interval" : 0
},
"stats": {
"rx_nwids": 143634,
"rx_crypts": 0,
"rx_frags": 0,
"tx_retries": 0,
"missed_beacons": 0,
"err_other": 0
},
"wds": 1,
"aprepeater": 0,
"chwidth": 40,
"chanbw": 0,
"cwmmode": 0,
"rx_chainmask": 3,
"tx_chainmask": 3,
"chainrssi" : [ 30, 30, 0 ],
"chainrssimgmt" : [ 32, 32, 0 ],
"chainrssiext" : [ 30, 30, 0 ]
},
"airview": { "enabled": 0 },
"services": { "dhcpc": 0, "dhcpd": 0, "pppoe": 0 },
"firewall": { "iptables": 0, "ebtables" : 0 },
"genuine": "/images/genuine.png",
"interfaces" : [
{
"ifname" : "lo",
"hwaddr": "00:00:00:00:00:00",
"enabled" : true,
"status" : { "plugged": 1, "speed": 0, "duplex": 255 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
},
{
"ifname" : "eth0",
"hwaddr": "00:27:22:11:12:13",
"enabled" : true,
"status" : { "plugged": 1, "speed": 100, "duplex": 1 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
},
{
"ifname" : "wifi0",
"hwaddr": "00:27:22:11:12:13",
"enabled" : true,
"status" : { "plugged": 1, "speed": 0, "duplex": 255 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
},
{
"ifname" : "ath0",
"hwaddr": "00:27:22:11:12:13",
"enabled" : true,
"status" : { "plugged": 1, "speed": 300, "duplex": 255 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
},
{
"ifname" : "br0",
"hwaddr": "00:27:22:11:12:13",
"enabled" : true,
"status" : { "plugged": 1, "speed": 0, "duplex": 255 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
},
{
"ifname" : "br1",
"hwaddr": "00:27:22:11:12:13",
"enabled" : true,
"status" : { "plugged": 1, "speed": 0, "duplex": 255 },
"services" : { "dhcpc": false, "dhcpd": false, "pppoe": false }
}
]
}
I cannot tell if the URL used to read status.cgi can change slightly over time – look here for an update.
I checked the script on NanoBridge and PowerBridge devices using AirOS 5.5.2.