gnu: Add python-black.
[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 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>
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 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))
52
53 (define-public nagios
54 (package
55 (name "nagios")
56 (version "4.3.4")
57 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
58 (source (origin
59 (method url-fetch)
60 (uri (string-append
61 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
62 version "/nagios-" version ".tar.gz"))
63 (sha256
64 (base32
65 "1wa4m952sb23dqi5w759adimsp21bkhp598rpq9dnhz3v497h2y9"))
66 (modules '((guix build utils)))
67 (snippet
68 ;; Ensure reproducibility.
69 '(begin
70 (substitute* (find-files "cgi" "\\.c$")
71 (("__DATE__") "\"1970-01-01\"")
72 (("__TIME__") "\"00:00:00\""))
73 #t))))
74 (build-system gnu-build-system)
75 (native-inputs
76 `(("unzip" ,unzip)))
77 (inputs
78 `(("zlib" ,zlib)
79 ("libpng-apng" ,libpng)
80 ("gd" ,gd)
81 ("perl" ,perl)
82 ("mailutils" ,mailutils)))
83 (arguments
84 '(#:configure-flags (list "--sysconfdir=/etc"
85
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"
90
91 (string-append
92 "--with-mail="
93 (assoc-ref %build-inputs "mailutils")
94 "/bin/mail"))
95 #:make-flags '("all")
96 #:phases (modify-phases %standard-phases
97 (add-before 'build 'do-not-chown-to-nagios
98 (lambda _
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")
103 ""))
104 #t))
105 (add-before 'build 'do-not-create-sysconfdir
106 (lambda _
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)))
115 #t))
116 (add-before 'build 'set-html/php-directory
117 (lambda _
118 ;; Install HTML and PHP files under 'share/nagios/html'
119 ;; instead of just 'share/'.
120 (substitute* '("html/Makefile" "Makefile")
121 (("HTMLDIR=.*$")
122 "HTMLDIR = $(datarootdir)/nagios/html\n"))
123 #t)))
124 #:tests? #f)) ;no 'check' target or similar
125 (home-page "https://www.nagios.org/")
126 (synopsis "Host, service, and network monitoring program")
127 (description
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:
131
132 @itemize
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
136 methods.
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.
146 @end itemize\n")
147 (license license:gpl2)))
148
149 (define-public zabbix-agentd
150 (package
151 (name "zabbix-agentd")
152 (version "3.4.11")
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append
157 "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/" version
158 "/zabbix-" version ".tar.gz"))
159 (sha256
160 (base32
161 "0qxgf6hx7ibhjmxd2sxizkjc8df4c9d31wz5hhql409ws98qf173"))))
162 (build-system gnu-build-system)
163 (arguments
164 `(#:configure-flags
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")))))
170 (inputs
171 `(("libiconv" ,libiconv)
172 ("pcre" ,pcre)))
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)))
178
179 (define-public zabbix-server
180 (package
181 (inherit zabbix-agentd)
182 (name "zabbix-server")
183 (arguments
184 (substitute-keyword-arguments
185 `(#:phases
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")))
193 (mkdir-p php)
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"
201 "--with-postgresql"
202 (string-append "--with-libevent="
203 (assoc-ref %build-inputs "libevent"))
204 "--with-net-snmp"
205 (string-append "--with-gnutls="
206 (assoc-ref %build-inputs "gnutls"))
207 "--with-libcurl"
208 ,flags))))
209 (inputs
210 `(("curl" ,curl)
211 ("libevent" ,libevent)
212 ("gnutls" ,gnutls)
213 ("postgresql" ,postgresql)
214 ("zlib" ,zlib)
215 ("net-snmp" ,net-snmp)
216 ("curl" ,curl)
217 ,@(package-inputs zabbix-agentd)))
218 (synopsis "Distributed monitoring solution (server-side)")
219 (description "This package provides a distributed monitoring
220 solution (server-side)")))
221
222 (define-public darkstat
223 (package
224 (name "darkstat")
225 (version "3.0.719")
226 (source (origin
227 (method url-fetch)
228 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
229 version ".tar.bz2"))
230 (sha256
231 (base32
232 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
233 (build-system gnu-build-system)
234 (arguments '(#:tests? #f)) ; no tests
235 (inputs
236 `(("libpcap" ,libpcap)
237 ("zlib" ,zlib)))
238 (home-page "https://unix4lyfe.org/darkstat/")
239 (synopsis "Network statistics gatherer")
240 (description
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
243 HTTP. Features:
244
245 @itemize
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.
250 @item Supports IPv6.
251 @end itemize")
252 (license license:gpl2)))
253
254 (define-public python-whisper
255 (package
256 (name "python-whisper")
257 (version "1.0.2")
258 (source
259 (origin
260 (method url-fetch)
261 (uri (pypi-uri "whisper" version))
262 (sha256
263 (base32
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
273 historical data.")
274 (license license:asl2.0)))
275
276 (define-public python2-whisper
277 (package-with-python2 python-whisper))
278
279 (define-public python2-carbon
280 (package
281 (name "python2-carbon")
282 (version "1.0.2")
283 (source
284 (origin
285 (method url-fetch)
286 (uri (pypi-uri "carbon" version))
287 (sha256
288 (base32
289 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
290 (build-system python-build-system)
291 (arguments
292 `(#:python ,python-2 ; only supports Python 2
293 #:phases
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)))))
298 (propagated-inputs
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)))
309
310 (define-public python2-graphite-web
311 (package
312 (name "python2-graphite-web")
313 (version "1.0.2")
314 (source
315 (origin
316 (method url-fetch)
317 (uri (pypi-uri "graphite-web" version))
318 (sha256
319 (base32
320 "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc"))))
321 (build-system python-build-system)
322 (arguments
323 `(#:python ,python-2 ; only supports Python 2
324 #:phases
325 (modify-phases %standard-phases
326 (add-after 'unpack 'relax-requirements
327 (lambda _
328 (substitute* "setup.py"
329 (("0.4.3") ,(package-version python2-django-tagging))
330 (("<1.9.99") (string-append "<="
331 ,(package-version python2-django))))
332 #t))
333 ;; Don't install to /opt
334 (add-after 'unpack 'do-not-install-to-/opt
335 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
336 (propagated-inputs
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
350 demand.")
351 (license license:asl2.0)))
352
353 (define-public python-prometheus-client
354 (package
355 (name "python-prometheus-client")
356 (version "0.1.1")
357 (source
358 (origin
359 (method url-fetch)
360 (uri (pypi-uri "prometheus_client" version))
361 (sha256
362 (base32
363 "164qzzg8q8awqk0angcm87p2sjiibaj1wgjz0xk6j0klvqi5q2mz"))))
364 (build-system python-build-system)
365 (arguments
366 '(;; No included tests.
367 #:tests? #f))
368 (home-page
369 "https://github.com/prometheus/client_python")
370 (synopsis "Python client for the Prometheus monitoring system")
371 (description
372 "The @code{prometheus_client} package supports exposing metrics from
373 software written in Python, so that they can be scraped by a Prometheus
374 service.
375
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)))
379
380 (define-public python2-prometheus-client
381 (package-with-python2 python-prometheus-client))
382
383 (define-public go-github-com-prometheus-node-exporter
384 (let ((commit "55c32fcf02492fe4946f7ab563547cc5df7fc61e")
385 (revision "0"))
386 (package
387 (name "go-github-com-prometheus-node-exporter")
388 (version (git-version "0.0.0" revision commit))
389 (source (origin
390 (method git-fetch)
391 (uri (git-reference
392 (url "https://github.com/prometheus/node_exporter.git")
393 (commit commit)))
394 (file-name (git-file-name name version))
395 (sha256
396 (base32
397 "041b87a0sid23c29swqmi5hw6cxbxvkfj3415jg73cm2pi8wh5s6"))))
398 (build-system go-build-system)
399 (arguments
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))))