Skip to content

Repository files navigation

Node informant Build Status

Node informant actually consists of two tools. neighbour-discovery and gluon-collector.

This is a little utility to continuously request data from announced enabled nodes. The experimental go vendor feature is used to manage dependecies, so you need to set GO15VENDOREXPERIMENT=1 to use the vendored dependencies. To manage dependencies govendor is recommended (and used in this project).

How to build

go get github.com/ffdo/node-informant/...

neighbour-discovery

This tool can act as a replacement for the gluon-neighbour-discovery tool. It has the following command line switches:

SwitchDescriptionDefaultMandatory
-ifaceThe interface to use to send packets from and receive packets onnoneYes
-queryThe query to send i.e. "GET nodeinfos"noneYes
-deflateWhether to decompress received data via deflatefalseNo
-portThe port to bind to, to receive packets on12444No
-timeoutAfter how many seconds the program should terminate. -1 to keep it running indefinitely.-1No
-targetIf a target IPv6 address is specified, the query is send via unicast to this targetnoneNo

gluon-collector

gluon-collector should run in the background. It queries in regular intervals all nodes listening on the default announced multicast group and stores the received information. The received information is available via a REST API or data prepared for meshviewer.

Command line switches

SwitchDescriptionDefaultMandatory
-configThe path to a valid yaml or json config/etc/node-collector.yamlNo
-importImport data from this path. The type of data depends on the import typenoneNo
-importTypeSpecify the type of data to import. Currently only ffmap-backend is supportedffmap-backendNo

Please not that it is not advised to add the import flags to the default startup config, since this would import the legacy data on every startup, effectively overwriting previously collected data.

Example config

receiver: # List of receiver receiving informantion from nodes. 
- type: announced # Type of the receiver. Currently only announced is supportedinterface: "bat0"# The interface to use for announcedport: 21444# The port to use as a source port announced requests and to listen for responses oninterval:
statistics: 300# The interval in seconds to fetch fast changing data like statistics and neighboursnodeinfo: 1800# The interval in seconds to request more static data and discover new nodesexpire: 3# This is a multiplicator for the statistics interval. A node is considered offline if# statistics interval multiplied by expire seconds have passed since the last responselogger: level: "warn"# The log level, see logrus for valid valuesfile: /var/log/gluon-collector.log # If the log file is specified the log is written there. If not everything is send to stdout.store:
type: "bolt"# The type of data store to use. Currently bolt (persistend) and memory (non persistend) are supportedpath: "/opt/gluon-collector/collector.db"# The path is only relevant for bolt store. Where to store the database?expireNodesAfterDays: 365# After this amount of days, a node is considered gone and is deleted from the databasehttp: port: 8079# The port where the http server will listen on.address: "[::]"# Optional listen address if you want the server to listen only on a specific interfaceprometheus:
namelabel: true # Label prometheus node statistics with the host namesitecodelabel: true # Label prometheus node statistics with the received site code

HTTP API

The following rest endpoints are available. All endpoints return JSON (or JSON arrays) and CORS headers. The only valid method is GET.

EndpointDescription
/nodes.jsonGenerates a valid nodes.json for meshviewer
/graph.jsonGenerates valid graph data for meshviewer
/nodeinfos/{nodeid}Retrieves general node information about the node with nodeid
/nodeinfosRetrieve all available general node information
/statistics/{nodeid}Retrieve statistics for node
/statisticsRetrieve all available statistics
/neighbours/{nodeid}Retrieve mesh neighbour information about node
/neighboursRetrieve all available neighbour information
/nodestatus/{nodeid}Retrieve status information like Lastseen, Online status etc. for node
/nodestatusRetrieve all available status information

Prometheus

Under the /metrics endpoint prometheus metrics are exposed. Currently we expose the following metrics

MetricDescription
total_clientsTotal count of clients connected to all nodes
meshnodes_totalCount of all known mesh nodes online and offline
total_traffic_rxAccumulated on mesh nodes received traffic
total_traffic_txAccumulated from mesh nodes transmitted traffic
total_traffic_mgmt_rxAccumulated on mesh nodes received management traffic
total_traffic_mgmt_txAccumulated from mesh nodes transmitted management traffic
meshnodes_online_totalCount of currently available mesh nodes
meshnode_traffic_rxReceived traffic on every node labeled with the nodeid and traffic type
meshnode_traffic_txTransmitted traffic from every mesh node labeled with the nodeid and traffic type
meshnode_uptimeUptime of single mesh nodes labeled with the nodeid
meshnode_clientsClient count on mesh nodes labeled with the nodeid

About

Small utility to collect node information in a Freifunk network via announced

Resources

Stars

7 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages