summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/templates/ffmyk-influx/func.php.j2
blob: b7b36098ca0e757e708a0efa1a5bc5d6afe22bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
function sendflux($data) {
        $url = 'http://[2a03:2260:1016:302:c03:19ff:fe06:285]:8086/write?db=freifunk';

        $options = array(
            'http' => array(
                'header'  => "Authorization: Basic " . base64_encode("{{ influx_user }}:{{ influx_password }}") ."\r\nContent-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => $data,
            ),
        );

        $context  = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
}

?>