summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/templates/ffmyk-influx/func.php.j2
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-20 20:56:39 +0100
committerNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-20 20:56:39 +0100
commiteade06a930c16f5cb08edd454d9e41364edf8103 (patch)
tree51dde0c60cf6c6486269edaa574efad4ad4d90a1 /roles/install_monitoring/templates/ffmyk-influx/func.php.j2
parent892aba103d0b58a888813a42bbb0fb00e852adfd (diff)
install_monitoring: added ffmyk-influx
Diffstat (limited to 'roles/install_monitoring/templates/ffmyk-influx/func.php.j2')
-rw-r--r--roles/install_monitoring/templates/ffmyk-influx/func.php.j217
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);
+}
+
+?>