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 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages monitoring)
20 #:use-module (guix packages)
21 #:use-module (guix download)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix build-system perl)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages base)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages gd)
28 #:use-module (gnu packages image)
29 #:use-module (gnu packages mail)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages zip))
32
33 (define-public nagios
34 (package
35 (name "nagios")
36 (version "4.2.4")
37 ;; XXX: Nagios 4.2.x and later bundle a copy of AngularJS.
38 (source (origin
39 (method url-fetch)
40 (uri (string-append
41 "mirror://sourceforge/nagios/nagios-4.x/nagios-"
42 version "/nagios-" version ".tar.gz"))
43 (sha256
44 (base32
45 "0w0blbwiw0ps04b7gkyyk89qkgwsxh6gydhmggbm1kl3ar3mq1dh"))
46 (modules '((guix build utils)))
47 (snippet
48 ;; Ensure reproducibility.
49 '(substitute* (find-files "cgi" "\\.c$")
50 (("__DATE__") "\"1970-01-01\"")
51 (("__TIME__") "\"00:00:00\"")))))
52 (build-system gnu-build-system)
53 (native-inputs
54 `(("unzip" ,unzip)))
55 (inputs
56 `(("zlib" ,zlib)
57 ("libpng-apng" ,libpng)
58 ("gd" ,gd)
59 ("perl" ,perl)
60 ("mailutils" ,mailutils)))
61 (arguments
62 '(#:configure-flags (list "--sysconfdir=/etc"
63
64 ;; 'include/locations.h.in' defines file
65 ;; locations, and many things go directly under
66 ;; LOCALSTATEDIR, hence the extra '/nagios'.
67 "--localstatedir=/var/nagios"
68
69 (string-append
70 "--with-mail="
71 (assoc-ref %build-inputs "mailutils")
72 "/bin/mail"))
73 #:make-flags '("all")
74 #:phases (modify-phases %standard-phases
75 (add-before 'build 'do-not-chown-to-nagios
76 (lambda _
77 ;; Makefiles do 'install -o nagios -g nagios', which
78 ;; doesn't work for us.
79 (substitute* (find-files "." "^Makefile$")
80 (("-o nagios -g nagios")
81 ""))
82 #t))
83 (add-before 'build 'do-not-create-sysconfdir
84 (lambda _
85 ;; Don't try to create /var upon 'make install'.
86 (substitute* "Makefile"
87 (("\\$\\(INSTALL\\).*\\$\\(LOGDIR\\).*$" all)
88 (string-append "# " all))
89 (("\\$\\(INSTALL\\).*\\$\\(CHECKRESULTDIR\\).*$" all)
90 (string-append "# " all))
91 (("chmod g\\+s.*" all)
92 (string-append "# " all)))
93 #t))
94 (add-before 'build 'set-html/php-directory
95 (lambda _
96 ;; Install HTML and PHP files under 'share/nagios/html'
97 ;; instead of just 'share/'.
98 (substitute* '("html/Makefile" "Makefile")
99 (("HTMLDIR=.*$")
100 "HTMLDIR = $(datarootdir)/nagios/html\n"))
101 #t)))
102 #:tests? #f)) ;no 'check' target or similar
103 (home-page "https://www.nagios.org/")
104 (synopsis "Host, service, and network monitoring program")
105 (description
106 "Nagios is a host, service, and network monitoring program written in C.
107 CGI programs are included to allow you to view the current status, history,
108 etc. via a Web interface. Features include:
109
110 @itemize
111 @item Monitoring of network services (via SMTP, POP3, HTTP, PING, etc).
112 @item Monitoring of host resources (processor load, disk usage, etc.).
113 @item A plugin interface to allow for user-developed service monitoring
114 methods.
115 @item Ability to define network host hierarchy using \"parent\" hosts,
116 allowing detection of and distinction between hosts that are down
117 and those that are unreachable.
118 @item Notifications when problems occur and get resolved (via email,
119 pager, or user-defined method).
120 @item Ability to define event handlers for proactive problem resolution.
121 @item Automatic log file rotation/archiving.
122 @item Optional web interface for viewing current network status,
123 notification and problem history, log file, etc.
124 @end itemize\n")
125 (license license:gpl2)))