diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-19 21:07:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-19 21:07:41 +0300 |
| commit | 73cc8301cc642f77b0128de73802406887a7e4b6 (patch) | |
| tree | b25764760a16eccedeaa6c10944085a9230231c7 /gemfeed | |
| parent | 24d65673e7014f39d87eac767e5cde8f522216aa (diff) | |
update draft
Diffstat (limited to 'gemfeed')
| -rw-r--r-- | gemfeed/DRAFT-kiss-monitoring-with-gogios.gmi | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/gemfeed/DRAFT-kiss-monitoring-with-gogios.gmi b/gemfeed/DRAFT-kiss-monitoring-with-gogios.gmi index 31d714dc..55755f0f 100644 --- a/gemfeed/DRAFT-kiss-monitoring-with-gogios.gmi +++ b/gemfeed/DRAFT-kiss-monitoring-with-gogios.gmi @@ -26,17 +26,19 @@ Gogios eliminates unnecessary features and focuses on simplicity, providing a no ## Installation -To compile and install Gogios on your system, follow these steps: +### Compiling and installing Gogios + +To compile and install Gogios on OpenBSD, follow these steps: ``` git clone https://codeberg.org/snonux/gogios.git cd gogios go build -o gogios cmd/gogios/main.go -sudo cp gogios /usr/local/bin/gogios -sudo chmod 755 /usr/local/bin/gogios +doas cp gogios /usr/local/bin/gogios +doas chmod 755 /usr/local/bin/gogios ``` -Please note, depending on your operating system, you may want to use `sudo` instead of `doas` and also change `/usr/local/bin` to a different path. If you want to compile Gogios for OpenBSD on a Linux system without installing the Go compiler on OpenBSD, you can use cross-compilation. Follow these steps: +Please note, depending on your operating system (e.g. Linux based), you may want to use `sudo` instead of `doas` and also change `/usr/local/bin` to a different path. If you want to compile Gogios for OpenBSD on a Linux system without installing the Go compiler on OpenBSD, you can use cross-compilation. Follow these steps: ``` export GOOS=openbsd @@ -46,6 +48,35 @@ go build -o gogios cmd/gogios/main.go On your OpenBSD system, copy the binary to `/usr/local/bin` and set the correct permissions as described in the previous section. I personally use Rexify, the friendly configuration management system, to automate the installation. +### Setting up user, group and directories + +It is best to create a dedicated system user and group for Gogios to ensure proper isolation and security. The process of creating a user and group may vary depending on the operating system you're using. Here are the steps to create the `gogios` user and group under OpenBSD: + +``` +sudo groupadd gogios +sudo useradd -g gogios -d /nonexistent -s /sbin/nologin -r gogios +``` + +Please note that the process of creating a user and group might differ depending on the operating system you are using. For other operating systems, consult their documentation for creating system users and groups. + +To set up the `StateDir` correctly with the correct permissions, follow these steps: + +``` +sudo mkdir -p /var/run/gogios +sudo chown gogios:gogios /var/run/gogios +sudo chmod 750 /var/run/gogios +``` + +### Installing monitoring plugins + +Gogios relies on external Nagios or Icinga monitoring plugin scripts. On OpenBSD, you can install the `monitoring-plugins` package to use with Gogios. The monitoring-plugins package is a collection of monitoring plugins, similar to Nagios plugins, that can be used to monitor various services and resources: + +``` +pkg_add monitoring-plugins +``` + +Once the installation is complete, you can find the monitoring plugins in the `/usr/local/libexec/nagios` directory, which then can be configured to be used in `gogios.json`. + ## Configuration ### MTA @@ -60,9 +91,9 @@ echo "This is a test email from OpenBSD." | mail -s "Test Email" your-email@exam Check the recipient's inbox to confirm the delivery of the test email. If the email is delivered successfully, it indicates that your email server is properly configured and functioning. Please check your MTA logs in case of issues. -### Gogios config +### Configuring Gogios -To configure Gogios, create a JSON configuration file (e.g., /etc/gogios.json). Here's a sample configuration: +To configure Gogios, create a JSON configuration file (e.g., `/etc/gogios.json`). Here's a sample configuration: ``` { @@ -95,26 +126,7 @@ Adjust the configuration file according to your needs, specifying the checks you The `state.json` file mentioned above keeps track of the monitoring state and check results between Gogios runs, enabling Gogios to only send email notifications when there are changes in the check status. -## Setting up user, group and directories - -It is best to create a dedicated system user and group for Gogios to ensure proper isolation and security. The process of creating a user and group may vary depending on the operating system you're using. Here are the steps to create the `gogios` user and group under OpenBSD: - -``` -sudo groupadd gogios -sudo useradd -g gogios -d /nonexistent -s /sbin/nologin -r gogios -``` - -Please note that the process of creating a user and group might differ depending on the operating system you are using. For other operating systems, consult their documentation for creating system users and groups. - -To set up the `StateDir` correctly with the correct permissions, follow these steps: - -``` -sudo mkdir -p /var/run/gogios -sudo chown gogios:gogios /var/run/gogios -sudo chmod 750 /var/run/gogios -``` - -## Running Gogios via CRON +## Running Gogios Now it is time to give it a first run. On OpenBSD, do: @@ -125,20 +137,22 @@ doas -u gogios /usr/local/bin/gogios -cfg /etc/gogios.json and on Linux based systems, you likely would need to run: ``` -sudo -u gogios /usr/local/bin/gogios -cfg /etc/gogios.json +sudo -u gogios /usr/bin/gogios -cfg /etc/gogios.json ``` -To run Gogios via CRON as the `gogios` user and check all services once per minute, follow these steps: +To run Gogios via CRON on OpenBSD as the `gogios` user and check all services once per minute, follow these steps: -Type `sudo crontab -e -u gogios` and press Enter to open the crontab file for the `gogios` user for editing and add the following line to the crontab file: +Type `doas crontab -e -u gogios` and press Enter to open the crontab file for the `gogios` user for editing and add the following line to the crontab file: ``` * * * * * /usr/local/bin/gogios -cfg /etc/gogios.json ``` -Replace `/usr/local/bin/gogios` with the actual path to the Gogios binary on your system. Gogios is now configured to run every minute via CRON as the `gogios` user, and it will execute the checks and send monitoring status via email according to your configuration. By running Gogios under the gogios user's crontab, you further enhance the isolation and security of the monitoring setup. +On Linux, please replace `doas` with `sudo` in the commands above. You may also need to adjust the path to the `gogios` binary. -## High-availability +Gogios is now configured to run every minute via CRON as the `gogios` user, and it will execute the checks and send monitoring status via email according to your configuration. By running Gogios under the gogios user's crontab, you further enhance the isolation and security of the monitoring setup. + +### High-availability To create a high-availability Gogios setup, you can install Gogios on two servers that will monitor each other using the NRPE (Nagios Remote Plugin Executor) plugin. By running Gogios in alternate cron intervals on both servers, you can ensure that even if one server goes down, the other will continue monitoring your infrastructure and sending notifications. @@ -147,7 +161,6 @@ To create a high-availability Gogios setup, you can install Gogios on two server * Configure Gogios on both servers to monitor each other using the NRPE plugin. Add a check to the Gogios configuration file (`/etc/gogios.json`) on both servers that uses the NRPE plugin to execute a check script on the other server. For example, if you have Server A and Server B, the configuration on Server A should include a check for Server B, and vice versa. * Set up alternate cron intervals on both servers. Configure the cron job on Server A to run Gogios at odd minutes (e.g., 1, 3, 5, ...), and on Server B to run at even minutes (e.g., 0, 2, 4, ...). This will ensure that if one server goes down, the other server will continue monitoring and sending notifications. - ## Use Cases: Gogios is ideal for monitoring small-scale self-hosted servers and virtual machines, particularly in cases where only a handful of resources need to be monitored. Some example use cases include: |
