You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: osfv_cli/monitoring/zabbix/External_Check.md
+35-31Lines changed: 35 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,74 +4,78 @@ This is a brief guide on setting up external checks in Zabbix.
4
4
You can find example scripts in this folder.
5
5
6
6
## Preparation
7
-
1. Make sure your script is in
7
+
8
+
1. Make sure your script is in
9
+
8
10
```
9
-
/usr/lib/zabbix/externalscripts
11
+
/usr/lib/zabbix/externalscripts
10
12
```
13
+
11
14
> The default location of externalscripts can be changed in `/etc/zabbix/zabbix_server.conf` by editing `ExternalScripts=/usr/lib/zabbix/externalscripts` (make sure to remove #)
12
15
13
16
**Ensure that you have only one tab open when creating anything in Zabbix (items/triggers/hosts).**
14
17
> It's likely that the last used tab is overwriting session data.
15
18
16
-
17
-
18
19
## Create the item in Zabbix
20
+
>
19
21
> Item is a tool that gathers data from device, system or external script
20
22
2. Navigate to **Configuration** > **Hosts**.
21
23
2. Go to the **Items** next to the host you want to monitor.
22
24
2. Click **Create item** in top right.
23
-
- Change Type to **External check**.
24
-
- As key use your script name together with desired **Macro**, for example `script.sh[{HOST.IP}]`.
25
-
+ You can combine multiple Macros `script.sh[{HOST.DESCRIPTION},{HOST.ID},{HOST.CONN}]`.
26
-
25
+
- Change Type to **External check**.
26
+
- As key use your script name together with desired **Macro**, for example `script.sh[{HOST.IP}]`.
27
+
+ You can combine multiple Macros `script.sh[{HOST.DESCRIPTION},{HOST.ID},{HOST.CONN}]`.
27
28
28
29
[list of macros](https://www.zabbix.com/documentation/current/en/manual/appendix/macros/supported_by_location#host-inventory)
29
30
30
31
## Create the trigger
32
+
>
31
33
> Trigger is a rule that watches for specific events, like high CPU usage.
32
34
3. Navigate to **Configuration** > **Hosts**.
33
35
3. Go to the **Triggers** next to the host with the item you want to monitor.
34
36
3. Click **Create trigger** in top right.
35
-
- Severity: Select as needed.
36
-
- Expression: press Add
37
-
+ Item: Select the item for which you want to create a trigger.
38
-
+ Function: Defines how your trigger will be activated.
39
-
+ Result: Actual rule of activation.
37
+
- Severity: Select as needed.
38
+
- Expression: press Add
39
+
+ Item: Select the item for which you want to create a trigger.
40
+
+ Function: Defines how your trigger will be activated.
41
+
+ Result: Actual rule of activation.
40
42
> If your script returns numeric values directly and/or you don't won't to calculate the average result, simply use `last()` function
41
43
42
44
## Testing
45
+
43
46
4. Test manually.
44
47
- login as **zabbix** user and go to the script location.
45
48
- run your script as zabbix.
46
49
> You can directly incorporate information from Zabbix macros into your command, such as ./script.sh '192.168.10.0'.
47
50
48
51
4. Test in zabbix web interface.
49
-
- Go to your item location.
52
+
- Go to your item location.
50
53
- If you are using external checks, **Test** option should be available.
51
-
+ Check if you Macros give proper data to your script.
52
-
+ Press **Get value and test**.
54
+
- Check if you Macros give proper data to your script.
55
+
- Press **Get value and test**.
53
56
54
57
4. Common problems.
55
58
- Timeout: you can change (not VM)Timeout(and TrapperTimeout if needed) settings in /etc/zabbix/zabbix_server.conf
56
59
- Make sure all necesery files and commands are accessible for zabbix user.
57
60
- If you find something else, please update the file.
58
61
59
62
## Templates
60
-
5. Navigate to **Configuration** > **Templates**.
63
+
64
+
5. Navigate to **Configuration** > **Templates**.
61
65
5. Click **Create template** in top right.
62
-
- Specify the name, group and other information if needed.
66
+
- Specify the name, group and other information if needed.
63
67
5. Add **items**, **trigger** and **macros** if needed.
0 commit comments