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 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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages monitoring)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix build-system perl)
32 #:use-module (guix build-system python)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system go)
35 #:use-module (guix utils)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages admin)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages curl)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages django)
45 #:use-module (gnu packages gd)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages mail)
49 #:use-module (gnu packages networking)
50 #:use-module (gnu packages libevent)
51 #:use-module (gnu packages pcre)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages python-web)
56 #:use-module (gnu packages python-xyz)
57 #:use-module (gnu packages rrdtool)
58 #:use-module (gnu packages time)
59 #:use-module (gnu packages tls)
60 #:use-module (gnu packages web))
66 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
70 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
71 version "/nagios-" version ".tar.gz"))
74 "1x5hb97zbvkm73q53ydp1gwj8nnznm72q9c4rm6ny7phr995l3db"))
75 (modules '((guix build utils)))
77 ;; Ensure reproducibility.
79 (substitute* (find-files "cgi" "\\.c$")
80 (("__DATE__") "\"1970-01-01\"")
81 (("__TIME__") "\"00:00:00\""))
83 (build-system gnu-build-system)
88 ("libpng-apng" ,libpng)
91 ("mailutils" ,mailutils)))
93 '(#:configure-flags (list "--sysconfdir=/etc"
95 ;; 'include/locations.h.in' defines file
96 ;; locations, and many things go directly under
97 ;; LOCALSTATEDIR, hence the extra '/nagios'.
98 "--localstatedir=/var/nagios"
102 (assoc-ref %build-inputs "mailutils")
104 #:make-flags '("all")
105 #:phases (modify-phases %standard-phases
106 (add-before 'build 'do-not-chown-to-nagios
108 ;; Makefiles do 'install -o nagios -g nagios', which
109 ;; doesn't work for us.
110 (substitute* (find-files "." "^Makefile$")
111 (("-o nagios -g nagios")
114 (add-before 'build 'do-not-create-sysconfdir
116 ;; Don't try to create /var upon 'make install'.
117 (substitute* "Makefile"
118 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
119 (string-append "# " all))
120 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
121 (string-append "# " all))
122 (("chmod g\\+s.*" all)
123 (string-append "# " all)))
125 (add-before 'build 'set-html/php-directory
127 ;; Install HTML and PHP files under 'share/nagios/html'
128 ;; instead of just 'share/'.
129 (substitute* '("html/Makefile" "Makefile")
131 "HTMLDIR = $(datarootdir)/nagios/html\n"))
133 #:tests? #f)) ;no 'check' target or similar
134 (home-page "https://www.nagios.org/")
135 (synopsis "Host, service, and network monitoring program")
137 "Nagios is a host, service, and network monitoring program written in C.
138 CGI programs are included to allow you to view the current status, history,
139 etc. via a Web interface. Features include:
142 @item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
143 @item Monitoring of host resources (processor load, disk usage, etc.).
144 @item A plugin interface to allow for user-developed service monitoring
146 @item Ability to define network host hierarchy using \"parent\" hosts,
147 allowing detection of and distinction between hosts that are down
148 and those that are unreachable.
149 @item Notifications when problems occur and get resolved (via email,
150 pager, or user-defined method).
151 @item Ability to define event handlers for proactive problem resolution.
152 @item Automatic log file rotation/archiving.
153 @item Optional web interface for viewing current network status,
154 notification and problem history, log file, etc.
156 (license license:gpl2)))
158 (define-public zabbix-agentd
160 (name "zabbix-agentd")
166 "https://cdn.zabbix.com/zabbix/sources/stable/"
167 (version-major+minor version) "/zabbix-" version ".tar.gz"))
169 (base32 "1dc3fb9pa2cr6mfwgfyy1hpx26pbrws7989wj2kiiilmvimvrz1l"))))
170 (build-system gnu-build-system)
173 (list "--enable-agent"
174 (string-append "--with-iconv="
175 (assoc-ref %build-inputs "libiconv"))
176 (string-append "--with-libpcre="
177 (assoc-ref %build-inputs "pcre")))))
179 `(("libiconv" ,libiconv)
181 (home-page "https://www.zabbix.com/")
182 (synopsis "Distributed monitoring solution (client-side agent)")
183 (description "This package provides a distributed monitoring
184 solution (client-side agent)")
185 (license license:gpl2)))
187 (define-public zabbix-server
189 (inherit zabbix-agentd)
190 (name "zabbix-server")
191 (outputs '("out" "front-end" "schema"))
193 (substitute-keyword-arguments
195 (modify-phases %standard-phases
196 (add-after 'install 'install-front-end
197 (lambda* (#:key outputs #:allow-other-keys)
198 (let* ((php (string-append (assoc-ref outputs "front-end")
199 "/share/zabbix/php"))
200 (front-end-conf (string-append php "/conf"))
201 (etc (string-append php "/etc")))
203 (copy-recursively "ui" php)
204 ;; Make front-end write config to ‘/etc/zabbix’ directory.
205 (rename-file front-end-conf
206 (string-append front-end-conf "-example"))
207 (symlink "/etc/zabbix" front-end-conf))
209 (add-after 'install 'install-schema
210 (lambda* (#:key outputs #:allow-other-keys)
211 (let ((database-directory
212 (string-append (assoc-ref outputs "schema")
214 (for-each delete-file
215 (find-files "database" "Makefile\\.in|\\.am$"))
216 (mkdir-p database-directory)
217 (copy-recursively "database" database-directory))
219 ,@(package-arguments zabbix-agentd))
220 ((#:configure-flags flags)
221 `(cons* "--enable-server"
223 (string-append "--with-libevent="
224 (assoc-ref %build-inputs "libevent"))
226 (string-append "--with-gnutls="
227 (assoc-ref %build-inputs "gnutls"))
229 (string-append "--with-zlib="
230 (assoc-ref %build-inputs "zlib"))
234 ("libevent" ,libevent)
236 ("postgresql" ,postgresql)
238 ("net-snmp" ,net-snmp)
240 ,@(package-inputs zabbix-agentd)))
241 (synopsis "Distributed monitoring solution (server-side)")
242 (description "This package provides a distributed monitoring
243 solution (server-side)")))
245 (define-public darkstat
251 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
255 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
256 (build-system gnu-build-system)
257 (arguments '(#:tests? #f)) ; no tests
259 `(("libpcap" ,libpcap)
261 (home-page "https://unix4lyfe.org/darkstat/")
262 (synopsis "Network statistics gatherer")
264 "@command{darkstat} is a packet sniffer that runs as a background process,
265 gathers all sorts of statistics about network usage, and serves them over
269 @item Traffic graphs, reports per host, shows ports for each host.
270 @item Embedded web-server with deflate compression.
271 @item Asynchronous reverse DNS resolution using a child process.
272 @item Small. Portable. Single-threaded. Efficient.
275 (license license:gpl2)))
277 (define-public python-whisper
279 (name "python-whisper")
284 (uri (pypi-uri "whisper" version))
287 "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3"))))
288 (build-system python-build-system)
289 (home-page "http://graphiteapp.org/")
290 (synopsis "Fixed size round-robin style database for Graphite")
291 (description "Whisper is one of three components within the Graphite
292 project. Whisper is a fixed-size database, similar in design and purpose to
293 RRD (round-robin-database). It provides fast, reliable storage of numeric
294 data over time. Whisper allows for higher resolution (seconds per point) of
295 recent data to degrade into lower resolutions for long-term retention of
297 (license license:asl2.0)))
299 (define-public python2-whisper
300 (package-with-python2 python-whisper))
302 (define-public python2-carbon
304 (name "python2-carbon")
309 (uri (pypi-uri "carbon" version))
312 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
313 (build-system python-build-system)
315 `(#:python ,python-2 ; only supports Python 2
317 (modify-phases %standard-phases
318 ;; Don't install to /opt
319 (add-after 'unpack 'do-not-install-to-/opt
320 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
322 `(("python2-whisper" ,python2-whisper)
323 ("python2-configparser" ,python2-configparser)
324 ("python2-txamqp" ,python2-txamqp)))
325 (home-page "http://graphiteapp.org/")
326 (synopsis "Backend data caching and persistence daemon for Graphite")
327 (description "Carbon is a backend data caching and persistence daemon for
328 Graphite. Carbon is responsible for receiving metrics over the network,
329 caching them in memory for \"hot queries\" from the Graphite-Web application,
330 and persisting them to disk using the Whisper time-series library.")
331 (license license:asl2.0)))
333 (define-public python2-graphite-web
335 (name "python2-graphite-web")
340 (uri (pypi-uri "graphite-web" version))
343 "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc"))))
344 (build-system python-build-system)
346 `(#:python ,python-2 ; only supports Python 2
348 (modify-phases %standard-phases
349 (add-after 'unpack 'relax-requirements
351 (substitute* "setup.py"
352 (("0.4.3") ,(package-version python2-django-tagging))
353 (("<1.9.99") (string-append "<="
354 ,(package-version python2-django))))
356 ;; Don't install to /opt
357 (add-after 'unpack 'do-not-install-to-/opt
358 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
360 `(("python2-cairocffi" ,python2-cairocffi)
361 ("python2-pytz" ,python2-pytz)
362 ("python2-whisper" ,python2-whisper)
363 ("python2-django" ,python2-django)
364 ("python2-django-tagging" ,python2-django-tagging)
365 ("python2-scandir" ,python2-scandir)
366 ("python2-urllib3" ,python2-urllib3)
367 ("python2-pyparsing" ,python2-pyparsing)
368 ("python2-txamqp" ,python2-txamqp)))
369 (home-page "http://graphiteapp.org/")
370 (synopsis "Scalable realtime graphing system")
371 (description "Graphite is a scalable real-time graphing system that does
372 two things: store numeric time-series data, and render graphs of this data on
374 (license license:asl2.0)))
376 (define-public python-prometheus-client
378 (name "python-prometheus-client")
383 (uri (pypi-uri "prometheus_client" version))
385 (base32 "1ni2yv4ixwz32nz39ckia76lvggi7m19y5f702w5qczbnfi29kbi"))))
386 (build-system python-build-system)
388 '(;; No included tests.
391 `(("python-twisted" ,python-twisted)))
393 "https://github.com/prometheus/client_python")
394 (synopsis "Python client for the Prometheus monitoring system")
396 "The @code{prometheus_client} package supports exposing metrics from
397 software written in Python, so that they can be scraped by a Prometheus
400 Metrics can be exposed through a standalone web server, or through Twisted,
401 WSGI and the node exporter textfile collector.")
402 (license license:asl2.0)))
404 (define-public python2-prometheus-client
405 (package-with-python2 python-prometheus-client))
407 (define-public go-github-com-prometheus-node-exporter
409 (name "go-github-com-prometheus-node-exporter")
414 (url "https://github.com/prometheus/node_exporter")
415 (commit (string-append "v" version))))
416 (file-name (git-file-name name version))
419 "0s3sp1gj86p7npxl38hkgs6ymd3wjjmc5hydyg1b5wh0x3yvpx07"))))
420 (build-system go-build-system)
422 '(#:import-path "github.com/prometheus/node_exporter"))
423 (synopsis "Prometheus exporter for hardware and OS metrics")
424 (description "Prometheus exporter for metrics exposed by *NIX kernels,
425 written in Go with pluggable metric collectors.")
426 (home-page "https://github.com/prometheus/node_exporter")
427 (license license:asl2.0)))
429 (define-public fswatch
436 (url "https://github.com/emcrisostomo/fswatch")
438 (file-name (git-file-name name version))
441 "1yz65jsbgdx4cmy16x24wz5di352lvyi7fp6jm90bhgl1vpzxlsx"))))
442 (build-system gnu-build-system)
444 `(("autoconf" ,autoconf)
445 ("automake" ,automake)
446 ("gettext" ,gettext-minimal)
447 ("libtool" ,libtool)))
448 (synopsis "File system monitor")
449 (description "This package provides a file system monitor.")
450 (home-page "https://github.com/emcrisostomo/fswatch")
451 (license license:gpl3+)))
453 (define-public collectd
460 "https://storage.googleapis.com/collectd-tarballs/collectd-"
465 "1cjxksxdqcqdccz1nbnc2fp6yy84qq361ynaq5q8bailds00mc9p"))
466 (patches (search-patches "collectd-5.11.0-noinstallvar.patch"))))
467 (build-system gnu-build-system)
469 `(#:configure-flags (list "--localstatedir=/var" "--sysconfdir=/etc")
470 #:phases (modify-phases %standard-phases
471 (add-before 'configure 'autoreconf
473 ;; Required because of patched sources.
474 (invoke "autoreconf" "-vfi"))))))
476 `(("rrdtool" ,rrdtool)
478 ("libyajl" ,libyajl)))
480 `(("autoconf" ,autoconf)
481 ("automake" ,automake)
483 ("pkg-config" ,pkg-config)))
484 (home-page "https://collectd.org/")
485 (synopsis "Collect system and application performance metrics periodically")
487 "collectd gathers metrics from various sources such as the operating system,
488 applications, log files and external devices, and stores this information or
489 makes it available over the network. Those statistics can be used to monitor
490 systems, find performance bottlenecks (i.e., performance analysis) and predict
491 future system load (i.e., capacity planning).")
492 ;; license:expat for the daemon in src/daemon/ and some plugins,
493 ;; license:gpl2 for other plugins
494 (license (list license:expat license:gpl2))))