Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / monitoring.scm
CommitLineData
d30e578a
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
c8cee2ef 3;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
05b4b3ea 4;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
4972f9cc 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
39109778 6;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
46a7ad46 7;;; Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com>
d30e578a
LC
8;;;
9;;; This file is part of GNU Guix.
10;;;
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.
15;;;
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.
20;;;
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/>.
23
24(define-module (gnu packages monitoring)
25 #:use-module (guix packages)
26 #:use-module (guix download)
780205a0 27 #:use-module (guix git-download)
d30e578a
LC
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system perl)
4d92c210 30 #:use-module (guix build-system python)
d30e578a 31 #:use-module (guix build-system gnu)
780205a0 32 #:use-module (guix build-system go)
ead46692 33 #:use-module (guix utils)
c8cee2ef 34 #:use-module (gnu packages admin)
64eb038e 35 #:use-module (gnu packages autotools)
d30e578a 36 #:use-module (gnu packages base)
ead46692 37 #:use-module (gnu packages curl)
fb6f35ba 38 #:use-module (gnu packages check)
d30e578a 39 #:use-module (gnu packages compression)
ead46692 40 #:use-module (gnu packages databases)
e7a30ded 41 #:use-module (gnu packages django)
d30e578a 42 #:use-module (gnu packages gd)
64eb038e 43 #:use-module (gnu packages gettext)
7fc2d377
LC
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages mail)
ead46692
OP
46 #:use-module (gnu packages networking)
47 #:use-module (gnu packages libevent)
48 #:use-module (gnu packages pcre)
a15181bb 49 #:use-module (gnu packages perl)
e7a30ded
RW
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-web)
44d10b1f 52 #:use-module (gnu packages python-xyz)
ead46692
OP
53 #:use-module (gnu packages time)
54 #:use-module (gnu packages tls))
d30e578a
LC
55
56(define-public nagios
57 (package
58 (name "nagios")
4972f9cc 59 (version "4.3.4")
7fc2d377 60 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
d30e578a
LC
61 (source (origin
62 (method url-fetch)
63 (uri (string-append
64 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
65 version "/nagios-" version ".tar.gz"))
66 (sha256
67 (base32
4972f9cc 68 "1wa4m952sb23dqi5w759adimsp21bkhp598rpq9dnhz3v497h2y9"))
d30e578a
LC
69 (modules '((guix build utils)))
70 (snippet
71 ;; Ensure reproducibility.
6cbee49d
MW
72 '(begin
73 (substitute* (find-files "cgi" "\\.c$")
74 (("__DATE__") "\"1970-01-01\"")
75 (("__TIME__") "\"00:00:00\""))
76 #t))))
d30e578a 77 (build-system gnu-build-system)
7fc2d377
LC
78 (native-inputs
79 `(("unzip" ,unzip)))
d30e578a
LC
80 (inputs
81 `(("zlib" ,zlib)
82 ("libpng-apng" ,libpng)
83 ("gd" ,gd)
84 ("perl" ,perl)
85 ("mailutils" ,mailutils)))
86 (arguments
87 '(#:configure-flags (list "--sysconfdir=/etc"
88
89 ;; 'include/locations.h.in' defines file
90 ;; locations, and many things go directly under
91 ;; LOCALSTATEDIR, hence the extra '/nagios'.
92 "--localstatedir=/var/nagios"
93
94 (string-append
95 "--with-mail="
96 (assoc-ref %build-inputs "mailutils")
97 "/bin/mail"))
98 #:make-flags '("all")
99 #:phases (modify-phases %standard-phases
100 (add-before 'build 'do-not-chown-to-nagios
101 (lambda _
102 ;; Makefiles do 'install -o nagios -g nagios', which
103 ;; doesn't work for us.
104 (substitute* (find-files "." "^Makefile$")
105 (("-o nagios -g nagios")
106 ""))
107 #t))
108 (add-before 'build 'do-not-create-sysconfdir
109 (lambda _
110 ;; Don't try to create /var upon 'make install'.
111 (substitute* "Makefile"
112 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
113 (string-append "# " all))
114 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
115 (string-append "# " all))
116 (("chmod g\\+s.*" all)
117 (string-append "# " all)))
118 #t))
119 (add-before 'build 'set-html/php-directory
120 (lambda _
121 ;; Install HTML and PHP files under 'share/nagios/html'
122 ;; instead of just 'share/'.
123 (substitute* '("html/Makefile" "Makefile")
124 (("HTMLDIR=.*$")
125 "HTMLDIR = $(datarootdir)/nagios/html\n"))
126 #t)))
127 #:tests? #f)) ;no 'check' target or similar
128 (home-page "https://www.nagios.org/")
129 (synopsis "Host, service, and network monitoring program")
130 (description
131 "Nagios is a host, service, and network monitoring program written in C.
132CGI programs are included to allow you to view the current status, history,
133etc. via a Web interface. Features include:
134
135@itemize
136@item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
137@item Monitoring of host resources (processor load, disk usage, etc.).
138@item A plugin interface to allow for user-developed service monitoring
139 methods.
140@item Ability to define network host hierarchy using \"parent\" hosts,
141 allowing detection of and distinction between hosts that are down
142 and those that are unreachable.
143@item Notifications when problems occur and get resolved (via email,
144 pager, or user-defined method).
145@item Ability to define event handlers for proactive problem resolution.
146@item Automatic log file rotation/archiving.
147@item Optional web interface for viewing current network status,
148 notification and problem history, log file, etc.
149@end itemize\n")
150 (license license:gpl2)))
c8cee2ef 151
ead46692
OP
152(define-public zabbix-agentd
153 (package
154 (name "zabbix-agentd")
13f0414e 155 (version "4.4.1")
ead46692
OP
156 (source
157 (origin
158 (method url-fetch)
159 (uri (string-append
160 "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/" version
161 "/zabbix-" version ".tar.gz"))
162 (sha256
163 (base32
13f0414e 164 "0jjn2przn9s25slrcxmq8iqdgqkgxnqs45zy0n1ma6nlgmclxxqb"))))
ead46692
OP
165 (build-system gnu-build-system)
166 (arguments
167 `(#:configure-flags
168 (list "--enable-agent"
169 (string-append "--with-iconv="
170 (assoc-ref %build-inputs "libiconv"))
171 (string-append "--with-libpcre="
172 (assoc-ref %build-inputs "pcre")))))
173 (inputs
174 `(("libiconv" ,libiconv)
175 ("pcre" ,pcre)))
176 (home-page "https://www.zabbix.com/")
177 (synopsis "Distributed monitoring solution (client-side agent)")
178 (description "This package provides a distributed monitoring
179solution (client-side agent)")
180 (license license:gpl2)))
181
182(define-public zabbix-server
183 (package
184 (inherit zabbix-agentd)
185 (name "zabbix-server")
2c9ac839 186 (outputs '("out" "front-end" "schema"))
ead46692
OP
187 (arguments
188 (substitute-keyword-arguments
189 `(#:phases
190 (modify-phases %standard-phases
2c9ac839 191 (add-after 'install 'install-front-end
ead46692 192 (lambda* (#:key outputs #:allow-other-keys)
2c9ac839 193 (let* ((php (string-append (assoc-ref outputs "front-end")
ead46692
OP
194 "/share/zabbix/php"))
195 (front-end-conf (string-append php "/conf"))
196 (etc (string-append php "/etc")))
197 (mkdir-p php)
2c9ac839
OP
198 (copy-recursively "frontends/php" php)
199 ;; Make front-end write config to ‘/etc/zabbix’ directory.
ead46692
OP
200 (rename-file front-end-conf
201 (string-append front-end-conf "-example"))
2c9ac839
OP
202 (symlink "/etc/zabbix" front-end-conf))
203 #t))
204 (add-after 'install 'install-schema
205 (lambda* (#:key outputs #:allow-other-keys)
206 (let ((database-directory
207 (string-append (assoc-ref outputs "schema")
208 "/database")))
209 (for-each delete-file
210 (find-files "database" "Makefile\\.in|\\.am$"))
211 (mkdir-p database-directory)
212 (copy-recursively "database" database-directory))
213 #t)))
ead46692
OP
214 ,@(package-arguments zabbix-agentd))
215 ((#:configure-flags flags)
216 `(cons* "--enable-server"
217 "--with-postgresql"
218 (string-append "--with-libevent="
219 (assoc-ref %build-inputs "libevent"))
220 "--with-net-snmp"
221 (string-append "--with-gnutls="
222 (assoc-ref %build-inputs "gnutls"))
223 "--with-libcurl"
f2f95601
OP
224 (string-append "--with-zlib="
225 (assoc-ref %build-inputs "zlib"))
ead46692
OP
226 ,flags))))
227 (inputs
228 `(("curl" ,curl)
229 ("libevent" ,libevent)
230 ("gnutls" ,gnutls)
231 ("postgresql" ,postgresql)
232 ("zlib" ,zlib)
233 ("net-snmp" ,net-snmp)
234 ("curl" ,curl)
235 ,@(package-inputs zabbix-agentd)))
236 (synopsis "Distributed monitoring solution (server-side)")
237 (description "This package provides a distributed monitoring
238solution (server-side)")))
239
c8cee2ef
SB
240(define-public darkstat
241 (package
242 (name "darkstat")
243 (version "3.0.719")
244 (source (origin
245 (method url-fetch)
246 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
247 version ".tar.bz2"))
248 (sha256
249 (base32
250 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
251 (build-system gnu-build-system)
252 (arguments '(#:tests? #f)) ; no tests
253 (inputs
254 `(("libpcap" ,libpcap)
255 ("zlib" ,zlib)))
256 (home-page "https://unix4lyfe.org/darkstat/")
257 (synopsis "Network statistics gatherer")
258 (description
259 "@command{darkstat} is a packet sniffer that runs as a background process,
260gathers all sorts of statistics about network usage, and serves them over
261HTTP. Features:
262
263@itemize
264@item Traffic graphs, reports per host, shows ports for each host.
265@item Embedded web-server with deflate compression.
266@item Asynchronous reverse DNS resolution using a child process.
267@item Small. Portable. Single-threaded. Efficient.
268@item Supports IPv6.
269@end itemize")
270 (license license:gpl2)))
4d92c210
RW
271
272(define-public python-whisper
273 (package
274 (name "python-whisper")
275 (version "1.0.2")
276 (source
277 (origin
278 (method url-fetch)
279 (uri (pypi-uri "whisper" version))
280 (sha256
281 (base32
282 "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3"))))
283 (build-system python-build-system)
284 (home-page "http://graphiteapp.org/")
285 (synopsis "Fixed size round-robin style database for Graphite")
286 (description "Whisper is one of three components within the Graphite
287project. Whisper is a fixed-size database, similar in design and purpose to
288RRD (round-robin-database). It provides fast, reliable storage of numeric
289data over time. Whisper allows for higher resolution (seconds per point) of
290recent data to degrade into lower resolutions for long-term retention of
291historical data.")
292 (license license:asl2.0)))
293
294(define-public python2-whisper
295 (package-with-python2 python-whisper))
a15181bb
RW
296
297(define-public python2-carbon
298 (package
299 (name "python2-carbon")
300 (version "1.0.2")
301 (source
302 (origin
303 (method url-fetch)
304 (uri (pypi-uri "carbon" version))
305 (sha256
306 (base32
307 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
308 (build-system python-build-system)
309 (arguments
310 `(#:python ,python-2 ; only supports Python 2
311 #:phases
312 (modify-phases %standard-phases
313 ;; Don't install to /opt
314 (add-after 'unpack 'do-not-install-to-/opt
315 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
316 (propagated-inputs
317 `(("python2-whisper" ,python2-whisper)
318 ("python2-configparser" ,python2-configparser)
319 ("python2-txamqp" ,python2-txamqp)))
320 (home-page "http://graphiteapp.org/")
321 (synopsis "Backend data caching and persistence daemon for Graphite")
322 (description "Carbon is a backend data caching and persistence daemon for
323Graphite. Carbon is responsible for receiving metrics over the network,
324caching them in memory for \"hot queries\" from the Graphite-Web application,
325and persisting them to disk using the Whisper time-series library.")
326 (license license:asl2.0)))
e7a30ded
RW
327
328(define-public python2-graphite-web
329 (package
330 (name "python2-graphite-web")
331 (version "1.0.2")
332 (source
333 (origin
334 (method url-fetch)
335 (uri (pypi-uri "graphite-web" version))
336 (sha256
337 (base32
338 "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc"))))
339 (build-system python-build-system)
340 (arguments
341 `(#:python ,python-2 ; only supports Python 2
342 #:phases
343 (modify-phases %standard-phases
344 (add-after 'unpack 'relax-requirements
345 (lambda _
346 (substitute* "setup.py"
347 (("0.4.3") ,(package-version python2-django-tagging))
348 (("<1.9.99") (string-append "<="
349 ,(package-version python2-django))))
350 #t))
351 ;; Don't install to /opt
352 (add-after 'unpack 'do-not-install-to-/opt
353 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
354 (propagated-inputs
355 `(("python2-cairocffi" ,python2-cairocffi)
356 ("python2-pytz" ,python2-pytz)
357 ("python2-whisper" ,python2-whisper)
358 ("python2-django" ,python2-django)
359 ("python2-django-tagging" ,python2-django-tagging)
360 ("python2-scandir" ,python2-scandir)
361 ("python2-urllib3" ,python2-urllib3)
362 ("python2-pyparsing" ,python2-pyparsing)
363 ("python2-txamqp" ,python2-txamqp)))
364 (home-page "http://graphiteapp.org/")
365 (synopsis "Scalable realtime graphing system")
366 (description "Graphite is a scalable real-time graphing system that does
367two things: store numeric time-series data, and render graphs of this data on
368demand.")
369 (license license:asl2.0)))
fb6f35ba
CB
370
371(define-public python-prometheus-client
372 (package
373 (name "python-prometheus-client")
05b4b3ea 374 (version "0.5.0")
fb6f35ba
CB
375 (source
376 (origin
377 (method url-fetch)
378 (uri (pypi-uri "prometheus_client" version))
379 (sha256
380 (base32
05b4b3ea 381 "0g7rpv1pq2lab1nfqdx98z9d3bqwc400alg1j4ynrpjkrbsizhg8"))))
fb6f35ba
CB
382 (build-system python-build-system)
383 (arguments
384 '(;; No included tests.
385 #:tests? #f))
05b4b3ea
RW
386 (propagated-inputs
387 `(("python-twisted" ,python-twisted)))
fb6f35ba
CB
388 (home-page
389 "https://github.com/prometheus/client_python")
390 (synopsis "Python client for the Prometheus monitoring system")
391 (description
392 "The @code{prometheus_client} package supports exposing metrics from
393software written in Python, so that they can be scraped by a Prometheus
394service.
395
396Metrics can be exposed through a standalone web server, or through Twisted,
397WSGI and the node exporter textfile collector.")
398 (license license:asl2.0)))
399
400(define-public python2-prometheus-client
401 (package-with-python2 python-prometheus-client))
780205a0
GB
402
403(define-public go-github-com-prometheus-node-exporter
404 (let ((commit "55c32fcf02492fe4946f7ab563547cc5df7fc61e")
405 (revision "0"))
406 (package
407 (name "go-github-com-prometheus-node-exporter")
408 (version (git-version "0.0.0" revision commit))
409 (source (origin
410 (method git-fetch)
411 (uri (git-reference
412 (url "https://github.com/prometheus/node_exporter.git")
413 (commit commit)))
414 (file-name (git-file-name name version))
415 (sha256
416 (base32
417 "041b87a0sid23c29swqmi5hw6cxbxvkfj3415jg73cm2pi8wh5s6"))))
418 (build-system go-build-system)
419 (arguments
420 '(#:import-path "github.com/prometheus/node_exporter"))
421 (synopsis "Prometheus exporter for hardware and OS metrics")
422 (description "Prometheus exporter for metrics exposed by *NIX kernels,
423written in Go with pluggable metric collectors.")
424 (home-page "https://github.com/prometheus/node_exporter")
425 (license license:asl2.0))))
64eb038e
DM
426
427(define-public fswatch
428 (package
429 (name "fswatch")
6b4e4f16 430 (version "1.14.0")
64eb038e
DM
431 (source (origin
432 (method git-fetch)
433 (uri (git-reference
434 (url "https://github.com/emcrisostomo/fswatch.git")
435 (commit version)))
63968297 436 (file-name (git-file-name name version))
64eb038e
DM
437 (sha256
438 (base32
6b4e4f16 439 "1ihn7wp3y7ml2lm8drz2hc6fmgj8kygbygnw8mz7gjax88f9dbx7"))))
64eb038e
DM
440 (build-system gnu-build-system)
441 (native-inputs
442 `(("autoconf" ,autoconf)
443 ("automake" ,automake)
444 ("gettext" ,gettext-minimal)
445 ("libtool" ,libtool)))
446 (synopsis "File system monitor")
447 (description "This package provides a file system monitor.")
448 (home-page "https://github.com/emcrisostomo/fswatch")
449 (license license:gpl3+)))