diff options
Diffstat (limited to 'roles/install_monitoring/templates/ffmyk-influx/func.php.j2')
-rw-r--r-- | roles/install_monitoring/templates/ffmyk-influx/func.php.j2 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/install_monitoring/templates/ffmyk-influx/func.php.j2 b/roles/install_monitoring/templates/ffmyk-influx/func.php.j2 new file mode 100644 index 0000000..fd2c248 --- /dev/null +++ b/roles/install_monitoring/templates/ffmyk-influx/func.php.j2 @@ -0,0 +1,17 @@ +<?php +function sendflux($data) { + $url = 'http://10.222.42.54: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); +} + +?> |