Merge branch 'master' into core-updates
[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 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages monitoring)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix build-system perl)
27 #:use-module (guix build-system python)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages admin)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages django)
34 #:use-module (gnu packages gd)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages mail)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages python-web)
40 #:use-module (gnu packages time))
41
42 (define-public nagios
43 (package
44 (name "nagios")
45 (version "4.3.4")
46 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
47 (source (origin
48 (method url-fetch)
49 (uri (string-append
50 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
51 version "/nagios-" version ".tar.gz"))
52 (sha256
53 (base32
54 "1wa4m952sb23dqi5w759adimsp21bkhp598rpq9dnhz3v497h2y9"))
55 (modules '((guix build utils)))
56 (snippet
57 ;; Ensure reproducibility.
58 '(begin
59 (substitute* (find-files "cgi" "\\.c$")
60 (("__DATE__") "\"1970-01-01\"")
61 (("__TIME__") "\"00:00:00\""))
62 #t))))
63 (build-system gnu-build-system)
64 (native-inputs
65 `(("unzip" ,unzip)))
66 (inputs
67 `(("zlib" ,zlib)
68 ("libpng-apng" ,libpng)
69 ("gd" ,gd)
70 ("perl" ,perl)
71 ("mailutils" ,mailutils)))
72 (arguments
73 '(#:configure-flags (list "--sysconfdir=/etc"
74
75 ;; 'include/locations.h.in' defines file
76 ;; locations, and many things go directly under
77 ;; LOCALSTATEDIR, hence the extra '/nagios'.
78 "--localstatedir=/var/nagios"
79
80 (string-append
81 "--with-mail="
82 (assoc-ref %build-inputs "mailutils")
83 "/bin/mail"))
84 #:make-flags '("all")
85 #:phases (modify-phases %standard-phases
86 (add-before 'build 'do-not-chown-to-nagios
87 (lambda _
88 ;; Makefiles do 'install -o nagios -g nagios', which
89 ;; doesn't work for us.
90 (substitute* (find-files "." "^Makefile$")
91 (("-o nagios -g nagios")
92 ""))
93 #t))
94 (add-before 'build 'do-not-create-sysconfdir
95 (lambda _
96 ;; Don't try to create /var upon 'make install'.
97 (substitute* "Makefile"
98 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
99 (string-append "# " all))
100 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
101 (string-append "# " all))
102 (("chmod g\\+s.*" all)
103 (string-append "# " all)))
104 #t))
105 (add-before 'build 'set-html/php-directory
106 (lambda _
107 ;; Install HTML and PHP files under 'share/nagios/html'
108 ;; instead of just 'share/'.
109 (substitute* '("html/Makefile" "Makefile")
110 (("HTMLDIR=.*$")
111 "HTMLDIR = $(datarootdir)/nagios/html\n"))
112 #t)))
113 #:tests? #f)) ;no 'check' target or similar
114 (home-page "https://www.nagios.org/")
115 (synopsis "Host, service, and network monitoring program")
116 (description
117 "Nagios is a host, service, and network monitoring program written in C.
118 CGI programs are included to allow you to view the current status, history,
119 etc. via a Web interface. Features include:
120
121 @itemize
122 @item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
123 @item Monitoring of host resources (processor load, disk usage, etc.).
124 @item A plugin interface to allow for user-developed service monitoring
125 methods.
126 @item Ability to define network host hierarchy using \"parent\" hosts,
127 allowing detection of and distinction between hosts that are down
128 and those that are unreachable.
129 @item Notifications when problems occur and get resolved (via email,
130 pager, or user-defined method).
131 @item Ability to define event handlers for proactive problem resolution.
132 @item Automatic log file rotation/archiving.
133 @item Optional web interface for viewing current network status,
134 notification and problem history, log file, etc.
135 @end itemize\n")
136 (license license:gpl2)))
137
138 (define-public darkstat
139 (package
140 (name "darkstat")
141 (version "3.0.719")
142 (source (origin
143 (method url-fetch)
144 (uri (string-append "https://unix4lyfe.org/darkstat/darkstat-"
145 version ".tar.bz2"))
146 (sha256
147 (base32
148 "1mzddlim6dhd7jhr4smh0n2fa511nvyjhlx76b03vx7phnar1bxf"))))
149 (build-system gnu-build-system)
150 (arguments '(#:tests? #f)) ; no tests
151 (inputs
152 `(("libpcap" ,libpcap)
153 ("zlib" ,zlib)))
154 (home-page "https://unix4lyfe.org/darkstat/")
155 (synopsis "Network statistics gatherer")
156 (description
157 "@command{darkstat} is a packet sniffer that runs as a background process,
158 gathers all sorts of statistics about network usage, and serves them over
159 HTTP. Features:
160
161 @itemize
162 @item Traffic graphs, reports per host, shows ports for each host.
163 @item Embedded web-server with deflate compression.
164 @item Asynchronous reverse DNS resolution using a child process.
165 @item Small. Portable. Single-threaded. Efficient.
166 @item Supports IPv6.
167 @end itemize")
168 (license license:gpl2)))
169
170 (define-public python-whisper
171 (package
172 (name "python-whisper")
173 (version "1.0.2")
174 (source
175 (origin
176 (method url-fetch)
177 (uri (pypi-uri "whisper" version))
178 (sha256
179 (base32
180 "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3"))))
181 (build-system python-build-system)
182 (home-page "http://graphiteapp.org/")
183 (synopsis "Fixed size round-robin style database for Graphite")
184 (description "Whisper is one of three components within the Graphite
185 project. Whisper is a fixed-size database, similar in design and purpose to
186 RRD (round-robin-database). It provides fast, reliable storage of numeric
187 data over time. Whisper allows for higher resolution (seconds per point) of
188 recent data to degrade into lower resolutions for long-term retention of
189 historical data.")
190 (license license:asl2.0)))
191
192 (define-public python2-whisper
193 (package-with-python2 python-whisper))
194
195 (define-public python2-carbon
196 (package
197 (name "python2-carbon")
198 (version "1.0.2")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (pypi-uri "carbon" version))
203 (sha256
204 (base32
205 "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn"))))
206 (build-system python-build-system)
207 (arguments
208 `(#:python ,python-2 ; only supports Python 2
209 #:phases
210 (modify-phases %standard-phases
211 ;; Don't install to /opt
212 (add-after 'unpack 'do-not-install-to-/opt
213 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
214 (propagated-inputs
215 `(("python2-whisper" ,python2-whisper)
216 ("python2-configparser" ,python2-configparser)
217 ("python2-txamqp" ,python2-txamqp)))
218 (home-page "http://graphiteapp.org/")
219 (synopsis "Backend data caching and persistence daemon for Graphite")
220 (description "Carbon is a backend data caching and persistence daemon for
221 Graphite. Carbon is responsible for receiving metrics over the network,
222 caching them in memory for \"hot queries\" from the Graphite-Web application,
223 and persisting them to disk using the Whisper time-series library.")
224 (license license:asl2.0)))
225
226 (define-public python2-graphite-web
227 (package
228 (name "python2-graphite-web")
229 (version "1.0.2")
230 (source
231 (origin
232 (method url-fetch)
233 (uri (pypi-uri "graphite-web" version))
234 (sha256
235 (base32
236 "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc"))))
237 (build-system python-build-system)
238 (arguments
239 `(#:python ,python-2 ; only supports Python 2
240 #:phases
241 (modify-phases %standard-phases
242 (add-after 'unpack 'relax-requirements
243 (lambda _
244 (substitute* "setup.py"
245 (("0.4.3") ,(package-version python2-django-tagging))
246 (("<1.9.99") (string-append "<="
247 ,(package-version python2-django))))
248 #t))
249 ;; Don't install to /opt
250 (add-after 'unpack 'do-not-install-to-/opt
251 (lambda _ (setenv "GRAPHITE_NO_PREFIX" "1") #t)))))
252 (propagated-inputs
253 `(("python2-cairocffi" ,python2-cairocffi)
254 ("python2-pytz" ,python2-pytz)
255 ("python2-whisper" ,python2-whisper)
256 ("python2-django" ,python2-django)
257 ("python2-django-tagging" ,python2-django-tagging)
258 ("python2-scandir" ,python2-scandir)
259 ("python2-urllib3" ,python2-urllib3)
260 ("python2-pyparsing" ,python2-pyparsing)
261 ("python2-txamqp" ,python2-txamqp)))
262 (home-page "http://graphiteapp.org/")
263 (synopsis "Scalable realtime graphing system")
264 (description "Graphite is a scalable real-time graphing system that does
265 two things: store numeric time-series data, and render graphs of this data on
266 demand.")
267 (license license:asl2.0)))
268
269 (define-public python-prometheus-client
270 (package
271 (name "python-prometheus-client")
272 (version "0.1.1")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "prometheus_client" version))
277 (sha256
278 (base32
279 "164qzzg8q8awqk0angcm87p2sjiibaj1wgjz0xk6j0klvqi5q2mz"))))
280 (build-system python-build-system)
281 (arguments
282 '(;; No included tests.
283 #:tests? #f))
284 (home-page
285 "https://github.com/prometheus/client_python")
286 (synopsis "Python client for the Prometheus monitoring system")
287 (description
288 "The @code{prometheus_client} package supports exposing metrics from
289 software written in Python, so that they can be scraped by a Prometheus
290 service.
291
292 Metrics can be exposed through a standalone web server, or through Twisted,
293 WSGI and the node exporter textfile collector.")
294 (license license:asl2.0)))
295
296 (define-public python2-prometheus-client
297 (package-with-python2 python-prometheus-client))