This commit is contained in:
mwiegand 2021-11-18 23:26:26 +01:00
parent 9295e1789c
commit 384f7dbfa8
6 changed files with 123 additions and 12 deletions

View file

@ -1,4 +1,9 @@
defaults = {
'apt': {
'packages': {
'lm-sensors': {},
},
},
'grafana_rows': {
'health',
},
@ -10,6 +15,9 @@ defaults = {
'telegraf': {
'config': {
'inputs': {
'sensors': {repo.libs.hashable.hashable({
'timeout': '2s',
})},
'exec': {
repo.libs.hashable.hashable({
'commands': ["sudo /usr/local/share/icinga/plugins/cpu_frequency"],

View file

@ -1,13 +1,27 @@
from tomlkit import dumps
import tomlkit
import json
from bundlewrap.metadata import MetadataJSONEncoder
arch = node.metadata.get('vm/architecture', 'amd64')
files['/etc/telegraf/telegraf.conf'] = {
'content': dumps(json.loads(json.dumps(node.metadata.get('telegraf/config'), cls=MetadataJSONEncoder)), sort_keys=True),
'triggers': [
'svc_systemd:telegraf:restart',
],
files = {
'/etc/telegraf/telegraf.conf': {
'content': tomlkit.dumps(
json.loads(json.dumps(
node.metadata.get('telegraf/config'),
cls=MetadataJSONEncoder,
)),
sort_keys=True
),
'triggers': [
'svc_systemd:telegraf:restart',
],
},
'/usr/local/share/icinga/plugins/procio': {
'content_type': 'download',
'source': f'https://dl.sublimity.de/telegraf-procio/telegraf-procio-{arch}-latest',
'mode': '0755',
},
}
svc_systemd['telegraf'] = {

View file

@ -55,6 +55,13 @@ defaults = {
'swap': {h({})},
'system': {h({})},
'net': {h({})},
'exec': {h({
'commands': [
f'sudo /usr/local/share/icinga/plugins/procio',
],
'data_format': 'influx',
'interval': '20s',
})},
},
},
},
@ -66,6 +73,10 @@ defaults = {
'net_io',
'proc_cpu',
'proc_ram',
'proc_io',
},
'sudoers': {
'telegraf': {'/usr/local/share/icinga/plugins/procio'},
},
}

View file

@ -1,4 +1,25 @@
{
'frequency': {
'stacked': True,
'queries': {
'cpu_frequency': {
'filters': {
'_measurement': 'cpu_frequency',
'_field': [
'current',
],
},
'function': 'mean',
},
},
'legend': {
'displayMode': 'hidden',
},
'tooltip': 'multi',
'unit': 'MHz',
'display_name': '__field.labels.cpu',
'min': 0,
},
'temperature': {
'stacked': False,
'queries': {
@ -18,14 +39,14 @@
'tooltip': 'multi',
'unit': 'degrees',
},
'frequency': {
'sensors': {
'stacked': False,
'queries': {
'cpu_frequency': {
'sensors': {
'filters': {
'_measurement': 'cpu_frequency',
'_measurement': 'sensors',
'_field': [
'current',
'temp_input',
],
},
'function': 'mean',
@ -35,7 +56,7 @@
'displayMode': 'hidden',
},
'tooltip': 'multi',
'unit': 'MHz',
'display_name': '__field.labels.cpu',
'unit': 'degrees',
'display_name': '__field.labels.chip',
},
}

View file

@ -0,0 +1,52 @@
{
'io_read': {
'stacked': True,
'queries': {
'io_read': {
'filters': {
'_measurement': 'procio',
'_field': [
'read_bytes',
],
},
'function': 'derivative',
'minimum': 1,
},
},
'unit': 'bytes',
'display_name': '__field.labels.comm',
'legend': {
'displayMode': 'table',
'placement': 'right',
'calcs': [
'mean',
'max',
],
},
},
'io_write': {
'stacked': True,
'queries': {
'io_write': {
'filters': {
'_measurement': 'procio',
'_field': [
'write_bytes',
],
},
'function': 'derivative',
'minimum': 1,
},
},
'unit': 'bytes',
'display_name': '__field.labels.comm',
'legend': {
'displayMode': 'table',
'placement': 'right',
'calcs': [
'mean',
'max',
],
},
},
}

View file

@ -5,4 +5,9 @@
'bundles': {
'raspberry-pi',
},
'metadata': {
'system': {
'architecture': 'arm64',
},
},
}