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