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