Skip to content

Commit

Permalink
Initial configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Carles Mata committed Jun 7, 2018
1 parent c422645 commit 8f310e6
Show file tree
Hide file tree
Showing 5 changed files with 707 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# postal-zabbix
Script and template to monitor Postal processes in Zabbix.
# Zabbix monitoring of aTech Media Postal processes

This project is composed by a shell script, a Zabbix template and a sudoers configuration file:
- The shell script reads values from `postal status` command and sends it to the Zabbix Server via Agent.
- The template has items that receives those values and activates triggers.
- The sudoers configuration is needed to execute `postal status` command with privileges to read the status.
This repository was created using Zabbix 3.4.9 and [Postal](https://github.com/atech/postal) at 2017 December 5th version, in a GNU/Linux CentOS 7 OS.

### Features

- Get server start time.
- Get processes (web, fast, workers, cron, smtp and requeuer) status, as informed in `postal status` command
- Receive an alert if any process status is different from `Running`.

### Features planned
- Get a process number of respawns, to send alerts if it's greater than zero.
- Process respawn trigger.
- Process discovery_rules, to automatically add processes to zabbix if we add more processes to postal (like more workers).

### Installation

1. Download the necessary files or clone this project anywhere zabbix user can access. It's configured by default in `/etc/zabbix/lib/postal-zabbix`, but you can place it anywhere you want that zabbix user has access.

2. Put `zabbix-agentd.d/postal-zabbix.conf` in zabbix agent directory, normally `/etc/zabbix/zabbix-agentd.d/`. Edit this file if you don't use the default `/etc/zabbix/lib/postal-zabbix` folder.

3. Put `sudoers.d/zabbix_postal` in the sudoers folder, normally `/etc/sudoers.d`. Edit this file if you don't use default folders.

4. Now restart the Zabbix agent service.

5. Import `template/postal-template.xml` in Zabbix and assign it to your postal server host.

### Feedback

Feel free to send bug reports and feature requests. If you are using this solution in production, please tell me to know it's being useful.
12 changes: 12 additions & 0 deletions postal-zabbix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
status=$(/opt/postal/app/bin/postal status)
#status=$(cat /home/carles/Downloads/postalCommand.txt)
if [ "$#" -lt 1 ]; then
#Postal server start time
started=$(echo "${status}" | grep 'Started' | xargs | cut -d ' ' -f 2,3 | cut -d 'm' -f 2)
echo "$started"
exit
fi
#Process status
process=$(echo "$status" | grep "$1" | xargs | cut -d ' ' -f 4 | cut -d 'm' -f 2)
echo "$process"
3 changes: 3 additions & 0 deletions sudoers.d/zabbix_postal
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cmnd_Alias ZABB_POSTAL = /opt/postal/app/bin/postal, /etc/zabbix/lib/postal-zabbix/postal-zabbix.sh
Defaults:zabbix !requiretty
zabbix ALL=NOPASSWD: ZABB_POSTAL
Loading

0 comments on commit 8f310e6

Please sign in to comment.