gnu: sdcc: Remove non-free code.
[jackhill/guix/guix.git] / gnu / packages / monitoring.scm
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>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
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.
17 ;;;
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.
22 ;;;
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/>.
25
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))
61
62 (define-public nagios
63 (package
64 (name "nagios")
65 (version "4.4.6")
66 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
67 (source (origin
68 (method url-fetch)
69 (uri (string-append
70 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
71 version "/nagios-" version ".tar.gz"))
72 (sha256
73 (base32
74 "1x5hb97zbvkm73q53ydp1gwj8nnznm72q9c4rm6ny7phr995l3db"))
75 (modules '((guix build utils)))
76 (snippet
77 ;; Ensure reproducibility.
78 '(begin
79 (substitute* (find-files "cgi" "\\.c$")
80 (("__DATE__") "\"1970-01-01\"")
81 (("__TIME__") "\"00:00:00\""))
82 #t))))
83 (build-system gnu-build-system)
84 (native-inputs
85 `(("unzip" ,unzip)))
86 (inputs
87 `(("zlib" ,zlib)
88 ("libpng-apng" ,libpng)
89 ("gd" ,gd)
90 ("perl" ,perl)
91 ("mailutils" ,mailutils)))
92 (arguments
93 '(#:configure-flags (list "--sysconfdir=/etc"
94
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"
99
100 (string-append
101 "--with-mail="
102 (assoc-ref %build-inputs "mailutils")
103 "/bin/mail"))
104 #:make-flags '("all")
105 #:phases (modify-phases %standard-phases
106 (add-before 'build 'do-not-chown-to-nagios
107 (lambda _
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")
112 ""))
113 #t))
114 (add-before 'build 'do-not-create-sysconfdir
115 (lambda _
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)))
124 #t))
125 (add-before 'build 'set-html/php-directory
126 (lambda _
127 ;; Install HTML and PHP files under 'share/nagios/html'
128 ;; instead of just 'share/'.
129 (substitute* '("html/Makefile" "Makefile")
130 (("HTMLDIR=.*$")
131 "HTMLDIR = $(datarootdir)/nagios/html\n"))
132 #t)))
133 #:tests? #f)) ;no 'check' target or similar
134 (home-page "https://www.nagios.org/")
135 (synopsis "Host, service, and network monitoring program")
136 (description
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:
140
141 @itemize
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
145 methods.
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.
155 @end itemize\n")
156 (license license:gpl2)))
157
158 (define-public zabbix-agentd
159 (package
160 (name "zabbix-agentd")
161 (version "5.2.0")
162 (source
163 (origin
164 (method url-fetch)
165 (uri (string-append
166 "https://cdn.zabbix.com/zabbix/sources/stable/"
167 (version-major+minor version) "/zabbix-" version ".tar.gz"))
168 (sha256
169 (base32 "168yi9igwkb4jcdw38kvp85n8mxnlg2n7lkrgaycp8b0dlgjnidl"))))
170 (build-system gnu-build-system)
171 (arguments
172 `(#:configure-flags
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")))))
178 (inputs
179 `(("libiconv" ,libiconv)
180 ("pcre" ,pcre)))
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)))
186
187 (define-public zabbix-server
188 (package
189 (inherit zabbix-agentd)
190 (name "zabbix-server")
191 (outputs '("out" "front-end" "schema"))
192 (arguments
193 (substitute-keyword-arguments
194 `(#:phases
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")))
202 (mkdir-p php)
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))
208 #t))
209 (add-after 'install 'install-schema
210 (lambda* (#:key outputs #:allow-other-keys)
211 (let ((database-directory
212 (string-append (assoc-ref outputs "schema")
213 "/database")))
214 (for-each delete-file
215 (find-files "database" "Makefile\\.in|\\.am$"))
216 (mkdir-p database-directory)
217 (copy-recursively "database" database-directory))
218 #t)))
219 ,@(package-arguments zabbix-agentd))
220 ((#:configure-flags flags)
221 `(cons* "--enable-server"
222 "--with-postgresql"
223 (string-append "--with-libevent="
224 (assoc-ref %build-inputs "libevent"))
225 "--with-net-snmp"
226 (string-append "--with-gnutls="
227 (assoc-ref %build-inputs "gnutls"))
228 "--with-libcurl"
229 (string-append "--with-zlib="
230 (assoc-ref %build-inputs "zlib"))
231 ,flags))))
232 (inputs
233 `(("curl" ,curl)
234 ("libevent" ,libevent)
235 ("gnutls" ,gnutls)
236 ("postgresql" ,postgresql)
237 ("zlib" ,zlib)
238 ("net-snmp" ,net-snmp)
239 ("curl" ,curl)
240 ,@(package-inputs zabbix-agentd)))
241 (synopsis "Distributed monitoring solution (server-side)")
242 (description "This package provides a distributed monitoring
243 solution (server-side)")))
244
245 (define-public darkstat
246 (package
247 (name "darkstat")
248 (version "3.0.719")
249 (source (origin
250 (method url-fetch)
251 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
252 version ".tar.bz2"))
253 (sha256
254 (base32
255 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
256 (build-system gnu-build-system)
257 (arguments '(#:tests? #f)) ; no tests
258 (inputs
259 `(("libpcap" ,libpcap)
260 ("zlib" ,zlib)))
261 (home-page "https://unix4lyfe.org/darkstat/")
262 (synopsis "Network statistics gatherer")
263 (description
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
266 HTTP. Features:
267
268 @itemize
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.
273 @item Supports IPv6.
274 @end itemize")
275 (license license:gpl2)))
276
277 (define-public python-whisper
278 (package
279 (name "python-whisper")
280 (version "1.0.2")
281 (source
282 (origin
283 (method url-fetch)
284 (uri (pypi-uri "whisper" version))
285 (sha256
286 (base32
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
296 historical data.")
297 (license license:asl2.0)))
298
299 (define-public python2-whisper
300 (package-with-python2 python-whisper))
301
302 (define-public python2-carbon
303 (package
304 (name "python2-carbon")
305 (version "1.0.2")
306 (source
307 (origin
308 (method url-fetch)
309 (uri (pypi-uri "carbon" version))
310 (sha256
311 (base32
312 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
313 (build-system python-build-system)
314 (arguments
315 `(#:python ,python-2 ; only supports Python 2
316 #:phases
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)))))
321 (propagated-inputs
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)))
332
333 (define-public graphite-web
334 (package
335 (name "graphite-web")
336 (version "1.1.7")
337 (source
338 (origin
339 (method url-fetch)
340 (uri (pypi-uri "graphite-web" version))
341 (sha256
342 (base32
343 "1l5a5rry9cakqxamvlx4xq63jifmncb6815bg9vy7fg1zyd3pjxk"))))
344 (build-system python-build-system)
345 (arguments
346 `(#:tests? #f ;XXX: not in PyPI release & requires database
347 #:phases
348 (modify-phases %standard-phases
349 (add-after 'unpack 'relax-requirements
350 (lambda _
351 (substitute* "setup.py"
352 ;; Allow newer versions of django-tagging.
353 (("django-tagging==")
354 "django-tagging>="))
355 #t))
356 ;; Don't install to /opt
357 (add-after 'unpack 'do-not-install-to-/opt
358 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
359 (propagated-inputs
360 `(("python-cairocffi" ,python-cairocffi)
361 ("python-pytz" ,python-pytz)
362 ("python-whisper" ,python-whisper)
363 ("python-django" ,python-django-2.2)
364 ("python-django-tagging" ,python-django-tagging)
365 ("python-scandir" ,python-scandir)
366 ("python-urllib3" ,python-urllib3)
367 ("python-pyparsing" ,python-pyparsing)
368 ("python-txamqp" ,python-txamqp)))
369 (home-page "https://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
373 demand.")
374 (license license:asl2.0)))
375
376 (define-public python2-graphite-web
377 (deprecated-package "python2-graphite-web" graphite-web))
378
379 (define-public python-prometheus-client
380 (package
381 (name "python-prometheus-client")
382 (version "0.7.1")
383 (source
384 (origin
385 (method url-fetch)
386 (uri (pypi-uri "prometheus_client" version))
387 (sha256
388 (base32 "1ni2yv4ixwz32nz39ckia76lvggi7m19y5f702w5qczbnfi29kbi"))))
389 (build-system python-build-system)
390 (arguments
391 '(;; No included tests.
392 #:tests? #f))
393 (propagated-inputs
394 `(("python-twisted" ,python-twisted)))
395 (home-page
396 "https://github.com/prometheus/client_python")
397 (synopsis "Python client for the Prometheus monitoring system")
398 (description
399 "The @code{prometheus_client} package supports exposing metrics from
400 software written in Python, so that they can be scraped by a Prometheus
401 service.
402
403 Metrics can be exposed through a standalone web server, or through Twisted,
404 WSGI and the node exporter textfile collector.")
405 (license license:asl2.0)))
406
407 (define-public python2-prometheus-client
408 (package-with-python2 python-prometheus-client))
409
410 (define-public go-github-com-prometheus-node-exporter
411 (package
412 (name "go-github-com-prometheus-node-exporter")
413 (version "0.18.1")
414 (source (origin
415 (method git-fetch)
416 (uri (git-reference
417 (url "https://github.com/prometheus/node_exporter")
418 (commit (string-append "v" version))))
419 (file-name (git-file-name name version))
420 (sha256
421 (base32
422 "0s3sp1gj86p7npxl38hkgs6ymd3wjjmc5hydyg1b5wh0x3yvpx07"))))
423 (build-system go-build-system)
424 (arguments
425 '(#:import-path "github.com/prometheus/node_exporter"))
426 (synopsis "Prometheus exporter for hardware and OS metrics")
427 (description "Prometheus exporter for metrics exposed by *NIX kernels,
428 written in Go with pluggable metric collectors.")
429 (home-page "https://github.com/prometheus/node_exporter")
430 (license license:asl2.0)))
431
432 (define-public fswatch
433 (package
434 (name "fswatch")
435 (version "1.15.0")
436 (source (origin
437 (method git-fetch)
438 (uri (git-reference
439 (url "https://github.com/emcrisostomo/fswatch")
440 (commit version)))
441 (file-name (git-file-name name version))
442 (sha256
443 (base32
444 "1yz65jsbgdx4cmy16x24wz5di352lvyi7fp6jm90bhgl1vpzxlsx"))))
445 (build-system gnu-build-system)
446 (native-inputs
447 `(("autoconf" ,autoconf)
448 ("automake" ,automake)
449 ("gettext" ,gettext-minimal)
450 ("libtool" ,libtool)))
451 (synopsis "File system monitor")
452 (description "This package provides a file system monitor.")
453 (home-page "https://github.com/emcrisostomo/fswatch")
454 (license license:gpl3+)))
455
456 (define-public collectd
457 (package
458 (name "collectd")
459 (version "5.11.0")
460 (source (origin
461 (method url-fetch)
462 (uri (string-append
463 "https://storage.googleapis.com/collectd-tarballs/collectd-"
464 version
465 ".tar.bz2"))
466 (sha256
467 (base32
468 "1cjxksxdqcqdccz1nbnc2fp6yy84qq361ynaq5q8bailds00mc9p"))
469 (patches (search-patches "collectd-5.11.0-noinstallvar.patch"))))
470 (build-system gnu-build-system)
471 (arguments
472 `(#:configure-flags (list "--localstatedir=/var" "--sysconfdir=/etc")
473 #:phases (modify-phases %standard-phases
474 (add-before 'configure 'autoreconf
475 (lambda _
476 ;; Required because of patched sources.
477 (invoke "autoreconf" "-vfi"))))))
478 (inputs
479 `(("rrdtool" ,rrdtool)
480 ("curl" ,curl)
481 ("libyajl" ,libyajl)))
482 (native-inputs
483 `(("autoconf" ,autoconf)
484 ("automake" ,automake)
485 ("libtool" ,libtool)
486 ("pkg-config" ,pkg-config)))
487 (home-page "https://collectd.org/")
488 (synopsis "Collect system and application performance metrics periodically")
489 (description
490 "collectd gathers metrics from various sources such as the operating system,
491 applications, log files and external devices, and stores this information or
492 makes it available over the network. Those statistics can be used to monitor
493 systems, find performance bottlenecks (i.e., performance analysis) and predict
494 future system load (i.e., capacity planning).")
495 ;; license:expat for the daemon in src/daemon/ and some plugins,
496 ;; license:gpl2 for other plugins
497 (license (list license:expat license:gpl2))))
498