GithubHelp home page GithubHelp logo

Comments (21)

makew0rld avatar makew0rld commented on June 2, 2024 2
  • Modify the script to accept a name target, and always use unms.tomesh.net

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024 2

The script now lives at network/scripts/unms_exporter/.

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024 1

Here's a preliminary implementation. It handles HTTP requests on /metrics, with a target. By default it runs on port 8000. I have not tested it with the actual UNMS system yet. I will also be adding more keys once I'm aware of them.

Note: I will be updating the gist above, so that link will always point to the most recent public version. It's now here.

Edit: It works, with target=unms.tomesh.net.

Server command:

UNMS_KEY=foobar python3 unms_exporter.py

or

export UNMS_KEY=foobar
python3 unms_exporter.py

Client test with curl:

curl 'localhost:8000/metrics?target=unms.tomesh.net'

Edit: targets should now be names: ?target=sn1r1

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024 1

Script deployed and working

https://prometheus.tomesh.net/graph?g0.range_input=1h&g0.expr=node_network_receive_rate&g0.tab=0

Prometheus config

  - job_name: 'unms'
    scrape_timeout: 30s
    metrics_path: /metrics
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:8000  # The SNMP exporter's real hostname:port.
    static_configs:
      - targets:
        - sn1a1
        - sn1a2
        - sn1r1

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024 1

We can add some wireless entries
/api /devices/{deviceId}/interfaces

Some examples

wireless{name="sn1a1",if="wlan",mac="00:00:00:00:00", ssid="tomesh-airmaxac-sn1a2"} 1
wireless_frequency{name="sn1a1",mac="00:0:00:00:00"} 5490
wireless_frequency_width{name="sn1a1",mac="00:0:00:00:00"} 40
wireless_transmit_power{name="sn1a1",mac="00:0:00:00:00"} 0
wireless_stations{name="sn1a1",mac="00:0:00:00:00"} 0 (count of array)
wireless_gain{name="sn1a1",mac="00:0:00:00:00"} 16

should probably sync with openwrt node exporter script (might need to modify linked script too)

http://10.100.1.1:9100/metrics
http://100.64.20.2:9100/metrics

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024 1

created

for now
node_cpu_usage for cpu (seems close enough)
node_ram_usage for ram

I'll check the windows version of node exporter, it doesnt have load so it may be a clue there

frequency and signal added wireless_
node_boot_time_seconds is the new name for node_boot_time according to node exporter

added ubnt_ to ubiquti specific items
added more wireless info and STATION (connected device) information

#70

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024 1

Fixed in #81, now a 502 BAD GATEWAY error is returned if the cpu or ram is None.

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

UNMS installed at https://unms.tomesh.net
Prometheus installed at https://prometheus.tomesh.net
Grafana installed at https://monitor.tomesh.net

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

Some preliminary work.

API source for UNMS https://unms.tomesh.net/nms/api-docs/#/ (login required)

Sample json data result of api call
https://cryptpad.fr/code/#/2/code/view/wCFKR8s5GusDmWzX5PnY4Ry+sOsi655vcB5QTh+JGCo/

Python3 script to generate node exporter like results for Prometheus
https://cryptpad.fr/code/#/2/code/edit/bqvpEutOdd9bog34vEbbCrDK/

Current script returns

ram{} 32
cpu{} 1
uptime{} 498250
node_network_receive_bytes_total{device"eth4"} 0
node_network_transmit_bytes_total{device"eth4"} 0
node_network_up{device"eth4"} 0

TODO:

  • Make it respond to http on /metrics the same way node exporter does
  • ability to pass an NAME and show that antenna's details
  • expose more info, try to keep it aligned up with node-exporter format so we can re-use dashboards maybe?

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

Just some clarification:

  • Where can I get a reference for the node-exporter format?

  • ability to pass an NAME

    • As a URL query param maybe, like were you thinking /metrics?name=foo?

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

ability to pass a name

snmp-walker configuration uses this query string

http://192.168.251.50:9116/snmp?target=1.2.3.4&module=if_mib

and the prometheus config as

 - job_name: 'snmp'
    scrape_timeout: 30s
    metrics_path: /snmp
    params:
      module: [ubiquiti_airmax]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9116  # The SNMP exporter's real hostname:port.
    static_configs:
      - targets:
        - 100.64.10.2  # SNMP device.
        - 100.64.11.2  # SNMP device.

So i guess to parallel this setup i would use target

/metrics?target=foo?

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

Working on this now, in a private file.

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

nodeexporter dump

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

I've added the mtu, signal, and dropped keys.

from toronto-community-network.

benhylau avatar benhylau commented on June 2, 2024

How can I access these, the links don't work:

Prometheus installed at https://prometheus.tomesh.net
Grafana installed at https://monitor.tomesh.net

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

@benhylau Had a miss configuration after migrating the services to the mesh vlan on the servers

Should be working now.

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

Now that the script is deployed, all future updates by me and others should change the VERSION variable. The initial deployment used 0.1.0.

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

Update names: (needs research)

uptime should be node_boot_time or node_boot_time_seconds - (ref m-lab/prometheus-support#91)
ram node_memory_?????
cpu
frequency
signal

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

I'm not sure if node_boot_time_seconds is equivalent, as I believe it indicates the Unix time of system boot, while the current uptime key is how long the system has been up in seconds.

  • For ram, maybe it can become node_memory_Active_bytes?
  • cpu does not seem to have any equivalent in the dump you provided
  • frequency can be removed in favour of wireless_frequency
  • I'm not quite sure what signal represents, so it's hard to say. Maybe it's one of the wireless_* ones?

I will add the wireless_* keys and make the above changes if you agree, let me know.

from toronto-community-network.

makew0rld avatar makew0rld commented on June 2, 2024

Can this be closed? I'd say it's original goals have been completed.

from toronto-community-network.

darkdrgn2k avatar darkdrgn2k commented on June 2, 2024

We need to deal with "DOWN NODES"

Incorrect values - None

node_cpu_ram None
node_cpu_usage None
node_boot_time_seconds None

but also there should maybe be an error thrown as the node is down and the data is now stale

Sample: http://100.64.21.50:8000/metrics?target=100.64.20.3

https://prometheus.tomesh.net/targets

from toronto-community-network.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.