gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / monitoring.scm
index bbfa495..78f94bb 100644 (file)
@@ -1,8 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
-;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
+;;; Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 (define-module (gnu packages monitoring)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
+  #:use-module (guix utils)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages curl)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages django)
   #:use-module (gnu packages gd)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages image)
   #:use-module (gnu packages mail)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages libevent)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
-  #:use-module (gnu packages time))
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages time)
+  #:use-module (gnu packages tls))
 
 (define-public nagios
   (package
@@ -135,6 +149,94 @@ etc. via a Web interface.  Features include:
 @end itemize\n")
     (license license:gpl2)))
 
+(define-public zabbix-agentd
+  (package
+    (name "zabbix-agentd")
+    (version "4.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/" version
+             "/zabbix-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0jjn2przn9s25slrcxmq8iqdgqkgxnqs45zy0n1ma6nlgmclxxqb"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list "--enable-agent"
+             (string-append "--with-iconv="
+                            (assoc-ref %build-inputs "libiconv"))
+             (string-append "--with-libpcre="
+                            (assoc-ref %build-inputs "pcre")))))
+    (inputs
+     `(("libiconv" ,libiconv)
+       ("pcre" ,pcre)))
+    (home-page "https://www.zabbix.com/")
+    (synopsis "Distributed monitoring solution (client-side agent)")
+    (description "This package provides a distributed monitoring
+solution (client-side agent)")
+    (license license:gpl2)))
+
+(define-public zabbix-server
+  (package
+    (inherit zabbix-agentd)
+    (name "zabbix-server")
+    (outputs '("out" "front-end" "schema"))
+    (arguments
+     (substitute-keyword-arguments
+         `(#:phases
+           (modify-phases %standard-phases
+             (add-after 'install 'install-front-end
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let* ((php (string-append (assoc-ref outputs "front-end")
+                                            "/share/zabbix/php"))
+                        (front-end-conf (string-append php "/conf"))
+                        (etc (string-append php "/etc")))
+                   (mkdir-p php)
+                   (copy-recursively "frontends/php" php)
+                   ;; Make front-end write config to ‘/etc/zabbix’ directory.
+                   (rename-file front-end-conf
+                                (string-append front-end-conf "-example"))
+                   (symlink "/etc/zabbix" front-end-conf))
+                 #t))
+             (add-after 'install 'install-schema
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let ((database-directory
+                        (string-append (assoc-ref outputs "schema")
+                                       "/database")))
+                   (for-each delete-file
+                             (find-files "database" "Makefile\\.in|\\.am$"))
+                   (mkdir-p database-directory)
+                   (copy-recursively "database" database-directory))
+                 #t)))
+           ,@(package-arguments zabbix-agentd))
+       ((#:configure-flags flags)
+        `(cons* "--enable-server"
+                "--with-postgresql"
+                (string-append "--with-libevent="
+                               (assoc-ref %build-inputs "libevent"))
+                "--with-net-snmp"
+                (string-append "--with-gnutls="
+                               (assoc-ref %build-inputs "gnutls"))
+                "--with-libcurl"
+                (string-append "--with-zlib="
+                               (assoc-ref %build-inputs "zlib"))
+                ,flags))))
+    (inputs
+     `(("curl" ,curl)
+       ("libevent" ,libevent)
+       ("gnutls" ,gnutls)
+       ("postgresql" ,postgresql)
+       ("zlib" ,zlib)
+       ("net-snmp" ,net-snmp)
+       ("curl" ,curl)
+       ,@(package-inputs zabbix-agentd)))
+    (synopsis "Distributed monitoring solution (server-side)")
+    (description "This package provides a distributed monitoring
+solution (server-side)")))
+
 (define-public darkstat
   (package
     (name "darkstat")
@@ -269,18 +371,20 @@ demand.")
 (define-public python-prometheus-client
   (package
     (name "python-prometheus-client")
-    (version "0.1.1")
+    (version "0.5.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "prometheus_client" version))
        (sha256
         (base32
-         "164qzzg8q8awqk0angcm87p2sjiibaj1wgjz0xk6j0klvqi5q2mz"))))
+         "0g7rpv1pq2lab1nfqdx98z9d3bqwc400alg1j4ynrpjkrbsizhg8"))))
     (build-system python-build-system)
     (arguments
      '(;; No included tests.
        #:tests? #f))
+    (propagated-inputs
+     `(("python-twisted" ,python-twisted)))
     (home-page
      "https://github.com/prometheus/client_python")
     (synopsis "Python client for the Prometheus monitoring system")
@@ -295,3 +399,51 @@ WSGI and the node exporter textfile collector.")
 
 (define-public python2-prometheus-client
   (package-with-python2 python-prometheus-client))
+
+(define-public go-github-com-prometheus-node-exporter
+  (let ((commit "55c32fcf02492fe4946f7ab563547cc5df7fc61e")
+        (revision "0"))
+    (package
+      (name "go-github-com-prometheus-node-exporter")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/prometheus/node_exporter.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "041b87a0sid23c29swqmi5hw6cxbxvkfj3415jg73cm2pi8wh5s6"))))
+      (build-system go-build-system)
+      (arguments
+       '(#:import-path "github.com/prometheus/node_exporter"))
+      (synopsis "Prometheus exporter for hardware and OS metrics")
+      (description "Prometheus exporter for metrics exposed by *NIX kernels,
+written in Go with pluggable metric collectors.")
+      (home-page "https://github.com/prometheus/node_exporter")
+      (license license:asl2.0))))
+
+(define-public fswatch
+  (package
+    (name "fswatch")
+    (version "1.14.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                      (url "https://github.com/emcrisostomo/fswatch.git")
+                      (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1ihn7wp3y7ml2lm8drz2hc6fmgj8kygbygnw8mz7gjax88f9dbx7"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)
+       ("libtool" ,libtool)))
+    (synopsis "File system monitor")
+    (description "This package provides a file system monitor.")
+    (home-page "https://github.com/emcrisostomo/fswatch")
+    (license license:gpl3+)))