bundles/grafana: replace the useless builtin of telegraf with something more useful

This commit is contained in:
Franzi 2022-08-07 10:16:07 +02:00
parent f6d6ef7aa7
commit 6b641890c3
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 299 additions and 23 deletions

View file

@ -24,6 +24,22 @@ defaults = {
},
}
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'exec': {
'smartd': {
'commands': ['sudo /usr/local/sbin/telegraf-smartd'],
'data_format': 'influx',
'timeout': '5s',
},
},
},
'sudo_commands': {
'/usr/local/sbin/telegraf-smartd',
},
}
@metadata_reactor.provides(
'smartd/disks',
@ -67,29 +83,6 @@ def icinga(metadata):
}
@metadata_reactor.provides(
'telegraf/input_plugins/builtin/smart',
)
def telegraf(metadata):
if not node.has_bundle('telegraf'):
raise DoNotRunAgain
if metadata.get('smartd/disks', set()):
return {
'telegraf': {
'input_plugins': {
'builtin': {
'smart': [{
'devices': list(sorted(metadata.get('smartd/disks'))),
}],
},
},
},
}
return {}
@metadata_reactor.provides(
'cron/jobs/smartd',
)