procio
This commit is contained in:
parent
9295e1789c
commit
384f7dbfa8
6 changed files with 123 additions and 12 deletions
|
@ -1,4 +1,9 @@
|
||||||
defaults = {
|
defaults = {
|
||||||
|
'apt': {
|
||||||
|
'packages': {
|
||||||
|
'lm-sensors': {},
|
||||||
|
},
|
||||||
|
},
|
||||||
'grafana_rows': {
|
'grafana_rows': {
|
||||||
'health',
|
'health',
|
||||||
},
|
},
|
||||||
|
@ -10,6 +15,9 @@ defaults = {
|
||||||
'telegraf': {
|
'telegraf': {
|
||||||
'config': {
|
'config': {
|
||||||
'inputs': {
|
'inputs': {
|
||||||
|
'sensors': {repo.libs.hashable.hashable({
|
||||||
|
'timeout': '2s',
|
||||||
|
})},
|
||||||
'exec': {
|
'exec': {
|
||||||
repo.libs.hashable.hashable({
|
repo.libs.hashable.hashable({
|
||||||
'commands': ["sudo /usr/local/share/icinga/plugins/cpu_frequency"],
|
'commands': ["sudo /usr/local/share/icinga/plugins/cpu_frequency"],
|
||||||
|
|
|
@ -1,13 +1,27 @@
|
||||||
from tomlkit import dumps
|
import tomlkit
|
||||||
import json
|
import json
|
||||||
from bundlewrap.metadata import MetadataJSONEncoder
|
from bundlewrap.metadata import MetadataJSONEncoder
|
||||||
|
|
||||||
|
arch = node.metadata.get('vm/architecture', 'amd64')
|
||||||
|
|
||||||
files['/etc/telegraf/telegraf.conf'] = {
|
files = {
|
||||||
'content': dumps(json.loads(json.dumps(node.metadata.get('telegraf/config'), cls=MetadataJSONEncoder)), sort_keys=True),
|
'/etc/telegraf/telegraf.conf': {
|
||||||
'triggers': [
|
'content': tomlkit.dumps(
|
||||||
'svc_systemd:telegraf:restart',
|
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'] = {
|
svc_systemd['telegraf'] = {
|
||||||
|
|
|
@ -55,6 +55,13 @@ defaults = {
|
||||||
'swap': {h({})},
|
'swap': {h({})},
|
||||||
'system': {h({})},
|
'system': {h({})},
|
||||||
'net': {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',
|
'net_io',
|
||||||
'proc_cpu',
|
'proc_cpu',
|
||||||
'proc_ram',
|
'proc_ram',
|
||||||
|
'proc_io',
|
||||||
|
},
|
||||||
|
'sudoers': {
|
||||||
|
'telegraf': {'/usr/local/share/icinga/plugins/procio'},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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': {
|
'temperature': {
|
||||||
'stacked': False,
|
'stacked': False,
|
||||||
'queries': {
|
'queries': {
|
||||||
|
@ -18,14 +39,14 @@
|
||||||
'tooltip': 'multi',
|
'tooltip': 'multi',
|
||||||
'unit': 'degrees',
|
'unit': 'degrees',
|
||||||
},
|
},
|
||||||
'frequency': {
|
'sensors': {
|
||||||
'stacked': False,
|
'stacked': False,
|
||||||
'queries': {
|
'queries': {
|
||||||
'cpu_frequency': {
|
'sensors': {
|
||||||
'filters': {
|
'filters': {
|
||||||
'_measurement': 'cpu_frequency',
|
'_measurement': 'sensors',
|
||||||
'_field': [
|
'_field': [
|
||||||
'current',
|
'temp_input',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'function': 'mean',
|
'function': 'mean',
|
||||||
|
@ -35,7 +56,7 @@
|
||||||
'displayMode': 'hidden',
|
'displayMode': 'hidden',
|
||||||
},
|
},
|
||||||
'tooltip': 'multi',
|
'tooltip': 'multi',
|
||||||
'unit': 'MHz',
|
'unit': 'degrees',
|
||||||
'display_name': '__field.labels.cpu',
|
'display_name': '__field.labels.chip',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
52
data/grafana/rows/proc_io.py
Normal file
52
data/grafana/rows/proc_io.py
Normal 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',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -5,4 +5,9 @@
|
||||||
'bundles': {
|
'bundles': {
|
||||||
'raspberry-pi',
|
'raspberry-pi',
|
||||||
},
|
},
|
||||||
|
'metadata': {
|
||||||
|
'system': {
|
||||||
|
'architecture': 'arm64',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue