ZABBIX Forums  

Go Back   ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Cookbook

Reply
 
Thread Tools Display Modes
  #1  
Old 22-10-2007, 23:40
milprog milprog is offline
Junior Member
 
Join Date: Jul 2007
Location: Switzerland
Posts: 21
Default zabbix and bacula: cookbook contribution

Hi all

I use bacula to back up and verify lots of servers. After I had found zabbix to monitor these, I now was tired of checking all those silly "Backup OK ..." mails every day. Moreover, I needed a simple way to monitor the size of each server's backup.

So I made bacula work with zabbix using a self-made perl script. I use bacula 2.0.3, but the procedure should work with other versions as well; perhaps the text strings in the script need some adjustment. Here is my cookbook contribution:

1) On your server hosting the bacula director, create a perl script /etc/zabbix/bin/custom_bacula (see attachment, remove .txt extension), chmod 0755

(sorry, this is my first perl script: not very elegant, but it works for me. Improvements are welcome!)

2) in /etc/bacula/bacula-dir.conf, replace the mailcommand line by:

mailcommand = "/etc/zabbix/bin/custom.bacula %r %c"

and modify the mail line as follows (of course, replace my.zabbixserver.fqdn by your server's dns name):

mail = my.zabbixserver.fqdn = all, !skipped

...this way, the bacula result messages go through the zabbix_sender process instead of being mailed through bsmtp.

3) create zabbix trapper items with the names given in the custom.bacula script, e.g.
bacula.backup.result
bacula.fd.fileswritten (Units: Bytes)
bacula.fd.byteswritten (Units: Bytes)
(etc.)

4) ensure that the FD names in the bacula-dir.conf file correspond to the hostnames used in zabbix.

5) Enjoy! Add triggers for bacula.backup.result >1 or bacula.verify.result >0 to report errors; add thresholds to monitor backup size etc. etc.

Regards
--Marcel
Attached Files
File Type: txt custom.bacula.txt (2.6 KB, 2146 views)

Last edited by milprog; 22-10-2007 at 23:49. Reason: Typo
Reply With Quote
  #2  
Old 10-05-2010, 20:41
paje paje is offline
Junior Member
 
Join Date: May 2010
Posts: 2
Default Zabbix and bacula: Key value??

Hello.

What value I put in the key during the configuration itens?
Reply With Quote
  #3  
Old 10-05-2010, 21:49
milprog milprog is offline
Junior Member
 
Join Date: Jul 2007
Location: Switzerland
Posts: 21
Default

simply attach the items to the host that is being backed up. It does not matter whether the value comes from the zabbix_agent located on the host to be backed up or from somewhere else (here, it's the bacula director).

HTH
--Marcel
Reply With Quote
  #4  
Old 21-05-2010, 16:26
paje paje is offline
Junior Member
 
Join Date: May 2010
Posts: 2
Default

Thanks for your help. Now it's works.

I will rewrite this cookbook and translate to brazilian portuguese.

Thank you again.
Reply With Quote
  #5  
Old 10-10-2011, 08:59
NiklasG NiklasG is offline
Junior Member
 
Join Date: Apr 2011
Posts: 2
Default

Do this script work with bacula 5.0.3? Or do someone have a better way to monitor in zabbix?

Last edited by NiklasG; 10-10-2011 at 09:02.
Reply With Quote
  #6  
Old 10-10-2011, 11:16
harmonica harmonica is offline
Senior Member
 
Join Date: Jan 2009
Location: Portugal, Lisbon
Posts: 248
Send a message via MSN to harmonica
Default

Hello,

I can confirm that works with 5.0.1.

Regards
Reply With Quote
  #7  
Old 10-10-2011, 12:41
milprog milprog is offline
Junior Member
 
Join Date: Jul 2007
Location: Switzerland
Posts: 21
Default

we use this script with 5.0.3 . Sometimes the packagers change the paths for utility programs, correct them as needed if necessary.
Reply With Quote
  #8  
Old 19-01-2012, 14:48
Kkweit Kkweit is offline
Junior Member
 
Join Date: Sep 2011
Posts: 3
Default

Quote:
Originally Posted by paje View Post
Hello.

What value I put in the key during the configuration itens?

Quote:
Originally Posted by milprog View Post
simply attach the items to the host that is being backed up. It does not matter whether the value comes from the zabbix_agent located on the host to be backed up or from somewhere else (here, it's the bacula director).
hello,

I'm a novice with using zabbix. I'm trying to configure items but zabbix ui returns them as "not supported". How can i "simply attach the items to the host" since i have to put a value as a key to have my item supported.

if i could have an example of item and trigger configuration i think that it could help me.



thanks for your support.
Reply With Quote
  #9  
Old 10-05-2012, 16:47
sasskinn12 sasskinn12 is offline
Junior Member
 
Join Date: Mar 2012
Posts: 5
Default bacula monitoring in zabbix+ mail

My and my partner version of script from first post. Works on bacula vers 5.0.3-We added also ability send mails + zabbix_send and little modifications for us..Enjoy
Instruction are same only:
2) in /etc/bacula/bacula-dir.conf, replace the mailcommand line by:

mailcommand = "/nfs/bacula/custom.bacula %c %r %t %e %l"

Script + Zabbix template without graphs..
Attached Files
File Type: txt custom.bacula.txt (3.9 KB, 782 views)
File Type: xml bacula_backup.xml (41.0 KB, 609 views)

Last edited by sasskinn12; 10-05-2012 at 16:53.
Reply With Quote
  #10  
Old 10-09-2012, 12:49
vitush vitush is offline
Junior Member
 
Join Date: Sep 2012
Posts: 1
Default Check Bacula status Directly from Bacula-DB

Different way to check Bacula ...

Idea:
I. Check each Job separately. (Check last Backup status for each job)
II. Use local script to check Bacula Job Status directly in DB.
III. Build trigers based on job error status.

1. On Backup Server run "./create-bacula-zabbix-xml.pl > template-bacula-jobs.xml" to create template with all current bacula-jobs .
2. Import template-bacula-jobs.xml in ZABBIX.
3. In Zabbix Create Host "BaculaServer" (host with ip adress 127.0.0.1) and connect to template "Template App Bacula - Jobs"
4. Copy zabbix-bacula-chek.pl to ZABBIX /etc/zabbix/externalscripts/
5. Edit zabbix-bacula-chek.pl to provde correct credentials
$db ="baculadirectormysql";
$user = "zabbix";
$pass = "zabbixpassword";
$dbhost = "Bacula.Server.ip.address";
6. on Bacula Server allow access to DB for script
"grant select privileges on baculadirectormysql.* to zabbix@'ZABBIX.Server.IP.ADDRESS' identified by 'zabbixpassword';"
"flush privileges;"

7. Every time when bacula-dir.conf has changed you have to repeat steps 1 and 2.

Note:
Empty spaces not allowed in Bacula Job Names!
Attached Files
File Type: txt bacula-zabbix-xml.howto.txt (1.1 KB, 523 views)
File Type: txt create-bacula-zabbix-xml.pl.txt (4.1 KB, 530 views)
File Type: txt zabbix-bacula-chek.pl.txt (1.6 KB, 544 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:23.