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