gnu: gtk+-2: Split binaries.
[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 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, 2019 Oleg Pykhalov <go.wigust@gmail.com>
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)
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 autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages django)
42 #:use-module (gnu packages gd)
43 #:use-module (gnu packages gettext)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages mail)
46 #:use-module (gnu packages networking)
47 #:use-module (gnu packages libevent)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-web)
52 #:use-module (gnu packages python-xyz)
53 #:use-module (gnu packages time)
54 #:use-module (gnu packages tls))
55
56 (define-public nagios
57 (package
58 (name "nagios")
59 (version "4.3.4")
60 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
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
68 "1wa4m952sb23dqi5w759adimsp21bkhp598rpq9dnhz3v497h2y9"))
69 (modules '((guix build utils)))
70 (snippet
71 ;; Ensure reproducibility.
72 '(begin
73 (substitute* (find-files "cgi" "\\.c$")
74 (("__DATE__") "\"1970-01-01\"")
75 (("__TIME__") "\"00:00:00\""))
76 #t))))
77 (build-system gnu-build-system)
78 (native-inputs
79 `(("unzip" ,unzip)))
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.
132 CGI programs are included to allow you to view the current status, history,
133 etc. 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)))
151
152 (define-public zabbix-agentd
153 (package
154 (name "zabbix-agentd")
155 (version "4.4.1")
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
164 "0jjn2przn9s25slrcxmq8iqdgqkgxnqs45zy0n1ma6nlgmclxxqb"))))
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
179 solution (client-side agent)")
180 (license license:gpl2)))
181
182 (define-public zabbix-server
183 (package
184 (inherit zabbix-agentd)
185 (name "zabbix-server")
186 (outputs '("out" "front-end" "schema"))
187 (arguments
188 (substitute-keyword-arguments
189 `(#:phases
190 (modify-phases %standard-phases
191 (add-after 'install 'install-front-end
192 (lambda* (#:key outputs #:allow-other-keys)
193 (let* ((php (string-append (assoc-ref outputs "front-end")
194 "/share/zabbix/php"))
195 (front-end-conf (string-append php "/conf"))
196 (etc (string-append php "/etc")))
197 (mkdir-p php)
198 (copy-recursively "frontends/php" php)
199 ;; Make front-end write config to ‘/etc/zabbix’ directory.
200 (rename-file front-end-conf
201 (string-append front-end-conf "-example"))
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)))
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"
224 (string-append "--with-zlib="
225 (assoc-ref %build-inputs "zlib"))
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
238 solution (server-side)")))
239
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,
260 gathers all sorts of statistics about network usage, and serves them over
261 HTTP. 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)))
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
287 project. Whisper is a fixed-size database, similar in design and purpose to
288 RRD (round-robin-database). It provides fast, reliable storage of numeric
289 data over time. Whisper allows for higher resolution (seconds per point) of
290 recent data to degrade into lower resolutions for long-term retention of
291 historical data.")
292 (license license:asl2.0)))
293
294 (define-public python2-whisper
295 (package-with-python2 python-whisper))
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
323 Graphite. Carbon is responsible for receiving metrics over the network,
324 caching them in memory for \"hot queries\" from the Graphite-Web application,
325 and persisting them to disk using the Whisper time-series library.")
326 (license license:asl2.0)))
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
367 two things: store numeric time-series data, and render graphs of this data on
368 demand.")
369 (license license:asl2.0)))
370
371 (define-public python-prometheus-client
372 (package
373 (name "python-prometheus-client")
374 (version "0.5.0")
375 (source
376 (origin
377 (method url-fetch)
378 (uri (pypi-uri "prometheus_client" version))
379 (sha256
380 (base32
381 "0g7rpv1pq2lab1nfqdx98z9d3bqwc400alg1j4ynrpjkrbsizhg8"))))
382 (build-system python-build-system)
383 (arguments
384 '(;; No included tests.
385 #:tests? #f))
386 (propagated-inputs
387 `(("python-twisted" ,python-twisted)))
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
393 software written in Python, so that they can be scraped by a Prometheus
394 service.
395
396 Metrics can be exposed through a standalone web server, or through Twisted,
397 WSGI 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))
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,
423 written in Go with pluggable metric collectors.")
424 (home-page "https://github.com/prometheus/node_exporter")
425 (license license:asl2.0))))
426
427 (define-public fswatch
428 (package
429 (name "fswatch")
430 (version "1.14.0")
431 (source (origin
432 (method git-fetch)
433 (uri (git-reference
434 (url "https://github.com/emcrisostomo/fswatch.git")
435 (commit version)))
436 (file-name (git-file-name name version))
437 (sha256
438 (base32
439 "1ihn7wp3y7ml2lm8drz2hc6fmgj8kygbygnw8mz7gjax88f9dbx7"))))
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+)))