bundlewrap/bundles/vnstat/metadata.py
Franziska Kunsmann f52df58517
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles: code style improvements
2021-02-12 20:45:41 +01:00

60 lines
1.4 KiB
Python

defaults = {
'apt': {
'packages': {
'vnstat': {},
'vnstati': {},
},
},
'icinga2_api': {
'vnstat': {
'services': {
'VNSTATD PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C vnstatd -c 1:',
},
},
},
},
'vnstat': {
'bandwidth': '1000',
},
}
@metadata_reactor.provides(
'vnstat/interface',
)
def get_default_interface(metadata):
interfaces = sorted(metadata.get('interfaces', {}).keys())
if interfaces:
return {
'vnstat': {
'interface': interfaces[0],
},
}
return {}
@metadata_reactor.provides(
'cron',
'nginx/vhosts/vnstat',
)
def nginx_dashboard(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
if not metadata.get('vnstat/generate-web-dashboard', False):
return {}
return {
'cron': {
'vnstat_yesterday_graph': '0 0 * * * root /usr/bin/vnstati --output "/var/www/vnstat/yesterday.png" --hours > /dev/null 2>/dev/null',
'vnstat_generate_web_dashboard': '*/10 * * * * root /usr/local/bin/generate-vnstati /var/www/vnstat > /dev/null 2>/dev/null',
},
'nginx': {
'vhosts': {
'vnstat': {},
},
},
}