Ad Widget

Collapse

zabbix and bacula: cookbok contribution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milprog
    Junior Member
    • Jul 2007
    • 27

    #1

    zabbix and bacula: cookbok 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
    Last edited by milprog; 22-10-2007, 22:49. Reason: Typo
  • paje
    Junior Member
    • May 2010
    • 2

    #2
    Zabbix and bacula: Key value??

    Hello.

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

    Comment

    • milprog
      Junior Member
      • Jul 2007
      • 27

      #3
      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

      Comment

      • paje
        Junior Member
        • May 2010
        • 2

        #4
        Thanks for your help. Now it's works.

        I will rewrite this cookbook and translate to brazilian portuguese.

        Thank you again.

        Comment

        • NiklasG
          Junior Member
          • Apr 2011
          • 2

          #5
          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, 08:02.

          Comment

          • harmonica
            Senior Member
            • Jan 2009
            • 251

            #6
            Hello,

            I can confirm that works with 5.0.1.

            Regards

            Comment

            • milprog
              Junior Member
              • Jul 2007
              • 27

              #7
              we use this script with 5.0.3 . Sometimes the packagers change the paths for utility programs, correct them as needed if necessary.

              Comment

              • Kkweit
                Junior Member
                • Sep 2011
                • 3

                #8
                Originally posted by paje
                Hello.

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

                Originally posted by milprog
                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.

                Comment

                • sasskinn12
                  Junior Member
                  • Mar 2012
                  • 5

                  #9
                  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
                  Last edited by sasskinn12; 10-05-2012, 15:53.

                  Comment

                  • vitush
                    Junior Member
                    • Sep 2012
                    • 1

                    #10
                    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

                    Comment

                    • prolinx
                      Junior Member
                      • Nov 2010
                      • 1

                      #11
                      Hello,

                      I'm trying to implement their script, could make all the settings required to monitor but it returns the following error:

                      Usage: script.pl host_ip [Bacula_Job_Name]

                      It seems to me that zabbix is not passing the parameter properly. Has anyone experienced this problem?

                      Thank you,

                      Originally posted by vitush
                      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!

                      Comment

                      • Javier
                        Member
                        Zabbix Certified Specialist
                        • Jan 2010
                        • 58

                        #12
                        Hi,

                        I use this implementation Bacula Status to Zabbix and all bacula jobs send to zabbix its status. If a job fail, I have an alert.
                        The changes are simple and the whole process does work in bacula, Zabbix only receives data.

                        Comment

                        • Marek
                          Junior Member
                          • May 2013
                          • 1

                          #13
                          Problem

                          Hi,
                          I have problem with script zabbix-bacula-check.pl

                          I have zabbix 2.0.5, after start script i have message status

                          "Usage: script.pl host_ip [Bacula_Job_Name]"

                          Any one colud help??

                          Comment

                          • selivan
                            Junior Member
                            • Jun 2011
                            • 17

                            #14
                            Here is my variant of integration Bacula with Zabbix: https://github.com/selivan/bacula_zabbix_integration

                            Abilities:
                            * separate monitoring of each job
                            * auto-discovery of new jobs

                            Comment

                            • Kryol
                              Member
                              • Feb 2011
                              • 70

                              #15
                              All variants are based on mailcommand modification and use zabbix_sender.

                              I tried different combinations of zabbix_sender options (-z and -s OR -c only).
                              All works, zabbix receives needed values but in my /var/log/messages I see many lines like following
                              Code:
                              Nov 14 16:43:04 bs bacula-dir: 14-Nov 16:43  Message delivery ERROR: Mail prog: /usr/local/bin/zabbix_sender -c /usr/local/etc/zabbix2/zabbix_agentd.conf -k bacula.fd_fileswritten[TestJob] -o 1
                              Nov 14 16:43:04 bs bacula-dir: 14-Nov 16:43  Message delivery ERROR: Mail prog: /usr/local/bin/zabbix_sender -c /usr/local/etc/zabbix2/zabbix_agentd.conf -k bacula.fd_errors_non_fatal[TestJob] -o 0
                              Nov 14 16:43:05 bs bacula-dir: 14-Nov 16:43  Message delivery ERROR: Mail prog: /usr/local/bin/zabbix_sender -c /usr/local/etc/zabbix2/zabbix_agentd.conf -k bacula.job_exit_code[TestJob] -o OK
                              How turn off these messages generation?

                              Comment

                              Working...