blob: 9a848daa520eede0b66dc5a419dcdb0370e358be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
require('func.php');
function traffic($iface, $alias=false) {
if(!$alias) $alias = $iface;
$rx = file_get_contents('/sys/class/net/'.$iface.'/statistics/rx_bytes');
$tx = file_get_contents('/sys/class/net/'.$iface.'/statistics/tx_bytes');
$data = 'rx,if='.$alias.',host={{ ansible_hostname }},type=backend value='.$rx."\n";
$data.= 'tx,if='.$alias.',host={{ ansible_hostname }},type=backend value='.$tx;
sendflux($data);
}
(traffic('{{ ansible_default_ipv4.interface }}', 'wan'));
{% if ansible_default_ipv4.interface != ansible_default_ipv6.interface %}
(traffic('{{ ansible_default_ipv6.interface }}', 'wan6'));
{% endif %}
{% for site in sites %}
(traffic('bat{{ site.name }}'));
(traffic('vpn{{ site.name }}'));
(traffic('wg{{ site.name }}'));
{% endfor %}
?>
|