summaryrefslogtreecommitdiff
path: root/app-metrics/github-exporter/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-01-12 16:58:08 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-01-12 16:58:08 +0000
commitc8a77dfe4d3d307c1d5dd2650b7297447d8b609d (patch)
tree9ea78393bc3ecd6ab4de449383d4e97e5f3648ae /app-metrics/github-exporter/files
parent2891d29af8907ce881662f4a02844926d7a293c7 (diff)
gentoo resync : 12.01.2019
Diffstat (limited to 'app-metrics/github-exporter/files')
-rw-r--r--app-metrics/github-exporter/files/github-exporter.confd14
-rw-r--r--app-metrics/github-exporter/files/github-exporter.initd53
2 files changed, 67 insertions, 0 deletions
diff --git a/app-metrics/github-exporter/files/github-exporter.confd b/app-metrics/github-exporter/files/github-exporter.confd
new file mode 100644
index 000000000000..35368901c8f1
--- /dev/null
+++ b/app-metrics/github-exporter/files/github-exporter.confd
@@ -0,0 +1,14 @@
+# settings for github-exporter
+
+# I will list the required variables here, but there are several more.
+# Please see the README for all of them.
+
+# LISTEN_PORT specifies the port the exporter will use. Below is the default.
+# LISTEN_PORT=9171
+
+# ORGS should contain a list of github organizations you wish to monitor.
+# ORGS="org1,org2"
+
+# REPOS should contain a list of github repos you want tomonitor.
+# If neither ORGS nor REPOS is set, the exporter will refuse to run.
+# REPOS="user1/repo1,user2/repo2"
diff --git a/app-metrics/github-exporter/files/github-exporter.initd b/app-metrics/github-exporter/files/github-exporter.initd
new file mode 100644
index 000000000000..45ea133260af
--- /dev/null
+++ b/app-metrics/github-exporter/files/github-exporter.initd
@@ -0,0 +1,53 @@
+#!/sbin/openrc-run
+
+description="github exporter for Prometheus"
+command=/usr/bin/github-exporter
+command_background=yes
+command_user=${RC_SVCNAME}:${RC_SVCNAME}
+pidfile=/var/run/github-exporter.pid
+error_log="/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
+output_log="/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
+
+depend() {
+ after net
+}
+
+start_pre() {
+ local env_args
+ if [ -z "${ORGS}" ] && [ -z "${REPOS}" ]; then
+ eerror "ORGS and / or REPOS must be set."
+ return 1
+ fi
+ if [ -n "${GITHUB_TOKEN}" ] && [ -n "${GITHUB_TOKEN_FILE}" ]; then
+ eerror "Please set only one of GITHUB_TOKEN or GITHUB_TOKEN_FILE"
+ return 1
+ fi
+ if [ -n "${API_URL}" ]; then
+ env_args="${env_args} -e API_URL=${API_URL}"
+ fi
+ if [ -n "${GITHUB_TOKEN}" ]; then
+ env_args="${env_args} -e GITHUB_TOKEN=${GITHUB_TOKEN}"
+ elif [ -n "${GITHUB_TOKEN_FILE}" ]; then
+ env_args="${env_args} -e GITHUB_TOKEN_FILE=${GITHUB_TOKEN_FILE}"
+ fi
+ if [ -z "${LISTEN_PORT}" ]; then
+ env_args="${env_args} -e LISTEN_PORT=9171"
+ else
+ env_args="${env_args} -e LISTEN_PORT=${LISTEN_PORT}"
+ fi
+ if [ -n "${LOG_LEVEL}" ]; then
+ env_args="${env_args} -e LOG_LEVEL=${LOG_LEVEL}"
+ fi
+ if [ -n "${METRICS_PATH}" ]; then
+ env_args="${env_args} -e METRICS_PATH=${METRICS_PATH}"
+ fi
+ if [ -n "${ORGS}" ]; then
+ env_args="${env_args} -e ORGS=${ORGS}"
+ fi
+ if [ -n "${REPOS}" ]; then
+ env_args="${env_args} -e REPOS=${REPOS}"
+ fi
+ start_stop_daemon_args="${start_stop_daemon_args} ${env_args}"
+ supervise_daemon_args="${supervise_daemon_args} ${env_args}"
+ return 0
+}