Add postfix monitoring setup
This commit is contained in:
parent
80112021f6
commit
94aa036f2e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
58
README.md
58
README.md
@ -1,2 +1,60 @@
|
|||||||
# zabbix
|
# zabbix
|
||||||
|
|
||||||
|
## Setting Up Monitoring for a Postfix Service
|
||||||
|
|
||||||
|
### On the Mail Server
|
||||||
|
|
||||||
|
1. Edit the Zabbix agent configuration file:
|
||||||
|
`vim /etc/zabbix/zabbix_agent2.d/postfix.conf`
|
||||||
|
|
||||||
|
2. Add the following line:
|
||||||
|
`UserParameter=postfix.running,script /tmp/postfix-script-zabbix.log -qc 'sudo postfix status' | grep -c 'PID'`
|
||||||
|
|
||||||
|
3. Ensure your Zabbix agent is configured for active checks by checking these parameters in your `/etc/zabbix/zabbix_agent2.conf`:
|
||||||
|
```
|
||||||
|
ServerActive=your_zabbix_server_ip
|
||||||
|
HostnameItem=system.hostname
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Restart the Zabbix agent:
|
||||||
|
`systemctl restart zabbix-agent2`
|
||||||
|
|
||||||
|
5. Check the status of the Zabbix agent:
|
||||||
|
`systemctl status zabbix-agent2`
|
||||||
|
|
||||||
|
The mail server's Zabbix agent will now collect the Postfix status using a script command and report that data back to the Zabbix server. The Zabbix server must then be configured to processes this information and handle alerting.
|
||||||
|
|
||||||
|
### In the Zabbix web interface:
|
||||||
|
|
||||||
|
1. Create a new item for your host
|
||||||
|
`Data collection -> Hosts -> Items (column next to the desired host) -> Create item (at top right)`
|
||||||
|
|
||||||
|
2. Set the following parameters:
|
||||||
|
- Name: `Monitor postfix service`
|
||||||
|
- Type: `Zabbix agent (active)`
|
||||||
|
- Key: `postfix.running`
|
||||||
|
- Type of information: `Text`
|
||||||
|
- Description (optional): `Monitor postfix service.`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3. Click "Add" to save the item
|
||||||
|
|
||||||
|
4. Create a trigger based on the return value
|
||||||
|
`Data collection -> Hosts -> Triggers (column next to the desired host) -> Create trigger (at top right)`
|
||||||
|
|
||||||
|
5. Set the following parameters (Replace instances of `mail_server_hostname` with your actual host name in Zabbix):
|
||||||
|
- Name: `Postfix service is not running on {HOST.NAME}`
|
||||||
|
- Severity: `High`
|
||||||
|
- Problem expression: `last(/mail_server_hostname/postfix.running)=0`
|
||||||
|
- OK event generation: `Recovery expression`
|
||||||
|
- Recovery expression: `last(/mail_server_hostname/postfix.running)>0`
|
||||||
|
- PROBLEM event generation mode: `Single`
|
||||||
|
- OK event closes: `All problems`
|
||||||
|
- Description (optional): `Postfix has stopped running.`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
6. Click "Add" to save the trigger
|
||||||
|
|
||||||
|
This trigger will fire when the Postfix check returns 0 (not running) and will automatically resolve when the check returns a value greater than 0 (running).
|
BIN
sample-config/postfix.running-zabbix-item.png
Normal file
BIN
sample-config/postfix.running-zabbix-item.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
sample-config/postfix.running-zabbix-trigger.png
Normal file
BIN
sample-config/postfix.running-zabbix-trigger.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
Loading…
Reference in New Issue
Block a user