|
| 1 | +# Operations |
| 2 | + |
| 3 | +This section is a loose collection of various topics and external references for running Icinga DB on a day-to-day basis. |
| 4 | +It covers topics such as self-monitoring, backups, and specifics of third-party components. |
| 5 | + |
| 6 | +## Monitor Icinga DB |
| 7 | + |
| 8 | +It is strongly recommended to monitor the monitoring. |
| 9 | + |
| 10 | +There is a built-in [`icingadb` check command](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#icingadb) in the Icinga 2 ITL. |
| 11 | +It covers several potential errors, including operations that take too long or invalid high availability scenarios. |
| 12 | +Even if the Icinga DB has crashed, checks will still run and Icinga 2 would generate notifications. |
| 13 | + |
| 14 | +In addition, both the Redis® and the relational database should be monitored. |
| 15 | +There are predefined check commands in the ITL to choose from. |
| 16 | + |
| 17 | +- [`redis`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#redis) |
| 18 | +- [`mysql`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#mysql) |
| 19 | +- [`mysql_health`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#mysql_health) |
| 20 | +- [`postgres`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#postgres) |
| 21 | + |
| 22 | +A simpler approach would be to check if the processes are running, e.g., |
| 23 | +with [`proc`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#procs) or |
| 24 | +[`systemd`](https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#systemd). |
| 25 | + |
| 26 | +## Backups |
| 27 | + |
| 28 | +There are only two things to back up in Icinga DB. |
| 29 | + |
| 30 | +1. The configuration file in `/etc/icingadb` and |
| 31 | +2. the relational database, using `mysqldump`, `mariadb-dump` or `pg_dump`. |
| 32 | + |
| 33 | +!!! warning |
| 34 | + |
| 35 | + When creating a database dump for MySQL or MariaDB with `mysqldump` or `mariadb-dump`, |
| 36 | + use the [`--single-transaction` command line argument flag](https://dev.mysql.com/doc/refman/8.4/en/mysqldump.html#option_mysqldump_single-transaction) |
| 37 | + to not lock the whole database while the backup is running. |
| 38 | + |
| 39 | +## Third-Party Configuration |
| 40 | + |
| 41 | +Icinga DB relies on external components to work. |
| 42 | +The following collection is based on experience. |
| 43 | +It is a target for continuous improvement. |
| 44 | + |
| 45 | +### MySQL and MariaDB |
| 46 | + |
| 47 | +#### `max_allow_packets` |
| 48 | + |
| 49 | +The `max_allow_packets` system variable limits the size of messages between MySQL/MariaDB servers and clients. |
| 50 | +More information is available in |
| 51 | +[MySQL's "Replication and max_allowed_packet" documentation section](https://dev.mysql.com/doc/refman/8.4/en/replication-features-max-allowed-packet.html), |
| 52 | +[MySQL's variable documentation](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_max_allowed_packet) and |
| 53 | +[MariaDB's variable documentation](https://mariadb.com/kb/en/server-system-variables/#max_allowed_packet). |
| 54 | + |
| 55 | +The database configuration should have `max_allow_packets` set to at least `64M`. |
| 56 | + |
| 57 | +#### Amazon RDS for MySQL |
| 58 | + |
| 59 | +When importing the MySQL schema into Amazon RDS for MySQL, the following may occur. |
| 60 | + |
| 61 | +``` |
| 62 | +Error 1419: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) |
| 63 | +``` |
| 64 | + |
| 65 | +This error can be mitigated by creating and modifying a custom DB parameter group as described in the related [AWS Knowledge Center article](https://repost.aws/knowledge-center/rds-mysql-functions). |
| 66 | + |
| 67 | +#### Galera Cluster |
| 68 | + |
| 69 | +Starting with Icinga DB version 1.2.0, Galera support has been added to the Icinga DB daemon. |
| 70 | +Its specific database configuration is described in the [Galera configuration section](03-Configuration.md#galera-cluster). |
| 71 | + |
| 72 | +As mentioned in [MariaDB's known Galera cluster limitations](https://mariadb.com/kb/en/mariadb-galera-cluster-known-limitations/), |
| 73 | +transactions are limited in both amount of rows (128K) and size (2GiB). |
| 74 | +A busy Icinga setup can cause Icinga DB to create transactions that exceed these limits with the default configuration. |
| 75 | + |
| 76 | +If you get an error like `Error 1105 (HY000): Maximum writeset size exceeded` |
| 77 | +and your Galera node logs something like `WSREP: transaction size limit (2147483647) exceeded`, |
| 78 | +decrease the values of `max_placeholders_per_statement` and `max_rows_per_transaction` in Icinga DB's |
| 79 | +[Database Options](https://icinga.com/docs/icinga-db/latest/doc/03-Configuration/#database-options). |
| 80 | + |
| 81 | +### Redis® |
| 82 | + |
| 83 | +On Linux, enable [memory overcommitting](https://www.kernel.org/doc/Documentation/vm/overcommit-accounting). |
| 84 | + |
| 85 | +```shell |
| 86 | +sysctl vm.overcommit_memory=1 |
| 87 | +``` |
| 88 | + |
| 89 | +To persist this setting across reboots, add the following line to [`sysctl.conf(5)`](https://man7.org/linux/man-pages/man5/sysctl.conf.5.html). |
| 90 | +If your distribution uses systemd, a configuration file under `/etc/sysctl.d/` is required, as described by |
| 91 | +[`systemd-sysctl.service(8)`](https://www.freedesktop.org/software/systemd/man/latest/systemd-sysctl.service.html) and |
| 92 | +[`sysctl.d(5)`](https://man7.org/linux/man-pages/man5/sysctl.d.5.html). |
| 93 | + |
| 94 | +``` |
| 95 | +vm.overcommit_memory = 1 |
| 96 | +``` |
| 97 | + |
| 98 | +In addition, the official [Redis® administration documentation](https://redis.io/docs/latest/operate/oss_and_stack/management/admin/) is quite useful. |
0 commit comments