├── README.md
├── conf.d
├── groups.conf
├── hosts.conf
└── services.conf
├── configs
├── grafana-snmp-dashboard.json
├── icingaweb2-grafana-config.ini
├── icingaweb2-grafana-graphs.ini
└── icingaweb2-grafana-snmp-graphs.ini
├── plugins
└── check_open_files
└── screens
├── base-dashboard.png
├── base-icingaweb2.png
├── snmp-dashboard.png
└── snmp-icingaweb2.png
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Setup guide for Icinga2 with Grafana integration employing InfluxDB
3 |
4 | ## This guide uses Debian 10 "Buster" as base
5 |
6 | ```bash
7 | cat /etc/apt/sources.list
8 |
9 | deb http://deb.debian.org/debian buster main
10 | deb-src http://deb.debian.org/debian buster main
11 |
12 | deb http://security.debian.org/ buster/updates main
13 | deb-src http://security.debian.org/ buster/updates main
14 |
15 | deb http://deb.debian.org/debian buster-updates main
16 | deb-src http://deb.debian.org/debian buster-updates main
17 |
18 | deb http://deb.debian.org/debian buster-backports main
19 | deb-src http://deb.debian.org/debian buster-backports main
20 | ```
21 |
22 | ## Setup Icinga2
23 |
24 | #### Add source
25 |
26 | ```bash
27 | wget -O - https://packages.icinga.com/icinga.key | apt-key add -
28 |
29 | echo "deb http://packages.icinga.com/debian icinga-buster main" > /etc/apt/sources.list.d/icinga.list
30 | echo "deb-src http://packages.icinga.com/debian icinga-buster main" >> /etc/apt/sources.list.d/icinga.list
31 | ```
32 |
33 | #### Get packages
34 |
35 | ```bash
36 | apt-get update
37 | apt-get install icinga2 monitoring-plugins
38 | ```
39 |
40 | #### Check service status
41 |
42 | ```bash
43 | systemctl status icinga2.service
44 |
45 | ● icinga2.service - Icinga host/service/network monitoring system
46 | Loaded: loaded (/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
47 | Active: active (running) since Fri 2017-07-28 13:46:00 BST; 16s ago
48 | ```
49 |
50 | ## Setup Icinga2 MySQL support
51 |
52 | #### Get packages
53 |
54 | ```bash
55 | apt-get install icinga2-ido-mysql mariadb-server mariadb-client
56 | ```
57 | Questions during installation:
58 | * Enable Icinga 2's ido-mysql feature? `No`
59 | * Configure database for icinga2-ido-mysql with dbconfig-common? `No`
60 |
61 | #### Secure MySQL installation
62 |
63 | ```bash
64 | mysql_secure_installation
65 | ```
66 |
67 | #### Create database and user
68 |
69 | ```bash
70 | mysql -u root -p
71 | ```
72 | ```sql
73 | CREATE DATABASE icinga2 CHARACTER SET utf8 COLLATE utf8_general_ci;
74 | GRANT ALL ON icinga2.* TO 'icinga2'@'localhost' IDENTIFIED BY 'your-icinga2-pwd';
75 | ```
76 |
77 | #### Import database schema
78 |
79 | ```bash
80 | mysql -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
81 | ```
82 |
83 | #### Enable mysql module
84 |
85 | ```bash
86 | icinga2 feature enable ido-mysql
87 | ```
88 |
89 | #### Configure database access for icinga instance
90 |
91 | ```bash
92 | vim /etc/icinga2/features-available/ido-mysql.conf
93 | ```
94 | ```diff
95 | - password = "",
96 | - host = "localhost",
97 | + password = "your-icinga2-pwd",
98 | + host = "127.0.0.1",
99 | ```
100 |
101 | ## Setup Icinga2 web interface
102 |
103 | #### Get packages
104 |
105 | ```bash
106 | apt-get install apache2 icingacli icingaweb2 icingaweb2-module-monitoring \
107 | php php-intl php-imagick php-gd php-mysql php-curl php-mbstring
108 | ```
109 |
110 | #### Set PHP default timezone
111 |
112 | ```bash
113 | vim /etc/php/7.3/apache2/php.ini
114 | ```
115 | ```diff
116 | -;date.timezone =
117 | +date.timezone = Europe/Paris
118 | ```
119 | ```bash
120 | systemctl restart apache2.service
121 | ```
122 |
123 | #### Create database and user
124 |
125 | ```bash
126 | mysql -u root -p
127 | ```
128 | ```sql
129 | CREATE DATABASE icingaweb2 CHARACTER SET utf8 COLLATE utf8_general_ci;
130 | GRANT ALL ON icingaweb2.* TO 'icingaweb2'@'localhost' IDENTIFIED BY 'your-icingaweb2-pwd';
131 | ```
132 |
133 | #### Import database schema
134 |
135 | ```bash
136 | mysql -p icingaweb2 < /usr/share/icingaweb2/etc/schema/mysql.schema.sql
137 | ```
138 |
139 | #### Enable external command pipe
140 |
141 | ```bash
142 | icinga2 feature enable command
143 | systemctl restart icinga2.service
144 | ```
145 |
146 | #### Create setup token
147 |
148 | ```bash
149 | icingacli setup config directory --group icingaweb2
150 | icingacli setup token create
151 | ```
152 |
153 | #### Setup using web interface
154 |
155 | http://your-public-host.name/icingaweb2/setup
156 |
157 | Setup Token: `Your Token`
158 | *Next*
159 |
160 | Modules enabled: `Monitoring`
161 | *Next*
162 |
163 | Authentication Type: `Database`
164 | *Next*
165 |
166 | Resource Name: `icingaweb_db`
167 | Database Type: `MySQL`
168 | Host: `127.0.0.1`
169 | Port: `3306`
170 | Database Name: `icingaweb2`
171 | Username: `icingaweb2`
172 | Password: `your-icingaweb2-pwd`
173 | Character Set: `utf8`
174 | Use SSL: `False`
175 | *Next*
176 |
177 | Backend Name: `icingaweb2`
178 | *Next*
179 |
180 | Username: `admin`
181 | Password: `your-admin-pwd`
182 | Repeat password: `your-admin-pwd`
183 | *Next*
184 |
185 | Show Stacktraces: `Yes`
186 | Show Application State Messages: `Yes`
187 | User Preference Storage Type: `Database`
188 | Logging Type: `Syslog`
189 | Logging Level: `Error`
190 | Application Prefix: `icingaweb2`
191 | Facility: `user`
192 | *Next*
193 |
194 | Backend Name: `icinga`
195 | Backend Type: `IDO`
196 | *Next*
197 |
198 | Resource Name: `icinga_ido`
199 | Database Type: `MySQL`
200 | Host: `127.0.0.1`
201 | Port: `3306`
202 | Database Name: `icinga2`
203 | Username: `icinga2`
204 | Password: `your-icinga2-pwd`
205 | Character Set: `utf8`
206 | Use SSL: `False`
207 | *Next*
208 |
209 | Transport Name: `icinga2`
210 | Transport Type: `Local Command File`
211 | Command File: `/var/run/icinga2/cmd/icinga2.cmd`
212 | *Next*
213 |
214 | Protected Custom Variables: `*pw*,*pass*,community`
215 | *Next*
216 |
217 | ## Setup graphing module Grafana
218 |
219 | #### Add source
220 |
221 | ```bash
222 | wget -O - https://packages.grafana.com/gpg.key | apt-key add -
223 |
224 | echo "deb https://packages.grafana.com/oss/deb stable main" > /etc/apt/sources.list.d/grafana.list
225 | ```
226 |
227 | #### Get packages
228 |
229 | ```bash
230 | apt-get update
231 | apt-get install grafana influxdb influxdb-client
232 | ```
233 |
234 | #### Enable and start Grafana service
235 |
236 | ```bash
237 | systemctl daemon-reload
238 | systemctl enable grafana-server.service
239 | systemctl start grafana-server.service
240 | ```
241 |
242 | #### Create database and user
243 |
244 | ```bash
245 | influx
246 | ```
247 | ```sql
248 | CREATE DATABASE icinga2;
249 | CREATE USER icinga2 WITH PASSWORD 'your-icinga2-pwd';
250 | ```
251 |
252 | #### Send performance data to influx
253 |
254 | ```bash
255 | icinga2 feature enable influxdb
256 |
257 | vim /etc/icinga2/features-enabled/influxdb.conf
258 | ```
259 | ```diff
260 | - //host = "127.0.0.1"
261 | - //port = 8086
262 | - //database = "icinga2"
263 | - //flush_threshold = 1024
264 | - //flush_interval = 10s
265 | - //host_template = {
266 | - // measurement = "$host.check_command$"
267 | - // tags = {
268 | - // hostname = "$host.name$"
269 | - // }
270 | - //}
271 | - //service_template = {
272 | - // measurement = "$service.check_command$"
273 | - // tags = {
274 | - // hostname = "$host.name$"
275 | - // service = "$service.name$"
276 | - // }
277 | - //}
278 | + host = "127.0.0.1"
279 | + port = 8086
280 | + database = "icinga2"
281 | + username = "icinga2"
282 | + password = "your-icinga2-pwd"
283 | + enable_send_thresholds = true
284 | + enable_send_metadata = true
285 | + flush_threshold = 1024
286 | + flush_interval = 10s
287 | + host_template = {
288 | + measurement = "$host.check_command$"
289 | + tags = {
290 | + hostname = "$host.name$"
291 | + }
292 | + }
293 | + service_template = {
294 | + measurement = "$service.check_command$"
295 | + tags = {
296 | + hostname = "$host.name$"
297 | + service = "$service.name$"
298 | + }
299 | + }
300 | ```
301 | ```bash
302 | systemctl restart icinga2.service
303 | ```
304 |
305 | #### Navigate to Grafana web interface
306 |
307 | Url: `http://your-public-host.name:3000`
308 | Username: `admin`
309 | Password: `admin`
310 |
311 | #### Create new Grafana datasource
312 |
313 | Add Datasource: http://your-public-host.name:3000/datasources/new?gettingstarted
314 |
315 | Name: `InfluxDB`
316 | Type: `InfluxDB`
317 | Default: `Yes`
318 |
319 | Url: `http://127.0.0.1:8086`
320 | Access: `Server (Default)`
321 |
322 | Database: `icinga2`
323 | User: `icinga2`
324 | Password: `your-icinga2-pwd`
325 |
326 | #### Import Grafana dashboard
327 |
328 | Import Dashboard: http://your-public-host.name:3000/dashboard/import
329 |
330 | Paste JSON from https://raw.githubusercontent.com/Mikesch-mp/icingaweb2-module-grafana/v1.1.8/dashboards/influxdb/base-metrics.json
331 |
332 | 
333 |
334 | #### Add Icinga Web Grafana module
335 |
336 | ```bash
337 | cd /usr/share/icingaweb2/modules
338 | wget -qO- https://github.com/Mikesch-mp/icingaweb2-module-grafana/archive/v1.3.5.tar.gz | tar xvz
339 | mv icingaweb2-module-grafana-1.3.5 grafana
340 | mkdir /etc/icingaweb2/modules/grafana
341 | ```
342 |
343 | #### Configure Icinga Web Grafana module
344 |
345 | Module configuriation ([config.ini](configs/icingaweb2-grafana-config.ini))
346 | ```bash
347 | vim /etc/icingaweb2/modules/grafana/config.ini
348 | ```
349 |
350 | Graph configuriation ([graphs.ini](configs/icingaweb2-grafana-graphs.ini))
351 | ```bash
352 | vim /etc/icingaweb2/modules/grafana/graphs.ini
353 | ```
354 |
355 | #### Enable anonymous access
356 |
357 | ```bash
358 | vim /etc/grafana/grafana.ini
359 | ```
360 | ```diff
361 | [auth.anonymous]
362 | # enable anonymous access
363 | -;enabled = false
364 | +enabled = true
365 | ```
366 | ```diff
367 | # set to true if you want to allow browsers to render Grafana in a ,