Announcement

Collapse
No announcement yet.

zabbix and bacula: cookbok contribution

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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

    #2
    Zabbix and bacula: Key value??

    Hello.

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

    Comment


      #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


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

        I will rewrite this cookbook and translate to brazilian portuguese.

        Thank you again.

        Comment


          #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


            #6
            Hello,

            I can confirm that works with 5.0.1.

            Regards

            Comment


              #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


                #8
                Originally posted by paje View Post
                Hello.

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

                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.

                Comment


                  #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


                    #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 [email protected]'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


                      #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 View Post
                      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 [email protected]'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


                        #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


                          #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


                            #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


                              #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

                              Ask questions to Zabbix Dev Team in person at the Zabbix Summit 2018!
                              Working...
                              X