Skip to content

Commit 80e89f1

Browse files
authored
Add documentation (#19)
* Update docs for initial version * Update docs with new files * Update most documentation sections. Add info to readme. * Add new docs. * Finalize the docs for release * Fix issue with the plugins not being able to run as passive checks * Update version for release * Update with how to build the docs * Fix typo
1 parent 1e67d5d commit 80e89f1

31 files changed

+1905
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
./config.yml
22
build/bin/*
33
build/rcagent.spec
4+
site
45
rcagent.pem
56
rcagent.key
67
rcagent.exe

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
06/25/2023 - 1.0.4
2+
==================
3+
- Fixed passive check plugins endpoint not able to run due to invalid check error
4+
15
05/01/2023 - 1.0.3
26
==================
37
- Added cpuPercent and memPercent to processes output (#14)

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
[![Go Test/Build](https://github.com/rechecked/rcagent/actions/workflows/go.yml/badge.svg)](https://github.com/rechecked/rcagent/actions/workflows/go.yml)
2+
[![GitHub release](https://img.shields.io/github/release/rechecked/rcagent?include_prereleases=&sort=semver&color=blue)](https://github.com/rechecked/rcagent/releases/)
3+
[![License](https://img.shields.io/badge/License-GPLv3-blue)](https://github.com/rechecked/rcagent/blob/main/LICENSE)
4+
[![rcagent - Documentation](https://img.shields.io/badge/rcagent-Documentation-informational)](https://docs.rechecked.io/rcagent)
25

36
ReChecked Agent (rcagent) is light-weight, cross-platform, API-based agent that is compatible with Nagios (using NRDP and check_rcagent) check-based monitoring systems.
47

58
### For Binary Installs
69

710
We currently build for: Windows, macOS (12+), CentOS Stream/RHEL (8+), Debian (10+), Ubuntu (18+ LTS)
811

9-
We recommend [using the repo install](https://repo.rechecked.io/) for CentOS/RHEL, Debian, and Ubuntu.
12+
Follow the [installation guide in the rcagent documentation](https://docs.rechecked.io/rcagent/getting-started/installation/).
1013

11-
Download from [GitHub releases](https://github.com/rechecked/rcagent/releases) or [download from rechecked.io](https://rechecked.io/download)
14+
Download from [GitHub releases](https://github.com/rechecked/rcagent/releases).
1215

1316
### For Source Install
1417

@@ -32,11 +35,22 @@ If you'd like to run the source version as a service, you can install the servic
3235

3336
### Using rcagent
3437

35-
You can read how to [get started](https://rechecked.io/quick-start-guide/) and you can install the config wizard or plugin below.
38+
Read more about how to use rcagent in the [documentation](https://docs.rechecked.io/rcagent/).
3639

37-
- **Nagios XI** - Download and install the latest [ReChecked Nagios XI Config Wizard](https://rechecked.io/download) in the XI GUI.
38-
- **Nagios Core** - Download the [check_rcagent.py](https://rechecked.io/download) file, place it in `/usr/local/nagios/libexec`.
40+
- **Nagios XI** - Download and install the latest [ReChecked Nagios XI Config Wizard](https://github.com/rechecked/rcagent-nagiosxi/releases/latest/download/rcagent.zip) in the XI GUI.
41+
- **Nagios Core** - Download the [check_rcagent.py](https://github.com/rechecked/rcagent-plugins/releases/latest/download/check_rcagent.py) file, place it in `/usr/local/nagios/libexec`.
3942

4043
### Config Options
4144

42-
For a full list of config options in config.yml, check the [config options page](https://rechecked.io/config-options/).
45+
For a full list of config options in `config.yml`, check the [config options documentation](https://docs.rechecked.io/config/options/).
46+
47+
### Building Documentation
48+
49+
If you'd like the build your own set of docs (you'll need to host them in order for them to work properly) you can run the following:
50+
51+
Install mkdocs-material and run the mkdocs build:
52+
53+
```
54+
pip install mkdocs-material
55+
mkdocs build
56+
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.3
1+
1.0.4

build/package/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,5 @@ pluginTypes:
7272
# options:
7373
# warning: 10
7474
# critical: 20
75+
76+

docs/assets/favicon.ico

149 KB
Binary file not shown.

docs/assets/rechecked-white.png

3.57 KB
Loading

docs/checks/active-checks.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Active Checks
2+
3+
Active checks are checks where the request for data is sent from `check_rcagent.py` to the agent's Status API. The returned output, exit code, and perfdata is already in the Nagios plugins return format and the `check_rcagent.py` plugin just outputs what is returned, it does not do any data or check processing on the plugin side.
4+
5+
In general, active checks are configured on the monitoring system (Nagios Core) and each active check is ran as a full command with returned exit code, output, and perfdata, which is what the monitoring system uses to determine if things are OK or not.
6+
7+
## Downloading `check_rcagent.py`
8+
9+
If you don't have the plugin already, you can [download the latest version](https://github.com/rechecked/rcagent-plugins/releases/latest/download/check_rcagent.py).
10+
11+
There is a [GitHub rcagent-plugins repo](https://github.com/rechecked/rcagent-plugins) specifically for the plugins, so if you have any problems with the plugin, feel free to mention them in the issues.
12+
13+
## Installing `check_rcagent.py`
14+
15+
If you are using Nagios Core, you will need to copy the plugin into the plugins directory. Normally the directory is `/usr/local/nagios/libexec` but may be different on your specific system if you've customized the paths or installed via a repo.
16+
17+
## Using `check_rcagent.py`
18+
19+
Endpoints (such as CPU, Memory, Services, etc) are reached using `-e <endpoint>` while plugins are ran using `-p <plugin>`.
20+
21+
A typical call with the plugin will look similar to this:
22+
23+
```
24+
./check_rcagent.py -H <host> -t <token> -e <endpoint> -w <warning> -c <critical>
25+
```
26+
27+
Another useful feature is using `-q` to pass query arguments. This is necessary for things like services or processes when you need to send a name or value. You can add multiple `-q` values on the command line, like so:
28+
29+
```
30+
./check_rcagent.py -H <host> -t <token> -e <endpoint> -q "name=test" -q "name2=test2"
31+
```
32+
33+
!!! note
34+
35+
There are more options than what we show here! You can use the `--help` option to see all available options.
36+
37+
### Endpoint Examples
38+
39+
The endpoint checks are available by default on any rcagent and does not require special setup, unlike plugins which have to be added after installation.
40+
41+
Here are a few examples of endpoint checks. If you want to see more endpoints you can use, check the Status API Reference section.
42+
43+
#### Disk Check
44+
45+
An example of a basic [disk](../../status-api/disk) check using the path value of `/` (root) and showing the return output. Note that the return output also includes any perfdata for the check. Some checks may not have perfdata associated with them.
46+
47+
Command:
48+
49+
```
50+
./check_rcagent.py -H <host> -t <token> -e disk -q path=/
51+
```
52+
53+
Output:
54+
55+
```
56+
OK: Disk usage of / is 34.91% (12.23/35.04 GiB Total) | 'percent'=34.91% 'used'=12.23GiB 'free'=22.81GiB 'total'=35.04GiB
57+
```
58+
59+
#### Service Check
60+
61+
When running against the [services](../../status-api/services) endpoint, you need to pass an `against` and `expected` parameter. The `against` parameter is the name of the service you want to run the check against. If the service status matches the `expected` value, it will be OK, otherwise it is CRITICAL.
62+
63+
```
64+
./check_rcagent.py -H <host> -t <token> -e services -q "against=rcagent" -q "expected=running"
65+
```
66+
67+
Output:
68+
69+
```
70+
OK: rcagent is [running] (expected value is [running])
71+
```
72+
73+
#### Memory Check
74+
75+
Most checks that return a number run with a `-w` (warning) and `-c` (critical) value. Memory checks are example of this. You can also adjust the units returned by sending in `-u`.
76+
77+
```
78+
./check_rcagent.py -H <host> -t <token> -e memory/virtual -w 20 -c 60 -u GB
79+
80+
```
81+
82+
Output:
83+
84+
```
85+
WARNING - Memory usage is 24.11% (16.49/68.38 GB Total) | 'percent'=24.11%;20;60 'available'=51.89GB;20;60 'used'=16.49GB;20;60 'free'=51.89GB;20;60 'total'=68.38GB;20;60
86+
```
87+
88+
### Plugins Example
89+
90+
Plugins are added to the plugins directory. You specify the plugin you want to run using the `-p` flag rather than the `-e` endpoint flag.
91+
92+
When running a plugin use `--arg=""` for proper parsing rather than `-a` if you are using `-`/`--` in your arugment. An example of this is:
93+
94+
```
95+
./check_rcagent.py -H <host> -t <token> -p check_test.sh --arg="--warning 10" --arg="-c 20"
96+
```
97+
98+
Output:
99+
100+
```
101+
--warning 10 -c 20
102+
```
103+
104+
The above `check_test.sh` plugin just echos out whatever is passed to the plugin. So in the output we see the two arguments that we passed to the plugin.

docs/checks/passive-checks.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Passive Checks
2+
3+
Passive checks are a type of check that run on the agent side and the results are sent to the monitotring system. In our case, we normally send passive checks to Nagios via NRDP. You can use NRDP with both Nagios Core and Nagios XI which includes it pre-configured by default.
4+
5+
## Why Use Passive Checks?
6+
7+
One of the biggest reasons for using passive checks is that it will offload some of the resource requirements from the monitoring system. Active checks are ran through a subprocess by Nagios Core and will use various amounts of system resources depending on the kind of check.
8+
9+
Passive checks are more like a distributed system; running specific checks for the Nagios Core instance and returning just the output, result code, and perfdata back to Nagios Core. The resources required to read that data is much less than used to do the checks themselves.
10+
11+
!!! note
12+
13+
There is one difference with passive checks compared to active checks that you should remember. You will need to set up [freshness checks](https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/freshness.html) for passive checks to ensure that if you are no longer recieving a check from rcagent, you know there is a problem you need to deal with!
14+
15+
## Setup NRDP Sender(s)
16+
17+
You can configure one or more [`senders`](../../config/options/#senders) to send passive checks. Currently the only available sender is for NRDP which comes installed by default on Nagios XI but can easily be added to Nagios Core if you follow the [NRDP readme on GitHub](https://github.com/NagiosEnterprises/nrdp).
18+
19+
If you have multiple senders, all checks performed will be sent to all the senders you have added.
20+
21+
Example sender config:
22+
23+
```
24+
senders:
25+
- name: NRDP Server 1
26+
url: http://192.168.0.100/nrdp/
27+
token: sometoken
28+
type: nrdp
29+
```
30+
31+
## Adding Passive Checks
32+
33+
It is possible to add as many passive checks as you want to your system. One of the nice things about passive checks is that you can run plugins and offload some of the work from your main monitoring system.
34+
35+
Each check can be set with a pecific `interval` time, which is per check. There are also other [`checks` config options available](../../config/checks).
36+
37+
### Example Host Check
38+
39+
The variable `$HOST` will be replaced with the hostname of the rcagent system
40+
41+
```
42+
checks:
43+
- hostname: $HOST
44+
interval: 5m
45+
endpoint: system/version
46+
options:
47+
warning: 10
48+
critical: 20
49+
```
50+
51+
### Example Service Checks
52+
53+
Example of service checks, including running a plugin as a passive service check:
54+
55+
```
56+
checks:
57+
- hostname: $HOST
58+
servicename: Custom Plugin
59+
interval: 5m
60+
endpoint: plugins
61+
options:
62+
plugin: check_test.ps1
63+
args:
64+
- -m "hello and test!"
65+
- --dir /test/dir
66+
- hostname: $HOST
67+
servicename: CPU Usage
68+
interval: 30s
69+
endpoint: cpu/percent
70+
options:
71+
warning: 10
72+
critical: 20
73+
- hostname: $HOST
74+
servicename: Memory Usage
75+
interval: 5m
76+
endpoint: memory/virtual
77+
options:
78+
warning: 80
79+
critical: 90
80+
- hostname: $HOST
81+
servicename: Disk Usage - C:
82+
interval: 1h
83+
endpoint: disk
84+
options:
85+
path: C:
86+
warning: 70
87+
critical: 90
88+
```

docs/config/checks.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Checks
2+
3+
Checks are passive checks configured to run at certain intervals while rcagent is running. These checks are sent to some other location (like NRDP) using [senders](../options#senders).
4+
5+
In the YAML file, `checks` is a list of checks to run. You can have as many passive check configurations as you want.
6+
7+
## Special Values
8+
9+
### `$HOST`
10+
11+
This value is populated with the hostname of the system the rcagent is running on.
12+
13+
## Config Options
14+
15+
Options with a * next to them are **required**.
16+
17+
### `hostname` *
18+
19+
The hostname associated with the passive check.
20+
21+
### `servicename`
22+
23+
The service name (or service description, if a service check) associated with the passive check.
24+
25+
### `interval` *
26+
27+
The interval in which to run the check. It can be in format: `Xs` (seconds), `Xm` (minutes), `Xh` (hours) where `X` is a number.
28+
29+
### `endpoint ` *
30+
31+
The endpoint to use for the check, just like an active check. Example is `memory/virtual` or `services`.
32+
33+
### `options`
34+
35+
You can pass all the normal URL-style parameters in the options, such as warning/critical value and more. See the example in the [`config.yml`](../options) file for formatting.
36+
37+
## Example Check Config
38+
39+
```
40+
checks:
41+
- hostname: $HOST
42+
interval: 5m
43+
endpoint: system/version
44+
options:
45+
warning: 10
46+
critical: 20
47+
- hostname: $HOST
48+
servicename: CPU Usage
49+
interval: 30s
50+
endpoint: cpu/percent
51+
options:
52+
warning: 10
53+
critical: 20
54+
```

docs/config/manager.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Manager
2+
3+
If you are using ReChecked Manager, you will use this section to tell the agent how to connect to the manager along with some options that tell it how to interact and behave with the manager.
4+
5+
Configuration for this section should be under the top level `manager` section.
6+
7+
## Config Options
8+
9+
Options with a * next to them are **required**.
10+
11+
### `url`
12+
13+
Optional URL value to the manager.
14+
15+
**Default:** `https://manage.rechecked.io`
16+
17+
### `apikey` *
18+
19+
The API key for the organization that the agent should be connected to in the manager.
20+
21+
### `ignoreCert`
22+
23+
By default the certificate for the manager is verified. If you'd like to ignore it for some reason, set this value to `true`.
24+
25+
**Default:** `false`
26+
27+
## Example Manager Config
28+
29+
```
30+
manager:
31+
apikey: 5E51781D7FFF4E0AA757132B017AAC80
32+
```

0 commit comments

Comments
 (0)