bundles: add some telegraf plugins

This commit is contained in:
Franzi 2021-04-23 19:31:28 +02:00
parent 5e0541aef8
commit a37d31973a
Signed by: kunsi
GPG key ID: 12E3D2136B818350
12 changed files with 159 additions and 0 deletions

View file

@ -45,6 +45,15 @@ if node.has_bundle('postfixadmin'):
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'dovecot': [{}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'dovecot/admin_email', 'dovecot/admin_email',

View file

@ -74,6 +74,28 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['icinga2']['api_users']['telegraf'] = {
'password': repo.vault.password_for(f'{node.name} icinga2 api telegraf'),
'permissions': {
'objects/Services',
},
}
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'icinga2': [{
'server': 'https://127.0.0.1:5665',
'object_type': 'services',
'username': 'telegraf',
'password': repo.vault.password_for(f'{node.name} icinga2 api telegraf'),
'insecure_skip_verify': True,
}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'icinga2/icinga_users', 'icinga2/icinga_users',
) )

View file

@ -10,3 +10,12 @@ defaults = {
}, },
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'nfsclient': [{}],
},
},
}

View file

@ -35,6 +35,17 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'nginx': [{
'urls': ['http://localhost:22999/server_status'],
}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'nginx/worker_processes', 'nginx/worker_processes',

View file

@ -50,6 +50,15 @@ else:
}, },
}) })
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'postfix': [{}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'letsencrypt/domains', 'letsencrypt/domains',

View file

@ -37,6 +37,15 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'powerdns': [{}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'icinga2_api/powerdns/services', 'icinga2_api/powerdns/services',

View file

@ -19,3 +19,12 @@ defaults = {
}, },
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'redis': [{}],
},
},
}

View file

@ -56,3 +56,26 @@ 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', {}):
return {
'telegraf': {
'input_plugins': {
'builtin': {
'smart': [{
'devices': list(sorted(metadata.get('smartd/disks'))),
}],
},
},
},
}
return {}

View file

@ -27,3 +27,26 @@ def add_vlan_infos_to_interface(metadata):
return { return {
'interfaces': interfaces, 'interfaces': interfaces,
} }
@metadata_reactor.provides(
'telegraf/input_plugins/builtin/bond',
)
def telegraf(metadata):
if not node.has_bundle('telegraf'):
raise DoNotRunAgain
if metadata.get('systemd-networkd/bonds', {}):
return {
'telegraf': {
'input_plugins': {
'builtin': {
'bond': [{
'bond_interfaces': list(sorted(metadata.get('systemd-networkd/bonds').keys())),
}],
},
},
},
}
return {}

View file

@ -23,6 +23,18 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'unbound': [{
'thread_as_tag': True,
}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'unbound/threads', 'unbound/threads',

View file

@ -31,6 +31,16 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'wireguard': [{}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'wireguard/peers', 'wireguard/peers',

View file

@ -78,6 +78,19 @@ defaults = {
}, },
} }
if node.has_bundle('telegraf'):
defaults['telegraf'] = {
'input_plugins': {
'builtin': {
'zfs': [{
'poolMetrics': True,
'datasetMetrics': True,
}],
},
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'cron/zfs-scrub', 'cron/zfs-scrub',