1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
4 ;;; Copyright © 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
7 ;;; Copyright © 2018, 2019, 2020 Oleg Pykhalov <go.wigust@gmail.com>
8 ;;; Copyright © 2020 Alex ter Weele <alex.ter.weele@gmail.com>
9 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
10 ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages monitoring)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix build-system perl)
33 #:use-module (guix build-system python)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system go)
36 #:use-module (guix utils)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages admin)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages base)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages django)
46 #:use-module (gnu packages gd)
47 #:use-module (gnu packages gettext)
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages mail)
50 #:use-module (gnu packages ncurses)
51 #:use-module (gnu packages networking)
52 #:use-module (gnu packages libevent)
53 #:use-module (gnu packages pcre)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages python)
57 #:use-module (gnu packages python-web)
58 #:use-module (gnu packages python-xyz)
59 #:use-module (gnu packages rrdtool)
60 #:use-module (gnu packages time)
61 #:use-module (gnu packages tls)
62 #:use-module (gnu packages web))
68 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
72 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
73 version "/nagios-" version ".tar.gz"))
76 "1x5hb97zbvkm73q53ydp1gwj8nnznm72q9c4rm6ny7phr995l3db"))
77 (modules '((guix build utils)))
79 ;; Ensure reproducibility.
81 (substitute* (find-files "cgi" "\\.c$")
82 (("__DATE__") "\"1970-01-01\"")
83 (("__TIME__") "\"00:00:00\""))
85 (build-system gnu-build-system)
90 ("libpng-apng" ,libpng)
93 ("mailutils" ,mailutils)))
95 '(#:configure-flags (list "--sysconfdir=/etc"
97 ;; 'include/locations.h.in' defines file
98 ;; locations, and many things go directly under
99 ;; LOCALSTATEDIR, hence the extra '/nagios'.
100 "--localstatedir=/var/nagios"
104 (assoc-ref %build-inputs "mailutils")
106 #:make-flags '("all")
107 #:phases (modify-phases %standard-phases
108 (add-before 'build 'do-not-chown-to-nagios
110 ;; Makefiles do 'install -o nagios -g nagios', which
111 ;; doesn't work for us.
112 (substitute* (find-files "." "^Makefile$")
113 (("-o nagios -g nagios")
116 (add-before 'build 'do-not-create-sysconfdir
118 ;; Don't try to create /var upon 'make install'.
119 (substitute* "Makefile"
120 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
121 (string-append "# " all))
122 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
123 (string-append "# " all))
124 (("chmod g\\+s.*" all)
125 (string-append "# " all)))
127 (add-before 'build 'set-html/php-directory
129 ;; Install HTML and PHP files under 'share/nagios/html'
130 ;; instead of just 'share/'.
131 (substitute* '("html/Makefile" "Makefile")
133 "HTMLDIR = $(datarootdir)/nagios/html\n"))
135 #:tests? #f)) ;no 'check' target or similar
136 (home-page "https://www.nagios.org/")
137 (synopsis "Host, service, and network monitoring program")
139 "Nagios is a host, service, and network monitoring program written in C.
140 CGI programs are included to allow you to view the current status, history,
141 etc. via a Web interface. Features include:
144 @item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
145 @item Monitoring of host resources (processor load, disk usage, etc.).
146 @item A plugin interface to allow for user-developed service monitoring
148 @item Ability to define network host hierarchy using \"parent\" hosts,
149 allowing detection of and distinction between hosts that are down
150 and those that are unreachable.
151 @item Notifications when problems occur and get resolved (via email,
152 pager, or user-defined method).
153 @item Ability to define event handlers for proactive problem resolution.
154 @item Automatic log file rotation/archiving.
155 @item Optional web interface for viewing current network status,
156 notification and problem history, log file, etc.
158 (license license:gpl2)))
160 (define-public zabbix-agentd
162 (name "zabbix-agentd")
168 "https://cdn.zabbix.com/zabbix/sources/stable/"
169 (version-major+minor version) "/zabbix-" version ".tar.gz"))
171 (base32 "100n1rv7r4pqagxxifzpcza5bhrr2fklzx7gndxwiyq4597p1jvn"))))
172 (build-system gnu-build-system)
175 (list "--enable-agent"
177 (string-append "--with-iconv="
178 (assoc-ref %build-inputs "libiconv"))
179 (string-append "--with-libpcre="
180 (assoc-ref %build-inputs "pcre")))))
182 `(("libiconv" ,libiconv)
184 (home-page "https://www.zabbix.com/")
185 (synopsis "Distributed monitoring solution (client-side agent)")
186 (description "This package provides a distributed monitoring
187 solution (client-side agent)")
188 (license license:gpl2)))
190 (define-public zabbix-server
192 (inherit zabbix-agentd)
193 (name "zabbix-server")
194 (outputs '("out" "front-end" "schema"))
196 (substitute-keyword-arguments
198 (modify-phases %standard-phases
199 (add-after 'install 'install-front-end
200 (lambda* (#:key outputs #:allow-other-keys)
201 (let* ((php (string-append (assoc-ref outputs "front-end")
202 "/share/zabbix/php"))
203 (front-end-conf (string-append php "/conf"))
204 (etc (string-append php "/etc")))
206 (copy-recursively "ui" php)
207 ;; Make front-end write config to ‘/etc/zabbix’ directory.
208 (rename-file front-end-conf
209 (string-append front-end-conf "-example"))
210 (symlink "/etc/zabbix" front-end-conf))
212 (add-after 'install 'install-schema
213 (lambda* (#:key outputs #:allow-other-keys)
214 (let ((database-directory
215 (string-append (assoc-ref outputs "schema")
217 (for-each delete-file
218 (find-files "database" "Makefile\\.in|\\.am$"))
219 (mkdir-p database-directory)
220 (copy-recursively "database" database-directory))
222 ,@(package-arguments zabbix-agentd))
223 ((#:configure-flags flags)
224 `(cons* "--enable-server"
226 (string-append "--with-libevent="
227 (assoc-ref %build-inputs "libevent"))
229 (string-append "--with-gnutls="
230 (assoc-ref %build-inputs "gnutls"))
232 (string-append "--with-zlib="
233 (assoc-ref %build-inputs "zlib"))
237 ("libevent" ,libevent)
239 ("postgresql" ,postgresql)
241 ("net-snmp" ,net-snmp)
243 ,@(package-inputs zabbix-agentd)))
244 (synopsis "Distributed monitoring solution (server-side)")
245 (description "This package provides a distributed monitoring
246 solution (server-side)")))
248 (define-public zabbix-cli
255 (url "https://github.com/unioslo/zabbix-cli")
257 (file-name (git-file-name name version))
260 "0wzmrn8p09ksqhhgawr179c4az7p2liqr0l4q2dra62bxliawyqz"))))
261 (build-system python-build-system)
263 '(#:phases (modify-phases %standard-phases
264 (add-after 'unpack 'use-absolute-ncurses
266 (substitute* "bin/zabbix-cli"
268 (string-append "'" (which "clear") "'")))))
269 (add-after 'unpack 'patch-setup.py
271 ;; Install data_files to $out/share instead of /usr/share.
272 (substitute* "setup.py"
276 ("python-requests" ,python-requests)))
277 (home-page "https://github.com/unioslo/zabbix-cli")
278 (synopsis "Command-line interface to Zabbix")
280 "@command{zabbix-cli} is a command-line client for the Zabbix
281 monitoring system. It can configure and display various aspects of Zabbix
282 through a text-based interface.")
283 (license license:gpl3+)))
285 (define-public python-pyzabbix
287 (name "python-pyzabbix")
289 (home-page "https://github.com/lukecyca/pyzabbix")
290 ;; No tests on PyPI, use the git checkout.
294 (uri (git-reference (url home-page) (commit version)))
295 (file-name (git-file-name name version))
298 "15rrnpkv94wx6748hh4sd120v6x25rkbd6vlz6hfrhvjwxz5lgjl"))))
299 (build-system python-build-system)
301 '(#:phases (modify-phases %standard-phases
302 (add-after 'unpack 'patch
304 ;; Permit newer versions of httpretty.
305 (substitute* "setup.py"
306 (("httpretty<0\\.8\\.7")
309 (lambda* (#:key tests? #:allow-other-keys)
311 (invoke "python" "setup.py" "nosetests")
312 (format #t "test suite not run~")))))))
315 ("python-httpretty" ,python-httpretty)
316 ("python-nose" ,python-nose)))
318 `(("python-requests" ,python-requests)))
319 (synopsis "Python interface to the Zabbix API")
321 "@code{pyzabbix} is a Python module for working with the Zabbix API.")
322 (license license:lgpl2.1+)))
324 (define-public darkstat
330 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
334 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
335 (build-system gnu-build-system)
336 (arguments '(#:tests? #f)) ; no tests
338 `(("libpcap" ,libpcap)
340 (home-page "https://unix4lyfe.org/darkstat/")
341 (synopsis "Network statistics gatherer")
343 "@command{darkstat} is a packet sniffer that runs as a background process,
344 gathers all sorts of statistics about network usage, and serves them over
348 @item Traffic graphs, reports per host, shows ports for each host.
349 @item Embedded web-server with deflate compression.
350 @item Asynchronous reverse DNS resolution using a child process.
351 @item Small. Portable. Single-threaded. Efficient.
354 (license license:gpl2)))
356 (define-public python-whisper
358 (name "python-whisper")
363 (uri (pypi-uri "whisper" version))
366 "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3"))))
367 (build-system python-build-system)
368 (home-page "http://graphiteapp.org/")
369 (synopsis "Fixed size round-robin style database for Graphite")
370 (description "Whisper is one of three components within the Graphite
371 project. Whisper is a fixed-size database, similar in design and purpose to
372 RRD (round-robin-database). It provides fast, reliable storage of numeric
373 data over time. Whisper allows for higher resolution (seconds per point) of
374 recent data to degrade into lower resolutions for long-term retention of
376 (license license:asl2.0)))
378 (define-public python2-whisper
379 (package-with-python2 python-whisper))
381 (define-public python2-carbon
383 (name "python2-carbon")
388 (uri (pypi-uri "carbon" version))
391 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
392 (build-system python-build-system)
394 `(#:python ,python-2 ; only supports Python 2
396 (modify-phases %standard-phases
397 ;; Don't install to /opt
398 (add-after 'unpack 'do-not-install-to-/opt
399 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
401 `(("python2-whisper" ,python2-whisper)
402 ("python2-configparser" ,python2-configparser)
403 ("python2-txamqp" ,python2-txamqp)))
404 (home-page "http://graphiteapp.org/")
405 (synopsis "Backend data caching and persistence daemon for Graphite")
406 (description "Carbon is a backend data caching and persistence daemon for
407 Graphite. Carbon is responsible for receiving metrics over the network,
408 caching them in memory for \"hot queries\" from the Graphite-Web application,
409 and persisting them to disk using the Whisper time-series library.")
410 (license license:asl2.0)))
412 (define-public graphite-web
414 (name "graphite-web")
419 (uri (pypi-uri "graphite-web" version))
422 "1l5a5rry9cakqxamvlx4xq63jifmncb6815bg9vy7fg1zyd3pjxk"))))
423 (build-system python-build-system)
425 `(#:tests? #f ;XXX: not in PyPI release & requires database
427 (modify-phases %standard-phases
428 (add-after 'unpack 'relax-requirements
430 (substitute* "setup.py"
431 ;; Allow newer versions of django-tagging.
432 (("django-tagging==")
435 ;; Don't install to /opt
436 (add-after 'unpack 'do-not-install-to-/opt
437 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
439 `(("python-cairocffi" ,python-cairocffi)
440 ("python-pytz" ,python-pytz)
441 ("python-whisper" ,python-whisper)
442 ("python-django" ,python-django-2.2)
443 ("python-django-tagging" ,python-django-tagging)
444 ("python-scandir" ,python-scandir)
445 ("python-urllib3" ,python-urllib3)
446 ("python-pyparsing" ,python-pyparsing)
447 ("python-txamqp" ,python-txamqp)))
448 (home-page "https://graphiteapp.org/")
449 (synopsis "Scalable realtime graphing system")
450 (description "Graphite is a scalable real-time graphing system that does
451 two things: store numeric time-series data, and render graphs of this data on
453 (license license:asl2.0)))
455 (define-public python2-graphite-web
456 (deprecated-package "python2-graphite-web" graphite-web))
458 (define-public python-prometheus-client
460 (name "python-prometheus-client")
465 (uri (pypi-uri "prometheus_client" version))
467 (base32 "1ni2yv4ixwz32nz39ckia76lvggi7m19y5f702w5qczbnfi29kbi"))))
468 (build-system python-build-system)
470 '(;; No included tests.
473 `(("python-twisted" ,python-twisted)))
475 "https://github.com/prometheus/client_python")
476 (synopsis "Python client for the Prometheus monitoring system")
478 "The @code{prometheus_client} package supports exposing metrics from
479 software written in Python, so that they can be scraped by a Prometheus
482 Metrics can be exposed through a standalone web server, or through Twisted,
483 WSGI and the node exporter textfile collector.")
484 (license license:asl2.0)))
486 (define-public python2-prometheus-client
487 (package-with-python2 python-prometheus-client))
489 (define-public go-github-com-prometheus-node-exporter
491 (name "go-github-com-prometheus-node-exporter")
496 (url "https://github.com/prometheus/node_exporter")
497 (commit (string-append "v" version))))
498 (file-name (git-file-name name version))
501 "0s3sp1gj86p7npxl38hkgs6ymd3wjjmc5hydyg1b5wh0x3yvpx07"))))
502 (build-system go-build-system)
504 '(#:import-path "github.com/prometheus/node_exporter"))
505 (synopsis "Prometheus exporter for hardware and OS metrics")
506 (description "Prometheus exporter for metrics exposed by *NIX kernels,
507 written in Go with pluggable metric collectors.")
508 (home-page "https://github.com/prometheus/node_exporter")
509 (license license:asl2.0)))
511 (define-public temper-exporter
512 (let ((commit "a87bbab19c05609d62d9e4c7941178700c1ef84d")
515 (name "temper-exporter")
516 (version (git-version "0" revision commit))
520 (url "https://github.com/yrro/temper-exporter")
522 (file-name (git-file-name name version))
525 "0jk3ydi8s14q5kyl9j3gm2zrnwlb1jwjqpg5vqrgkbm9jrldrabc"))))
526 (build-system python-build-system)
528 '(#:tests? #f ; One test failure:
529 ; test/test_exporter.py:33:
532 (modify-phases %standard-phases
533 (add-after 'unpack 'patch-setup.py
535 (substitute* "setup.py"
536 (("git_ref = .*\n") "git_ref = ''\n"))
538 (add-after 'install 'install-udev-rules
539 (lambda* (#:key outputs #:allow-other-keys)
540 (install-file "debian/prometheus-temper-exporter.udev"
541 (string-append (assoc-ref outputs "out")
542 "/lib/udev/rules.d"))
545 `(("python-prometheus-client" ,python-prometheus-client)
546 ("python-pyudev" ,python-pyudev)))
548 `(("python-pytest" ,python-pytest)
549 ("python-pytest-mock" ,python-pytest-mock)
550 ("python-pytest-runner" ,python-pytest-runner)))
551 (home-page "https://github.com/yrro/temper-exporter")
552 (synopsis "Prometheus exporter for PCSensor TEMPer sensor devices")
554 "This package contains a Prometheus exporter for the TEMPer sensor
556 (license license:expat))))
558 (define-public fswatch
565 (url "https://github.com/emcrisostomo/fswatch")
567 (file-name (git-file-name name version))
570 "1yz65jsbgdx4cmy16x24wz5di352lvyi7fp6jm90bhgl1vpzxlsx"))))
571 (build-system gnu-build-system)
573 `(("autoconf" ,autoconf)
574 ("automake" ,automake)
575 ("gettext" ,gettext-minimal)
576 ("libtool" ,libtool)))
577 (synopsis "File system monitor")
578 (description "This package provides a file system monitor.")
579 (home-page "https://github.com/emcrisostomo/fswatch")
580 (license license:gpl3+)))
582 (define-public collectd
589 "https://storage.googleapis.com/collectd-tarballs/collectd-"
594 "1mh97afgq6qgmpvpr84zngh58m0sl1b4wimqgvvk376188q09bjv"))
595 (patches (search-patches "collectd-5.11.0-noinstallvar.patch"))))
596 (build-system gnu-build-system)
598 `(#:configure-flags (list "--localstatedir=/var" "--sysconfdir=/etc")
599 #:phases (modify-phases %standard-phases
600 (add-before 'configure 'autoreconf
602 ;; Required because of patched sources.
603 (invoke "autoreconf" "-vfi"))))))
605 `(("rrdtool" ,rrdtool)
607 ("libyajl" ,libyajl)))
609 `(("autoconf" ,autoconf)
610 ("automake" ,automake)
612 ("pkg-config" ,pkg-config)))
613 (home-page "https://collectd.org/")
614 (synopsis "Collect system and application performance metrics periodically")
616 "collectd gathers metrics from various sources such as the operating system,
617 applications, log files and external devices, and stores this information or
618 makes it available over the network. Those statistics can be used to monitor
619 systems, find performance bottlenecks (i.e., performance analysis) and predict
620 future system load (i.e., capacity planning).")
621 ;; license:expat for the daemon in src/daemon/ and some plugins,
622 ;; license:gpl2 for other plugins
623 (license (list license:expat license:gpl2))))