diff options
Diffstat (limited to 'collectors/charts.d.plugin/ap')
-rw-r--r-- | collectors/charts.d.plugin/ap/README.md | 19 | ||||
-rw-r--r-- | collectors/charts.d.plugin/ap/ap.chart.sh | 60 |
2 files changed, 46 insertions, 33 deletions
diff --git a/collectors/charts.d.plugin/ap/README.md b/collectors/charts.d.plugin/ap/README.md index befe21eec..35a00d65d 100644 --- a/collectors/charts.d.plugin/ap/README.md +++ b/collectors/charts.d.plugin/ap/README.md @@ -1,4 +1,10 @@ -# Access Point Plugin (ap) +<!-- +title: "Access point monitoring with Netdata" +custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/charts.d.plugin/ap/README.md +sidebar_label: "Access points" +--> + +# Access point monitoring with Netdata The `ap` collector visualizes data related to access points. @@ -76,8 +82,15 @@ Station 40:b8:37:5a:ed:5e (on wlan0) ## Configuration -You can only set `ap_update_every=NUMBER` to `/etc/netdata/charts.d/ap.conf`, to give the data collection frequency. -To edit this file on your system run `/etc/netdata/edit-config charts.d/ap.conf`. +Edit the `charts.d/ap.conf` configuration file using `edit-config` from the Netdata [config +directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. + +```bash +cd /etc/netdata # Replace this path with your Netdata config directory, if different +sudo ./edit-config charts.d/ap.conf +``` + +You can only set `ap_update_every=NUMBER` to change the data collection frequency. ## Auto-detection diff --git a/collectors/charts.d.plugin/ap/ap.chart.sh b/collectors/charts.d.plugin/ap/ap.chart.sh index a2d04c0a7..5dd787835 100644 --- a/collectors/charts.d.plugin/ap/ap.chart.sh +++ b/collectors/charts.d.plugin/ap/ap.chart.sh @@ -16,9 +16,9 @@ declare -A ap_devs=() # _check is called once, to find out if this chart should be enabled or not ap_check() { - require_cmd iw || return 1 - local ev - ev=$(run iw dev | awk ' + require_cmd iw || return 1 + local ev + ev=$(run iw dev | awk ' BEGIN { i = ""; ssid = ""; @@ -41,26 +41,26 @@ ap_check() { } } ') - eval "${ev}" + eval "${ev}" - # this should return: - # - 0 to enable the chart - # - 1 to disable the chart + # this should return: + # - 0 to enable the chart + # - 1 to disable the chart - [ ${#ap_devs[@]} -gt 0 ] && return 0 - error "no devices found in AP mode, with 'iw dev'" - return 1 + [ ${#ap_devs[@]} -gt 0 ] && return 0 + error "no devices found in AP mode, with 'iw dev'" + return 1 } # _create is called once, to create the charts ap_create() { - local ssid dev + local ssid dev - for dev in "${!ap_devs[@]}"; do - ssid="${ap_devs[${dev}]}" + for dev in "${!ap_devs[@]}"; do + ssid="${ap_devs[${dev}]}" - # create the chart with 3 dimensions - cat <<EOF + # create the chart with 3 dimensions + cat << EOF CHART ap_clients.${dev} '' "Connected clients to ${ssid} on ${dev}" "clients" ${dev} ap.clients line $((ap_priority + 1)) $ap_update_every DIMENSION clients '' absolute 1 1 @@ -84,25 +84,25 @@ DIMENSION receive '' absolute 1 1000 DIMENSION transmit '' absolute -1 1000 DIMENSION expected 'expected throughput' absolute 1 1000 EOF - done + done - return 0 + return 0 } # _update is called continuously, to collect the values ap_update() { - # the first argument to this function is the microseconds since last update - # pass this parameter to the BEGIN statement (see bellow). - - # do all the work to collect / calculate the values - # for each dimension - # remember: KEEP IT SIMPLE AND SHORT - - for dev in "${!ap_devs[@]}"; do - echo - echo "DEVICE ${dev}" - iw "${dev}" station dump - done | awk ' + # the first argument to this function is the microseconds since last update + # pass this parameter to the BEGIN statement (see bellow). + + # do all the work to collect / calculate the values + # for each dimension + # remember: KEEP IT SIMPLE AND SHORT + + for dev in "${!ap_devs[@]}"; do + echo + echo "DEVICE ${dev}" + iw "${dev}" station dump + done | awk ' function zero_data() { dev = ""; c = 0; @@ -175,5 +175,5 @@ ap_update() { } ' - return 0 + return 0 } |