faucet.watcher_conf module
Gauge watcher configuration.
- class faucet.watcher_conf.WatcherConf(_id, dp_id, conf, prom_client)[source]
Bases:
Conf
Stores the state and configuration to monitor a single stat.
Watcher Config
Watchers are configured in the watchers config block in the config for gauge.
The following elements can be configured for each watcher, at the level of /watchers/<watcher name>/:
type (string): The type of watcher (IE what stat this watcher monitors). The types are ‘port_state’, ‘port_stats’ or ‘flow_table’.
dps (list): A list of dps that should be monitored with this watcher.
db (string): The db that will be used to store the data once it is retreived.
interval (int): if this watcher requires polling the switch, it will monitor at this interval.
The config for a db should be created in the gauge config file under the dbs config block.
The following elements can be configured for each db, at the level of /dbs/<db name>/:
type (string): the type of db. The available types are ‘text’ for port_state, ‘text’, and ‘prometheus’ for port_stats and ‘text’ and flow_table.
The following config elements then depend on the type.
- For text:
file (string): the filename of the file to write output to.
path (string): path where files should be written when writing to muiltiple files
compress (bool): compress (with gzip) flow_table output while writing it
- For Prometheus:
prometheus_port (int): The port used to export prometheus data. Defaults to 9303.
prometheus_addr (ip addr str): The address used to export prometheus data. Defaults to ‘127.0.0.1’.
- db_defaults = {'compress': False, 'file': None, 'path': None, 'prometheus_addr': '0.0.0.0', 'prometheus_port': 9303, 'prometheus_test_thread': False, 'type': None}
- db_defaults_types = {'compress': <class 'bool'>, 'file': <class 'str'>, 'path': <class 'str'>, 'prometheus_addr': <class 'str'>, 'prometheus_port': <class 'int'>, 'prometheus_test_thread': <class 'bool'>, 'type': <class 'str'>}
- defaults: dict = {'all_dps': False, 'db': None, 'db_type': 'text', 'dbs': None, 'dps': None, 'interval': 30, 'name': None, 'type': None}
- defaults_types: dict = {'all_dps': <class 'bool'>, 'db': <class 'str'>, 'db_type': <class 'str'>, 'dbs': <class 'list'>, 'dps': <class 'list'>, 'interval': <class 'int'>, 'name': <class 'str'>, 'type': <class 'str'>}