From afa1e4abb7f49020ef8ef9c7fe1e2758e9f0fe98 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 11 Dec 2022 17:42:59 +0100 Subject: [PATCH] move usv telegraf info collection to influxdb host --- nodes/home/router.py | 37 ------------------------------- nodes/htz-cloud/influxdb.py | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/nodes/home/router.py b/nodes/home/router.py index abde1d4..fce8ce7 100644 --- a/nodes/home/router.py +++ b/nodes/home/router.py @@ -151,43 +151,6 @@ nodes['home.router'] = { '172.19.138.0/23', }, }, - 'telegraf': { - 'input_plugins': { - 'builtin': { - 'snmp': [ - { - 'agents': ['udp://172.19.138.2'], - 'agent_host_tag': 'host', - 'table': [{'oid': 'IF-MIB::ifTable'}], - 'interval': '10s', - }, - { - 'agents': ['udp://172.19.138.3'], - 'agent_host_tag': 'host', - 'field': [ - {'oid': 'SNMPv2-SMI::mib-2.33.1.2.3.0', 'name': 'battery_runtime_to_empty'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.2.4.0', 'name': 'battery_capacity'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.2.5.0', 'name': 'battery_voltage', 'conversion': 'float(1)'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.2.6.0', 'name': 'battery_current', 'conversion': 'float(1)'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.3.3.1.2.1', 'name': 'input_frequency', 'conversion': 'float(1)'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.3.3.1.3.1', 'name': 'input_voltage'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.4.2.0', 'name': 'output_frequency', 'conversion': 'float(1)'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.2.1', 'name': 'output_voltage'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.3.1', 'name': 'output_frequency', 'conversion': 'float(1)'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.4.1', 'name': 'output_watts'}, - {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.5.1', 'name': 'output_percent'}, - ], - 'interval': '10s', - }, - { - 'agents': ['udp://172.19.138.41'], - 'agent_host_tag': 'host', - 'table': [{'oid': 'IF-MIB::ifTable'}], - }, - ], - }, - }, - }, 'users': { 'f2k1de': { 'ssh_pubkey': { diff --git a/nodes/htz-cloud/influxdb.py b/nodes/htz-cloud/influxdb.py index 66f9893..ba1274a 100644 --- a/nodes/htz-cloud/influxdb.py +++ b/nodes/htz-cloud/influxdb.py @@ -10,6 +10,13 @@ nodes['htz-cloud.influxdb'] = { 'webserver', }, 'metadata': { + 'apt': { + 'packages': { + # for telegraf + 'snmp': {}, + 'snmp-mibs-downloader': {}, + }, + }, 'interfaces': { 'eth0': { 'ips': { @@ -57,6 +64,43 @@ nodes['htz-cloud.influxdb'] = { }, }, }, + 'telegraf': { + 'input_plugins': { + 'builtin': { + 'snmp': [ + { + 'agents': ['udp://172.19.138.2'], + 'agent_host_tag': 'host', + 'table': [{'oid': 'IF-MIB::ifTable'}], + 'interval': '10s', + }, + { + 'agents': ['udp://172.19.138.3'], + 'agent_host_tag': 'host', + 'field': [ + {'oid': 'SNMPv2-SMI::mib-2.33.1.2.3.0', 'name': 'battery_runtime_to_empty'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.2.4.0', 'name': 'battery_capacity'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.2.5.0', 'name': 'battery_voltage', 'conversion': 'float(1)'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.2.6.0', 'name': 'battery_current', 'conversion': 'float(1)'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.3.3.1.2.1', 'name': 'input_frequency', 'conversion': 'float(1)'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.3.3.1.3.1', 'name': 'input_voltage'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.4.2.0', 'name': 'output_frequency', 'conversion': 'float(1)'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.2.1', 'name': 'output_voltage'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.3.1', 'name': 'output_frequency', 'conversion': 'float(1)'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.4.1', 'name': 'output_watts'}, + {'oid': 'SNMPv2-SMI::mib-2.33.1.4.4.1.5.1', 'name': 'output_percent'}, + ], + 'interval': '10s', + }, + { + 'agents': ['udp://172.19.138.41'], + 'agent_host_tag': 'host', + 'table': [{'oid': 'IF-MIB::ifTable'}], + }, + ], + }, + }, + }, #'openssh': { # 'restrict-to': { # 'versatel',