bundles/grafana: replace the useless builtin of telegraf with something more useful
This commit is contained in:
parent
f6d6ef7aa7
commit
6b641890c3
5 changed files with 299 additions and 23 deletions
|
@ -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',
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue