License | Versioning | Build |
---|---|---|
Developer box for Zabbix.
Clone this repository and cd
:
$ git clone --recursive https://github.com/extra2000/zabbix-box.git
$ cd zabbix-box
Copy example pillar file for Zabbix and NGINX. Optionally you may want to edit the values in the pillar files:
$ cp -v salt/roots/pillar/zabbix.sls.example salt/roots/pillar/zabbix.sls
$ cp -v salt/roots/pillar/nginx.sls.example salt/roots/pillar/nginx.sls
$ cp -v salt/roots/pillar/zabbix-agent.sls.example salt/roots/pillar/zabbix-agent.sls
Copy vagrant file from vagrant/examples/
and then create the vagrant box (you can change to --provider=libvirt
if you want to use Libvirt provider):
$ cp -v vagrant/examples/Vagrantfile.zabbix-box.fedora-33.x86_64.example vagrant/Vagrantfile.zabbix-box
$ vagrant up --provider=virtualbox
Provision the vagrant box:
$ vagrant ssh zabbix-box -- sudo salt-call state.highstate
Deploy Zabbix Server, Web, Agent, and Postgres containers:
$ vagrant ssh zabbix-box -- sudo salt-call state.sls zabbix.config
$ vagrant ssh zabbix-box -- sudo salt-call state.sls zabbix.service.postgres
$ vagrant ssh zabbix-box -- sudo salt-call state.sls zabbix.service.server
$ vagrant ssh zabbix-box -- sudo salt-call state.sls zabbix_agent
Configure and deploy NGINX for HTTPS:
$ vagrant ssh zabbix-box -- sudo salt-call state.sls zabbix.config.nginx,nginx.service
To access Zabbix web, go to https://zabbix-box. Use the following default username and password:
- Username:
Admin
- Password:
zabbix
Go to Administration
> General
> Macros
, add the following macros:
Macro | Value |
---|---|
{$ZABBIX.URL} |
https://zabbix-box |
Visit https://api.slack.com and then create an app, for example named myzabbix-bot
, with the following Bot Token Scopes
:
chat:write
On your Slack workspace, create a Slack channel for the Zabbix notification, for example #zabbix
. Then, on your channel's More options
select Add apps
and add your bot myzabbix-bot
into your channel.
On your zabbix-box
web-page, go to Administration
> Media types
> Slack
and do the followings:
- Set
bot_token
value using your appsOAuth Access Token
("xoxb-...
"). - Set
slack_mode
value toevent
because Zabbix seems unable to reply to a message. - To fix duplicated notifications due to
Slack notification failed : invalid_auth
, go toOptions
and setAttempts
to1
.
To test
Slack Notification, use the following values (replace #zabbix
with your Slack channel):
- channel:
#zabbix
- event_id: 1
- event_nseverity: 1
- event_source: 0
- event_update_status: 0
- event_value: 1
- trigger_id: 1
- zabbix_url: https://zabbix-box
You may want to read the Zabbix Slack integration official documentations at https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/slack/README.md
Make sure disable all unused Media types
except Slack
if you use Slack for notifications.
Enable Media
for Admin user. Go to Administration
> Users
> Admin
choose Media
and add the following media (replace #zabbix
with your Slack channel):
- Type:
Slack
- Send to:
#zabbix
- When active:
1-7,00:00-24:00
- Use if severity:
- Not classified
- Information
- Warning
- Average
- High
- Disaster
- Enabled:
True
Enable Actions
. Go to Configuration
> Actions
> Trigger actions
, enable Report problems to Zabbix administrators
.
Deploy zabbix-agent-box
from extra2000/zabbix-agent-box.
Go to https://zabbix-box/hosts.php?form=create:
- Under tab
Host
:- Host name:
zabbix-agent-box
- Groups:
Linux servers
- Interfaces:
- Type:
Agent
- DNS Name:
zabbix-agent-box
- Connect to:
DNS
- Port:
10050
- Type:
- Host name:
- Under tab
Templates
:- Add
Template OS Linux by Zabbix agent active
, can be found in host groupTemplates/Operating systems
.
- Add
- Go to
Administration
>User groups
and selectGuests
. - Go to
Permissions
tab and add aHost Group
for exampleLinux servers
with permissionRead
. - Click
Add
and then clickUpdate
.