bundles/vnstat: adjust vnstati calls for debian bullseye
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-04-11 09:01:58 +02:00
parent 69279ba34f
commit 26c2be07cf
Signed by: kunsi
GPG key ID: 12E3D2136B818350
6 changed files with 39 additions and 33 deletions

View file

@ -8,7 +8,9 @@ then
exit 1 exit 1
fi fi
vnstati --output "$TARGET/daily.png" --days vnstati --output "$TARGET/summary.png" --summary
vnstati --output "$TARGET/monthly.png" --months vnstati --output "$TARGET/top10.png" --top 10
vnstati --output "$TARGET/hours.png" --hoursgraph
vnstati --output "$TARGET/daily.png" --days 30
vnstati --output "$TARGET/monthly.png" --months 12
vnstati --output "$TARGET/yearly.png" --years vnstati --output "$TARGET/yearly.png" --years
vnstati --output "$TARGET/top10.png" --top10

View file

@ -6,11 +6,12 @@
</head> </head>
<body style="background-color: #333333; color: #FFFFFF; text-align: center;"> <body style="background-color: #333333; color: #FFFFFF; text-align: center;">
<h1>${node.name} - ${interface}</h1> <h1>${node.name} - ${interface}</h1>
<p><img src="/top10.png" alt="TOP 10 Days"></p> <p><img src="/summary.png" alt="Short summary"></p>
<p><img src="/yesterday.png" alt="Statistics for yesterday"></p> <p><img src="/top10.png" alt="Top 10 days"></p>
<p><img src="/daily.png" alt="Daily Statistics"></p> <p><img src="/hours.png" alt="Statistics for last 24h"></p>
<p><img src="/monthly.png" alt="monthly Statistics"></p> <p><img src="/daily.png" alt="Statistics for last 30 days"></p>
<p><img src="/yearly.png" alt=""></p> <p><img src="/monthly.png" alt="Statistics for last 12 months"></p>
<p><img src="/yearly.png" alt="Yearly Statistics"></p>
<p>All times in UTC</p> <p>All times in UTC</p>
</body> </body>
</html> </html>

View file

@ -0,0 +1,8 @@
[Unit]
Description=vnstati generator
After=network.target
[Service]
User=root
Group=root
ExecStart=/usr/local/bin/generate-vnstati /var/www/vnstat

View file

@ -0,0 +1,9 @@
[Unit]
Description=Generate vnstati graphs
[Timer]
OnCalendar=*:0/10
Persistent=false
[Install]
WantedBy=timers.target

View file

@ -1,4 +1,6 @@
files = { files = {
'/etc/systemd/system/vnstati.service': {},
'/etc/systemd/system/vnstati.timer': {},
'/etc/vnstat.conf': { '/etc/vnstat.conf': {
'content_type': 'mako', 'content_type': 'mako',
'context': node.metadata['vnstat'], 'context': node.metadata['vnstat'],
@ -11,7 +13,7 @@ files = {
}, },
} }
if node.metadata['vnstat'].get('generate-web-dashboard', False): if node.metadata.get('vnstat/generate-web-dashboard', False):
files['/var/www/vnstat/index.html'] = { files['/var/www/vnstat/index.html'] = {
'content_type': 'mako', 'content_type': 'mako',
'context': node.metadata['vnstat'], 'context': node.metadata['vnstat'],
@ -24,4 +26,12 @@ svc_systemd = {
'file:/etc/vnstat.conf', 'file:/etc/vnstat.conf',
}, },
}, },
'vnstati.timer': {
'needs': {
'file:/etc/systemd/system/vnstati.service',
'file:/etc/systemd/system/vnstati.timer',
},
'running': node.metadata.get('vnstat/generate-web-dashboard', False),
'enabled': node.metadata.get('vnstat/generate-web-dashboard', False),
},
} }

View file

@ -34,27 +34,3 @@ def get_default_interface(metadata):
} }
return {} 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': {},
},
},
}