Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql fix #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 37 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Zabbix monitoring of Bacula's backup jobs and its processes

This project is mainly composed by a bash script and a Zabbix template. The bash script reads values from Bacula Catalog and sends it to Zabbix Server. While the Zabbix template has items and other configurations that receive this values, start alerts and generate graphs and screens. This material was created using Bacula at 7.0.5 version and Zabbix at 2.4.5 version in a GNU/Linux CentOS 7 operational system.
##Zabbix monitoring of Bacula's or Bareos's backup jobs and its processes
This project is mainly composed by a bash script and a Zabbix template. The bash script reads values from Bacula Catalog and sends it to Zabbix Server. While the Zabbix template has items and other configurations that receive this values, start alerts and generate graphs. This material was created using Bareos at 15.2.0 version and Zabbix at 2.4.5 version in a Calculate linux operational system.

### Abilities

- Customizable and easy to set up
- Separate monitoring for each backup job
- Different job levels have different severities
- Monitoring of Bacula Director, Storage and File processes
- Separate monitoring for each backup level of job
- Generates graphs to follow the data evolution
- Screens with graphs ready for display
- Works with MySQL and PostgreSQL used by Bacula Catalog

### Features
Expand All @@ -25,11 +22,11 @@ This project is mainly composed by a bash script and a Zabbix template. The bash

##### Zabbix template configuration

Link this Zabbix template to each host that has a Bacula's backup job implemented. Each host configured in Zabbix with this template linked needs to have its name equals to the name configured in Bacula's Client resource. Otherwise the data collected by the bash script will not be received by Zabbix server.
Link "Template Bacula Clients" zabbix template to host that has a zabbix agent with attached zabbix scripts (bacula_hosts.pl and bacula.pl).

- **Items**

This Zabbix template has two types of items, the items to receive data of backup jobs, and the itens to receive data of Bacula's processes. The items that receive data of Bacula's processes are described below:
This Zabbix templates has two types of items, the items to receive data of backup jobs, and the itens to receive data of Bacula's processes. The items that receive data of Bacula's processes ("Template Bacula Proceses") are described below:

- *Bacula Director is running*: Get the Bacula Director process status. The process name is defined by the variable {$BACULA.DIR}, and has its default value as 'bacula-dir'. This item needs to be disabled in hosts that are Bacula's clients only.
- *Bacula Storage is running*: Get the Bacula Storage process status. The process name is defined by the variable {$BACULA.SD}, and has its default value as 'bacula-sd'. This item needs to be disabled in hosts that are Bacula's clients only.
Expand Down Expand Up @@ -68,10 +65,6 @@ Link this Zabbix template to each host that has a Bacula's backup job implemente
- *Files transferred*: Displays a graph with the variation of the files transferred by backup jobs, faced with the variation of the exit status of these jobs
- *Transfer rate*: Displays a graph with the variation of the transfer rate by backup jobs, faced with the variation of the exit status of these jobs

- **Screens**

There are three screens, one for each backup level, that displays the five graphs previously configured for that level.

### Requirements

- Bacula's implemented infrastructure and knowledge about it
Expand Down Expand Up @@ -102,44 +95,56 @@ Link this Zabbix template to each host that has a Bacula's backup job implemente
...
}
```

4. Now restart the Bacula Director service. In my case I used this command:
4. Copy bacula.pl and bacula_hosts.pl to zabbix scripts directory,usually `/etc/zabbix/scripts/` and set the permission as below:
```
chown zabbix:zabbix /etc/zabbix/scripts/bacula.pl
chown zabbix:zabbix /etc/zabbix/scripts/bacula_hosts.pl
chmod 700 /etc/zabbix/scripts/bacula.pl
chmod 700 /etc/zabbix/scripts/bacula_hosts.pl
```
5. Edit the Zabbix Agent configuration file `/etc/zabbix/zabbix-agentd.conf` to attach scripts to zabbix. To do this you need to add the lines described below in UserParametr section:
```
UserParameter=bacula.jobs[*],/usr/bin/perl /etc/zabbix/scripts/bacula.pl $1
UserParameter=bacula.hosts,/usr/bin/perl /etc/zabbix/scripts/bacula_hosts.pl
```
6. Now restart the Bacula Director service. In my case I used this command:
```
systemctl restart bacula-dir
/etc/init.d/bacula-dir restart
```
or
```
bconsole
reload
exit
```
7. Restart zabbix-agent:
```
/etc/init.d/zabbix-agentd restart
```

5. Make a copy of the Zabbix template from this repository and import it to your Zabbix server.

6. Edit your hosts that have configured backup jobs to use this template. Don't forget to edit the variables with the Bacula's processes names, and to disable in hosts that are only Bacula's clients the items that check the Bacula Director and Storage processes.
6. Add template: "Template Bacula Clients" to host which use modified zabbix-agent.

7. Add template "Template Bacula Processes" to each host, where heeded monitiring status Bacula processes. Don't forget to edit the variables with the Bacula's processes names

### References

- **Bacula**:

- http://www.bacula.org/7.0.x-manuals/en/main
- http://www.bacula.com.br/manual/Messages_Resource.html
- http://www.bacula-web.org/docs.html
- http://resources.infosecinstitute.com/data-backups-bacula-notifications

- http://blog.bacula.org/documentation/documentation/
- http://doc.bareos.org/master/html/bareos-manual-main-reference.html
- **Zabbix**:

- http://novatec.com.br/livros/zabbix
- http://www.zabbix.org/wiki/InstallOnCentOS_RHEL
- https://www.zabbix.com/documentation/2.4/start
- http://zabbixoverflow.com/index.php?topic=51.0
- https://support.zabbix.com/browse/ZBX-7790

- **Integration**:

- https://www.zabbix.com/forum/showthread.php?t=8145
- http://paje.net.br/?p=472
- https://github.com/selivan/bacula_zabbix_integration

### Feedback

Feel free to send bug reports and feature requests here:

- https://github.com/germanodlf/bacula-zabbix/issues
- [email protected]
- https://github.com/ssv1982/bacula-zabbix/issues

If you are using this solution in production, please write me about it. It's very important for me to know that my work is not meaningless.

Solution based on: https://github.com/germanodlf/bacula-zabbix.git
Loading