raspberry bundle
This commit is contained in:
parent
89d2f3ce7a
commit
d2916ef4f9
8 changed files with 112 additions and 39 deletions
|
@ -1,10 +1,10 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- systemd-swap
|
||||||
|
- raspberry cpu frequency /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
|
||||||
- gollum wiki
|
- gollum wiki
|
||||||
- blog?
|
- blog?
|
||||||
- fix dkim not working sometimes
|
- fix dkim not working sometimes
|
||||||
- LDAP
|
- LDAP
|
||||||
- oauth2/OpenID
|
- oauth2/OpenID
|
||||||
- icinga
|
- icinga
|
||||||
- Homeassistant/OpenHAB
|
|
||||||
- Homematic
|
|
||||||
|
|
69
bundles/raspberry-pi/metadata.py
Normal file
69
bundles/raspberry-pi/metadata.py
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
h = repo.libs.hashable.hashable
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
'grafana_rows': {
|
||||||
|
'health',
|
||||||
|
},
|
||||||
|
'systemd': {
|
||||||
|
'journald.conf': {
|
||||||
|
'Storage': 'volatile',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'telegraf/config',
|
||||||
|
)
|
||||||
|
def telegraf(metadata):
|
||||||
|
return {
|
||||||
|
'telegraf': {
|
||||||
|
'config': {
|
||||||
|
'agent': {
|
||||||
|
'flush_interval': '30s',
|
||||||
|
'interval': '30s',
|
||||||
|
},
|
||||||
|
'inputs': {
|
||||||
|
'exec': {
|
||||||
|
h({
|
||||||
|
'commands': ["/bin/bash -c 'expr $(cat /sys/class/thermal/thermal_zone0/temp) / 1000'"],
|
||||||
|
'name_override': "cpu_temperature",
|
||||||
|
'data_format': "value",
|
||||||
|
'data_type': "integer",
|
||||||
|
}),
|
||||||
|
# h({
|
||||||
|
# 'commands': [
|
||||||
|
# f'sudo /usr/local/share/icinga/plugins/smartctl',
|
||||||
|
# ],
|
||||||
|
# 'data_format': 'influx',
|
||||||
|
# 'interval': '20s',
|
||||||
|
# }),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'zfs/kernel_params',
|
||||||
|
'zfs/datasets',
|
||||||
|
)
|
||||||
|
def zfs(metadata):
|
||||||
|
if not node.has_bundle('zfs'):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'zfs': {
|
||||||
|
'datasets': {
|
||||||
|
name: {
|
||||||
|
'logbias': 'throughput',
|
||||||
|
}
|
||||||
|
for name in metadata.get('zfs/datasets')
|
||||||
|
},
|
||||||
|
'kernel_params': {
|
||||||
|
'zfs_txg_timeout': 300,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
h = repo.libs.hashable.hashable
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
'apt': {
|
'apt': {
|
||||||
'packages': {
|
'packages': {
|
||||||
|
@ -11,13 +13,13 @@ defaults = {
|
||||||
'telegraf': {
|
'telegraf': {
|
||||||
'config': {
|
'config': {
|
||||||
'inputs': {
|
'inputs': {
|
||||||
'exec': [{
|
'exec': {h({
|
||||||
'commands': [
|
'commands': [
|
||||||
f'sudo /usr/local/share/icinga/plugins/smartctl',
|
f'sudo /usr/local/share/icinga/plugins/smartctl',
|
||||||
],
|
],
|
||||||
'data_format': 'influx',
|
'data_format': 'influx',
|
||||||
'interval': '20s',
|
'interval': '20s',
|
||||||
}],
|
})},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
from bundlewrap.utils.dicts import merge_dict
|
from bundlewrap.utils.dicts import merge_dict
|
||||||
|
|
||||||
|
files = {
|
||||||
|
'/etc/systemd/journald.conf.d/managed.conf': {
|
||||||
|
'content': repo.libs.systemd.generate_unitfile({
|
||||||
|
'Jorunal': node.metadata.get('systemd/journald.conf'),
|
||||||
|
}),
|
||||||
|
'triggers': {
|
||||||
|
'svc_systemd:systemd-journald:restart',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_systemd = {
|
||||||
|
'systemd-journald': {},
|
||||||
|
}
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
'systemd-reload': {
|
'systemd-reload': {
|
||||||
'command': 'systemctl daemon-reload',
|
'command': 'systemctl daemon-reload',
|
||||||
|
|
|
@ -2,6 +2,7 @@ defaults = {
|
||||||
'systemd': {
|
'systemd': {
|
||||||
'units': {},
|
'units': {},
|
||||||
'services': {},
|
'services': {},
|
||||||
|
'journald.conf': {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from tomlkit import dumps
|
from tomlkit import dumps
|
||||||
|
import json
|
||||||
|
from bundlewrap.metadata import MetadataJSONEncoder
|
||||||
|
|
||||||
|
|
||||||
files['/etc/telegraf/telegraf.conf'] = {
|
files['/etc/telegraf/telegraf.conf'] = {
|
||||||
'content': dumps(node.metadata.get('telegraf/config'), sort_keys=True),
|
'content': dumps(json.loads(json.dumps(node.metadata.get('telegraf/config'), cls=MetadataJSONEncoder)), sort_keys=True),
|
||||||
'triggers': [
|
'triggers': [
|
||||||
'svc_systemd:telegraf:restart',
|
'svc_systemd:telegraf:restart',
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
h = repo.libs.hashable.hashable
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
'apt': {
|
'apt': {
|
||||||
'packages': {
|
'packages': {
|
||||||
|
@ -21,13 +23,13 @@ defaults = {
|
||||||
'round_interval': True,
|
'round_interval': True,
|
||||||
},
|
},
|
||||||
'inputs': {
|
'inputs': {
|
||||||
'cpu': [{
|
'cpu': {h({
|
||||||
'collect_cpu_time': False,
|
'collect_cpu_time': False,
|
||||||
'percpu': True,
|
'percpu': True,
|
||||||
'report_active': False,
|
'report_active': False,
|
||||||
'totalcpu': True,
|
'totalcpu': True,
|
||||||
}],
|
})},
|
||||||
'disk': [{
|
'disk': {h({
|
||||||
'ignore_fs': [
|
'ignore_fs': [
|
||||||
'tmpfs',
|
'tmpfs',
|
||||||
'devtmpfs',
|
'devtmpfs',
|
||||||
|
@ -37,22 +39,22 @@ defaults = {
|
||||||
'aufs',
|
'aufs',
|
||||||
'squashfs',
|
'squashfs',
|
||||||
],
|
],
|
||||||
}],
|
})},
|
||||||
'procstat': [{
|
'procstat': {h({
|
||||||
'interval': '60s',
|
'interval': '60s',
|
||||||
'pattern': '.',
|
'pattern': '.',
|
||||||
'fieldpass': [
|
'fieldpass': [
|
||||||
'cpu_usage',
|
'cpu_usage',
|
||||||
'memory_rss',
|
'memory_rss',
|
||||||
],
|
],
|
||||||
}],
|
})},
|
||||||
'diskio': [{}],
|
'diskio': {h({})},
|
||||||
'kernel': [{}],
|
'kernel': {h({})},
|
||||||
'mem': [{}],
|
'mem': {h({})},
|
||||||
'processes': [{}],
|
'processes': {h({})},
|
||||||
'swap': [{}],
|
'swap': {h({})},
|
||||||
'system': [{}],
|
'system': {h({})},
|
||||||
'net': [{}],
|
'net': {h({})},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
{
|
{
|
||||||
'metadata': {
|
'bundles': {
|
||||||
'telegraf': {
|
'raspberry-pi',
|
||||||
'config': {
|
|
||||||
'inputs': {
|
|
||||||
'exec': [{
|
|
||||||
'commands': ["/bin/bash -c 'expr $(cat /sys/class/thermal/thermal_zone0/temp) / 1000'"],
|
|
||||||
'name_override': "cpu_temperature",
|
|
||||||
'data_format': "value",
|
|
||||||
'data_type': "integer",
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'grafana_rows': {
|
|
||||||
'health',
|
|
||||||
},
|
|
||||||
'zfs': {
|
|
||||||
'kernel_params': {
|
|
||||||
'zfs_txg_timeout': 300,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue