aboutsummaryrefslogtreecommitdiff
path: root/utils/prometheus/files
diff options
context:
space:
mode:
authorPaul Spooren <spooren@informatik.uni-leipzig.de>2018-02-10 20:38:21 +0100
committerPaul Spooren <mail@aparcar.org>2018-07-26 20:29:35 +0900
commit5290727e64a00b8799d1806e6bfd8d7aef59a4ea (patch)
treedef4ab89c3fdfcf57b45153d3b2dca8edf6904ba /utils/prometheus/files
parentfbffa348ef24c9c68a850f4a02a7f7bc94a4fc96 (diff)
prometheus: add package
Compile tested: x86/64, aarch64_cortex-a53 Run tested: x86/64 Signed-off-by: Paul Spooren <spooren@informatik.uni-leipzig.de> Signed-off-by: Paul Spooren <mail@aparcar.org>
Diffstat (limited to 'utils/prometheus/files')
-rwxr-xr-xutils/prometheus/files/etc/init.d/prometheus27
-rw-r--r--utils/prometheus/files/etc/prometheus.yml29
-rwxr-xr-xutils/prometheus/files/etc/uci-defaults/prometheus-defaults13
-rw-r--r--utils/prometheus/files/prometheus.yml29
4 files changed, 98 insertions, 0 deletions
diff --git a/utils/prometheus/files/etc/init.d/prometheus b/utils/prometheus/files/etc/init.d/prometheus
new file mode 100755
index 000000000..a652ddfc6
--- /dev/null
+++ b/utils/prometheus/files/etc/init.d/prometheus
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+
+START=70
+
+USE_PROCD=1
+PROG=/usr/bin/prometheus
+CONFFILE=/etc/prometheus.yml
+
+start_service() {
+ local config_file
+ local storage_tsdb_path
+ local web_listen_address
+ config_load "prometheus"
+ config_get config_file prometheus config_file "$CONFFILE"
+ config_get storage_tsdb_path prometheus storage_tsdb_path "/data"
+ config_get web_listen_address prometheus web_listen_address "127.0.0.1:9090"
+
+ procd_open_instance
+ procd_set_param command "$PROG"
+ procd_append_param command --config.file="$config_file"
+ procd_append_param command --storage.tsdb.path="$storage_tsdb_path"
+ procd_append_param command --web.listen-address="$web_listen_address"
+ procd_append_param user "prometheus"
+ procd_set_param file "$config_file"
+ procd_set_param respawn
+ procd_close_instance
+}
diff --git a/utils/prometheus/files/etc/prometheus.yml b/utils/prometheus/files/etc/prometheus.yml
new file mode 100644
index 000000000..af33d8704
--- /dev/null
+++ b/utils/prometheus/files/etc/prometheus.yml
@@ -0,0 +1,29 @@
+# my global config
+global:
+ scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
+ evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
+ # scrape_timeout is set to the global default (10s).
+
+# Alertmanager configuration
+alerting:
+ alertmanagers:
+ - static_configs:
+ - targets:
+ # - alertmanager:9093
+
+# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
+rule_files:
+ # - "first_rules.yml"
+ # - "second_rules.yml"
+
+# A scrape configuration containing exactly one endpoint to scrape:
+# Here it's Prometheus itself.
+scrape_configs:
+ # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
+ - job_name: 'prometheus'
+
+ # metrics_path defaults to '/metrics'
+ # scheme defaults to 'http'.
+
+ static_configs:
+ - targets: ['localhost:9090']
diff --git a/utils/prometheus/files/etc/uci-defaults/prometheus-defaults b/utils/prometheus/files/etc/uci-defaults/prometheus-defaults
new file mode 100755
index 000000000..2ce745259
--- /dev/null
+++ b/utils/prometheus/files/etc/uci-defaults/prometheus-defaults
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+[ -e /etc/config/prometheus ] || touch /etc/config/prometheus
+
+uci -q get prometheus.prometheus || {
+ uci -q batch <<EOF
+ set prometheus.prometheus=prometheus
+ set prometheus.prometheus.config_file='/etc/prometheus.yml'
+ set prometheus.prometheus.storage_tsdb_path='/data'
+ set prometheus.prometheus.web_listen_address='127.0.0.1:9090'
+ commit prometheus
+EOF
+}
diff --git a/utils/prometheus/files/prometheus.yml b/utils/prometheus/files/prometheus.yml
new file mode 100644
index 000000000..af33d8704
--- /dev/null
+++ b/utils/prometheus/files/prometheus.yml
@@ -0,0 +1,29 @@
+# my global config
+global:
+ scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
+ evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
+ # scrape_timeout is set to the global default (10s).
+
+# Alertmanager configuration
+alerting:
+ alertmanagers:
+ - static_configs:
+ - targets:
+ # - alertmanager:9093
+
+# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
+rule_files:
+ # - "first_rules.yml"
+ # - "second_rules.yml"
+
+# A scrape configuration containing exactly one endpoint to scrape:
+# Here it's Prometheus itself.
+scrape_configs:
+ # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
+ - job_name: 'prometheus'
+
+ # metrics_path defaults to '/metrics'
+ # scheme defaults to 'http'.
+
+ static_configs:
+ - targets: ['localhost:9090']