diff --git a/README.md b/README.md index 1f21620..6448d40 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ -## huawei_lte_exporter +# huawei_lte_exporter -# Install +A promethus exporter for the Huawei series of 4G LTE routers, exporting various LTE signal strength measures e.g. rssi, snr etc ... It should be compatible with a range of Huawei routers including B310, B315, B525 and B535. A full range is listed at [huawei-lte-api](https://pypi.org/project/huawei-lte-api/). + +## Example + +![Grafana Dashboard Screenshot](/examples/screenshot.png "Grafana Dashboard Screenshot") + + +## Install ``` docker build -t huawei_lte_exporter . @@ -31,3 +38,18 @@ TYPE sinr gauge rsrq{deviceName="B535-232",iccid="111"} 11 ``` +## Configure + +### Prometheus + +``` + - job_name: '4g' + scrape_interval: 1m + static_configs: + - targets: + - wopr.home:9910 +``` + +### Grafana + +Example dashboard [config](/examples/grafana.json) diff --git a/examples/grafana.json b/examples/grafana.json new file mode 100644 index 0000000..00babac --- /dev/null +++ b/examples/grafana.json @@ -0,0 +1,612 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "", + "editable": true, + "gnetId": 11229, + "graphTooltip": 0, + "id": 17, + "iteration": 1586270780414, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 36, + "panels": [], + "title": "4G Interface", + "type": "row" + }, + { + "datasource": null, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 1 + }, + "id": 42, + "options": { + "fieldOptions": { + "calcs": [ + "lastNotNull" + ], + "defaults": { + "mappings": [], + "max": 30, + "min": -10, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "orange", + "value": 0 + }, + { + "color": "orange", + "value": 12 + }, + { + "color": "yellow", + "value": 12 + }, + { + "color": "yellow", + "value": 20 + }, + { + "color": "green", + "value": 20 + }, + { + "color": "green", + "value": 65 + } + ] + }, + "unit": "dB" + }, + "overrides": [], + "values": false + }, + "orientation": "auto", + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "6.6.1", + "targets": [ + { + "expr": "sinr", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "sinr", + "type": "gauge" + }, + { + "datasource": null, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 1 + }, + "id": 44, + "options": { + "fieldOptions": { + "calcs": [ + "lastNotNull" + ], + "defaults": { + "mappings": [], + "max": -4, + "min": -20, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "#EAB839", + "value": -16 + }, + { + "color": "yellow", + "value": -12 + }, + { + "color": "green", + "value": -8 + }, + { + "color": "green", + "value": -4 + } + ] + }, + "unit": "dB" + }, + "overrides": [], + "values": false + }, + "orientation": "auto", + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "6.6.1", + "targets": [ + { + "expr": "rsrq", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "rsrq", + "type": "gauge" + }, + { + "datasource": null, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 1 + }, + "id": 46, + "options": { + "fieldOptions": { + "calcs": [ + "lastNotNull" + ], + "defaults": { + "mappings": [], + "max": -55, + "min": -95, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "orange", + "value": -85 + }, + { + "color": "orange", + "value": -75 + }, + { + "color": "yellow", + "value": -75 + }, + { + "color": "yellow", + "value": -65 + }, + { + "color": "green", + "value": -65 + }, + { + "color": "green", + "value": -55 + } + ] + }, + "unit": "dB" + }, + "overrides": [], + "values": false + }, + "orientation": "auto", + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "6.6.1", + "targets": [ + { + "expr": "rssi", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "rssi", + "type": "gauge" + }, + { + "datasource": null, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 1 + }, + "id": 40, + "options": { + "fieldOptions": { + "calcs": [ + "lastNotNull" + ], + "defaults": { + "mappings": [], + "max": -70, + "min": -110, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "orange", + "value": -100 + }, + { + "color": "orange", + "value": -90 + }, + { + "color": "yellow", + "value": -90 + }, + { + "color": "#EAB839", + "value": -80 + }, + { + "color": "green", + "value": -80 + }, + { + "color": "green", + "value": -70 + } + ] + }, + "unit": "dBm" + }, + "overrides": [], + "values": false + }, + "orientation": "auto", + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "6.6.1", + "targets": [ + { + "expr": "rsrp", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "rsrp", + "type": "gauge" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 5 + }, + "hiddenSeries": false, + "id": 30, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rsrq{}", + "legendFormat": "rsrq {{band}}", + "refId": "A" + }, + { + "expr": "sinr{}", + "legendFormat": "sinr {{band}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "4G RSRQ & SINR by Band", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dB", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 5 + }, + "hiddenSeries": false, + "id": 28, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rsrp{}", + "legendFormat": "rsrp {{band}}", + "refId": "A" + }, + { + "expr": "rssi{}", + "legendFormat": "rssi {{band}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "4G RSRP & RSSI by Band", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dBm", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": null, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 26, + "options": { + "colorMode": "value", + "fieldOptions": { + "calcs": [ + "lastNotNull" + ], + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [], + "values": false + }, + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto" + }, + "pluginVersion": "6.6.1", + "targets": [ + { + "expr": "band{}", + "format": "time_series", + "instant": true, + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "4G Band", + "type": "stat" + } + ], + "refresh": false, + "schemaVersion": 22, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "Prometheus", + "value": "Prometheus" + }, + "hide": 2, + "includeAll": false, + "label": null, + "multi": false, + "name": "DS_PROMETHEUS", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Internet Router", + "uid": "BuyqDpjWk", + "version": 1 +} diff --git a/examples/screenshot.png b/examples/screenshot.png new file mode 100644 index 0000000..4961bfc Binary files /dev/null and b/examples/screenshot.png differ