/node-stats

Primary LanguagePythonMIT LicenseMIT

node-stats

This script reads a local or remote (http/https) raw.json generated by hopglass-server or similiar converts it and afterwards sends it to a graphite storage target.

Requirements

  • This script requires a python 3 environment.

Configuration

This script can be configured via config.json (see below). However some features are available via commandline argument only.

CLI Arguments

# ./main.py --help
usage: main.py [-h] [-g HOPGLASS_RAW] [-c CONFIG] [-n ALTERNATIVE_NOW]
               [-fp FILTER_PATTERN] [-fm FILTER_MODE] [-p]

This Script is a link between Hopglass-Server and Graphite.

optional arguments:
  -h, --help            show this help message and exit
  -g HOPGLASS_RAW, --hopglass-raw HOPGLASS_RAW
                        Hopglass raw.json source. Default: ./raw.json
  -c CONFIG, --config CONFIG
                        node-stats config file location Default: ./config.json
  -n ALTERNATIVE_NOW, --alternative-now ALTERNATIVE_NOW
                        Set a fake now date.
  -fp FILTER_PATTERN, --filter-pattern FILTER_PATTERN
                        Filter generated messages by given (regex) pattern.
  -fm FILTER_MODE, --filter-mode FILTER_MODE
                        normal: Only include if filter matches, inverse:
                        exclude if filter matches.
  -p, --print-only      Print only

config.json

{
	"offline_last_seen_s" : 1200,
	"graphite_target" : {
		"server" : "127.0.0.1",
		"port" : 2003
	},
	"adv_node_stats" : [
		"nodeID1",
		"nodeID2",
		"..."
	]
}