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 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
7 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages monitoring)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system perl)
30 #:use-module (guix build-system python)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system go)
33 #:use-module (guix utils)
34 #:use-module (gnu packages admin)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages databases)
40 #:use-module (gnu packages django)
41 #:use-module (gnu packages gd)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages mail)
44 #:use-module (gnu packages networking)
45 #:use-module (gnu packages libevent)
46 #:use-module (gnu packages pcre)
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-web)
50 #:use-module (gnu packages time)
51 #:use-module (gnu packages tls))
57 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
61 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
62 version "/nagios-" version ".tar.gz"))
65 "1wa4m952sb23dqi5w759adimsp21bkhp598rpq9dnhz3v497h2y9"))
66 (modules '((guix build utils)))
68 ;; Ensure reproducibility.
70 (substitute* (find-files "cgi" "\\.c$")
71 (("__DATE__") "\"1970-01-01\"")
72 (("__TIME__") "\"00:00:00\""))
74 (build-system gnu-build-system)
79 ("libpng-apng" ,libpng)
82 ("mailutils" ,mailutils)))
84 '(#:configure-flags (list "--sysconfdir=/etc"
86 ;; 'include/locations.h.in' defines file
87 ;; locations, and many things go directly under
88 ;; LOCALSTATEDIR, hence the extra '/nagios'.
89 "--localstatedir=/var/nagios"
93 (assoc-ref %build-inputs "mailutils")
96 #:phases (modify-phases %standard-phases
97 (add-before 'build 'do-not-chown-to-nagios
99 ;; Makefiles do 'install -o nagios -g nagios', which
100 ;; doesn't work for us.
101 (substitute* (find-files "." "^Makefile$")
102 (("-o nagios -g nagios")
105 (add-before 'build 'do-not-create-sysconfdir
107 ;; Don't try to create /var upon 'make install'.
108 (substitute* "Makefile"
109 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
110 (string-append "# " all))
111 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
112 (string-append "# " all))
113 (("chmod g\\+s.*" all)
114 (string-append "# " all)))
116 (add-before 'build 'set-html/php-directory
118 ;; Install HTML and PHP files under 'share/nagios/html'
119 ;; instead of just 'share/'.
120 (substitute* '("html/Makefile" "Makefile")
122 "HTMLDIR = $(datarootdir)/nagios/html\n"))
124 #:tests? #f)) ;no 'check' target or similar
125 (home-page "https://www.nagios.org/")
126 (synopsis "Host, service, and network monitoring program")
128 "Nagios is a host, service, and network monitoring program written in C.
129 CGI programs are included to allow you to view the current status, history,
130 etc. via a Web interface. Features include:
133 @item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
134 @item Monitoring of host resources (processor load, disk usage, etc.).
135 @item A plugin interface to allow for user-developed service monitoring
137 @item Ability to define network host hierarchy using \"parent\" hosts,
138 allowing detection of and distinction between hosts that are down
139 and those that are unreachable.
140 @item Notifications when problems occur and get resolved (via email,
141 pager, or user-defined method).
142 @item Ability to define event handlers for proactive problem resolution.
143 @item Automatic log file rotation/archiving.
144 @item Optional web interface for viewing current network status,
145 notification and problem history, log file, etc.
147 (license license:gpl2)))
149 (define-public zabbix-agentd
151 (name "zabbix-agentd")
157 "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/" version
158 "/zabbix-" version ".tar.gz"))
161 "0qxgf6hx7ibhjmxd2sxizkjc8df4c9d31wz5hhql409ws98qf173"))))
162 (build-system gnu-build-system)
165 (list "--enable-agent"
166 (string-append "--with-iconv="
167 (assoc-ref %build-inputs "libiconv"))
168 (string-append "--with-libpcre="
169 (assoc-ref %build-inputs "pcre")))))
171 `(("libiconv" ,libiconv)
173 (home-page "https://www.zabbix.com/")
174 (synopsis "Distributed monitoring solution (client-side agent)")
175 (description "This package provides a distributed monitoring
176 solution (client-side agent)")
177 (license license:gpl2)))
179 (define-public zabbix-server
181 (inherit zabbix-agentd)
182 (name "zabbix-server")
184 (substitute-keyword-arguments
186 (modify-phases %standard-phases
187 (add-after 'install 'install-frontend
188 (lambda* (#:key outputs #:allow-other-keys)
189 (let* ((php (string-append (assoc-ref outputs "out")
190 "/share/zabbix/php"))
191 (front-end-conf (string-append php "/conf"))
192 (etc (string-append php "/etc")))
194 (copy-recursively "./frontends/php" php)
195 (rename-file front-end-conf
196 (string-append front-end-conf "-example"))
197 (symlink "/etc/zabbix" front-end-conf)))))
198 ,@(package-arguments zabbix-agentd))
199 ((#:configure-flags flags)
200 `(cons* "--enable-server"
202 (string-append "--with-libevent="
203 (assoc-ref %build-inputs "libevent"))
205 (string-append "--with-gnutls="
206 (assoc-ref %build-inputs "gnutls"))
211 ("libevent" ,libevent)
213 ("postgresql" ,postgresql)
215 ("net-snmp" ,net-snmp)
217 ,@(package-inputs zabbix-agentd)))
218 (synopsis "Distributed monitoring solution (server-side)")
219 (description "This package provides a distributed monitoring
220 solution (server-side)")))
222 (define-public darkstat
228 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
232 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
233 (build-system gnu-build-system)
234 (arguments '(#:tests? #f)) ; no tests
236 `(("libpcap" ,libpcap)
238 (home-page "https://unix4lyfe.org/darkstat/")
239 (synopsis "Network statistics gatherer")
241 "@command{darkstat} is a packet sniffer that runs as a background process,
242 gathers all sorts of statistics about network usage, and serves them over
246 @item Traffic graphs, reports per host, shows ports for each host.
247 @item Embedded web-server with deflate compression.
248 @item Asynchronous reverse DNS resolution using a child process.
249 @item Small. Portable. Single-threaded. Efficient.
252 (license license:gpl2)))
254 (define-public python-whisper
256 (name "python-whisper")
261 (uri (pypi-uri "whisper" version))
264 "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3"))))
265 (build-system python-build-system)
266 (home-page "http://graphiteapp.org/")
267 (synopsis "Fixed size round-robin style database for Graphite")
268 (description "Whisper is one of three components within the Graphite
269 project. Whisper is a fixed-size database, similar in design and purpose to
270 RRD (round-robin-database). It provides fast, reliable storage of numeric
271 data over time. Whisper allows for higher resolution (seconds per point) of
272 recent data to degrade into lower resolutions for long-term retention of
274 (license license:asl2.0)))
276 (define-public python2-whisper
277 (package-with-python2 python-whisper))
279 (define-public python2-carbon
281 (name "python2-carbon")
286 (uri (pypi-uri "carbon" version))
289 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
290 (build-system python-build-system)
292 `(#:python ,python-2 ; only supports Python 2
294 (modify-phases %standard-phases
295 ;; Don't install to /opt
296 (add-after 'unpack 'do-not-install-to-/opt
297 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
299 `(("python2-whisper" ,python2-whisper)
300 ("python2-configparser" ,python2-configparser)
301 ("python2-txamqp" ,python2-txamqp)))
302 (home-page "http://graphiteapp.org/")
303 (synopsis "Backend data caching and persistence daemon for Graphite")
304 (description "Carbon is a backend data caching and persistence daemon for
305 Graphite. Carbon is responsible for receiving metrics over the network,
306 caching them in memory for \"hot queries\" from the Graphite-Web application,
307 and persisting them to disk using the Whisper time-series library.")
308 (license license:asl2.0)))
310 (define-public python2-graphite-web
312 (name "python2-graphite-web")
317 (uri (pypi-uri "graphite-web" version))
320 "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc"))))
321 (build-system python-build-system)
323 `(#:python ,python-2 ; only supports Python 2
325 (modify-phases %standard-phases
326 (add-after 'unpack 'relax-requirements
328 (substitute* "setup.py"
329 (("0.4.3") ,(package-version python2-django-tagging))
330 (("<1.9.99") (string-append "<="
331 ,(package-version python2-django))))
333 ;; Don't install to /opt
334 (add-after 'unpack 'do-not-install-to-/opt
335 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
337 `(("python2-cairocffi" ,python2-cairocffi)
338 ("python2-pytz" ,python2-pytz)
339 ("python2-whisper" ,python2-whisper)
340 ("python2-django" ,python2-django)
341 ("python2-django-tagging" ,python2-django-tagging)
342 ("python2-scandir" ,python2-scandir)
343 ("python2-urllib3" ,python2-urllib3)
344 ("python2-pyparsing" ,python2-pyparsing)
345 ("python2-txamqp" ,python2-txamqp)))
346 (home-page "http://graphiteapp.org/")
347 (synopsis "Scalable realtime graphing system")
348 (description "Graphite is a scalable real-time graphing system that does
349 two things: store numeric time-series data, and render graphs of this data on
351 (license license:asl2.0)))
353 (define-public python-prometheus-client
355 (name "python-prometheus-client")
360 (uri (pypi-uri "prometheus_client" version))
363 "164qzzg8q8awqk0angcm87p2sjiibaj1wgjz0xk6j0klvqi5q2mz"))))
364 (build-system python-build-system)
366 '(;; No included tests.
369 "https://github.com/prometheus/client_python")
370 (synopsis "Python client for the Prometheus monitoring system")
372 "The @code{prometheus_client} package supports exposing metrics from
373 software written in Python, so that they can be scraped by a Prometheus
376 Metrics can be exposed through a standalone web server, or through Twisted,
377 WSGI and the node exporter textfile collector.")
378 (license license:asl2.0)))
380 (define-public python2-prometheus-client
381 (package-with-python2 python-prometheus-client))
383 (define-public go-github-com-prometheus-node-exporter
384 (let ((commit "55c32fcf02492fe4946f7ab563547cc5df7fc61e")
387 (name "go-github-com-prometheus-node-exporter")
388 (version (git-version "0.0.0" revision commit))
392 (url "https://github.com/prometheus/node_exporter.git")
394 (file-name (git-file-name name version))
397 "041b87a0sid23c29swqmi5hw6cxbxvkfj3415jg73cm2pi8wh5s6"))))
398 (build-system go-build-system)
400 '(#:import-path "github.com/prometheus/node_exporter"))
401 (synopsis "Prometheus exporter for hardware and OS metrics")
402 (description "Prometheus exporter for metrics exposed by *NIX kernels,
403 written in Go with pluggable metric collectors.")
404 (home-page "https://github.com/prometheus/node_exporter")
405 (license license:asl2.0))))