2020-11-16 15:33:26 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'vnstat': {},
|
|
|
|
'vnstati': {},
|
|
|
|
},
|
|
|
|
},
|
2020-12-21 08:50:15 +00:00
|
|
|
'icinga2_api': {
|
|
|
|
'vnstat': {
|
|
|
|
'services': {
|
|
|
|
'VNSTATD PROCESS': {
|
|
|
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C vnstatd -c 1:',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-11-16 15:33:26 +00:00
|
|
|
'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 {}
|
2020-11-16 16:07:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
@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': {
|
2020-11-19 15:52:45 +00:00
|
|
|
'vnstat_yesterday_graph': '0 0 * * * root /usr/bin/vnstati --output "/var/www/vnstat/yesterday.png" --hours > /dev/null 2>/dev/null',
|
2020-11-16 16:10:14 +00:00
|
|
|
'vnstat_generate_web_dashboard': '*/10 * * * * root /usr/local/bin/generate-vnstati /var/www/vnstat > /dev/null 2>/dev/null',
|
2020-11-16 16:07:05 +00:00
|
|
|
},
|
|
|
|
'nginx': {
|
|
|
|
'vhosts': {
|
|
|
|
'vnstat': {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|