bundlewrap/bundles/vnstat/metadata.py
Franziska Kunsmann 5935aed0db
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/{netdata,pppd,radvd,vmhost,vnstat,wide-dhcp6c}: add monitoring
2020-12-21 09:50:15 +01:00

55 lines
1.3 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
def get_default_interface(metadata):
interfaces = sorted(metadata.get('interfaces', {}).keys())
if len(interfaces):
return {
'vnstat': {
'interface': interfaces[0],
},
}
return {}
@metadata_reactor
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': {},
},
},
}