all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gábor Boskovits" <boskovits@gmail.com>
To: 31911@debbugs.gnu.org
Cc: "Gábor Boskovits" <boskovits@gmail.com>
Subject: [bug#31911] [PATCH] services: Add prometheus-node-exporter-service-type.
Date: Wed, 20 Jun 2018 14:59:46 +0200	[thread overview]
Message-ID: <20180620125946.7264-1-boskovits@gmail.com> (raw)

* gnu/services/monitoring.scm (prometheus-node-exporter-service-type):
New variable.
(<prometheus-node-exporter-configuration>): New record type.
(prometheus-node-exporter-shepherd-service): New procedure.
* gnu/doc/guix.texi (Monitoring Services): Document it.
---
 doc/guix.texi               | 32 ++++++++++++++++++++++++++++++++
 gnu/services/monitoring.scm | 37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 1ecb11002..6a649c549 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15570,6 +15570,38 @@ Specify the path of the base URL.  This can be useful if
 @end table
 @end deftp
 
+@subsubheading Prometheus Node Exporter Service
+@cindex prometheus-node-exporter
+Prometheus node exporter is a Prometheus exporter. It makes hardware and
+operating system statistics provided by *NIX kernels available for the
+Prometheus monitoring system. This service should be deployed on all
+physical nodes and virtual machines, where monitoring these statistics is
+desirable.
+
+@defvar {Scheme variable} prometheus-node-exporter-service-type
+This is the service type for the
+@uref{https://github.com/prometheus/node_exporter/, prometheus-node-exporter}
+service, its value must be a @code{prometheus-node-exporter-configuration}
+record as in this example:
+
+@example
+(service prometheus-node-exporter-service-type
+         (prometheus-node-exporter-configuration
+           (web-listen-address ":9100")))
+@end example
+@end defvar
+
+@deftp {Data Type} prometheus-node-exporter-configuration
+Data type representing the configuration of @command{node_exporter}.
+
+@table @asis
+@item @code{package} (default: @code{go-github-com-prometheus-node-exporter})
+The prometheus-node-exporter package to use.
+@item @code{web-listen-address} (default: @code{":9100"})
+Bind the web interface to the specified address.
+
+@end table
+@end deftp
 
 @node Kerberos Services
 @subsubsection Kerberos Services
diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm
index 49a65db4b..2fc90c867 100644
--- a/gnu/services/monitoring.scm
+++ b/gnu/services/monitoring.scm
@@ -26,7 +26,9 @@
   #:use-module (guix records)
   #:use-module (ice-9 match)
   #:export (darkstat-configuration
-            darkstat-service-type))
+            prometheus-node-exporter-configuration
+            darkstat-service-type
+            prometheus-node-exporter-service-type))
 
 \f
 ;;;
@@ -89,3 +91,36 @@ HTTP.")
                              (const %darkstat-accounts))
           (service-extension shepherd-root-service-type
                              (compose list darkstat-shepherd-service))))))
+
+(define-record-type* <prometheus-node-exporter-configuration>
+  prometheus-node-exporter-configuration
+  make-prometheus-node-exporter-configuration
+  prometheus-node-exporter-configuration?
+  (package prometheus-node-exporter-configuration-package
+           (default go-github-com-prometheus-node-exporter))
+  (web-listen-address prometheus-node-exporter-web-listen-address
+                      (default ":9100")))
+
+(define prometheus-node-exporter-shepherd-service
+  (match-lambda
+    (( $ <prometheus-node-exporter-configuration>
+         package web-listen-address)
+     (shepherd-service
+      (documentation "Prometheus node exporter.")
+      (provision '(prometheus-node-exporter))
+      (requirement '(networking))
+      (start #~(make-forkexec-constructor
+                (list #$(file-append package "/bin/node_exporter")
+                      "--web.listen-address" #$web-listen-address)))
+      (stop #~(make-kill-destructor))))))
+
+(define prometheus-node-exporter-service-type
+  (service-type
+   (name 'prometheus-node-exporter)
+   (description
+    "Run @command{node_exporter} to serve hardware and OS metrics to
+prometheus.")
+   (extensions
+    (list (service-extension
+           shepherd-root-service-type
+           (compose list prometheus-node-exporter-shepherd-service))))))
-- 
2.17.1

             reply	other threads:[~2018-06-20 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 12:59 Gábor Boskovits [this message]
2018-06-23 21:51 ` [bug#31911] [PATCH] services: Add prometheus-node-exporter-service-type Ludovic Courtès
2018-06-25  8:31   ` Gábor Boskovits
2018-06-25  8:56     ` Ludovic Courtès
2018-07-07 15:54       ` Ludovic Courtès
2018-07-07 18:14         ` Gábor Boskovits
2018-07-09  8:43 ` bug#31911: " Gábor Boskovits
2018-07-09  9:17   ` [bug#31911] " Clément Lassieur
2018-07-09 14:12     ` Gábor Boskovits
2018-07-09 14:21       ` Clément Lassieur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180620125946.7264-1-boskovits@gmail.com \
    --to=boskovits@gmail.com \
    --cc=31911@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.