View Issue Details

IDProjectCategoryView StatusLast Update
0000885bareos-core[All Projects] directorpublic2018-01-29 12:31
ReporterShodanAssigned To 
Status closedResolutionfixed 
PlatformLinuxOSDebianOS Version8
Product Version17.2.4 
Target VersionFixed in Version 
Summary0000885: Job status value for completed backup job is different in mail command variable "%e" and in catalog database
DescriptionJob status value for zabbix monitoring script (%e) and job status value in database are different for completed single backup job.
Steps To Reproduce1) Run backup job (for example JobId = 1111)
2) In bareos console: backup job completed with termination status OK
3) Job status value in catalog database is still R (Running) or C (created) for JobId 1111
4) script sends alert to zabbix server with status code 2 (status is not T or W)
5) After a couple of seconds job status in catalog database changed to T terminated) for JobId 1111
Additional Information1) definition of zabbix monitoring script for Bareos jobs

Messages {
  Name = Standard
  Mail Command = "/etc/bareos/zabbix/ %i %t %e %c %l"
  Mail = = all, !skipped
  Console = all, !skipped, !saved
  Append = "/var/log/bareos/bareos.log" = all, !skipped, !fatal, !error
  Append = "/var/log/bareos/bareos_err.log" = fatal, error

2) Catalog definition for bareos director
Catalog {
  Name = MyCatalog
  Reconnect = yes
  dbdriver = mysql
  dbname = bareos
  dbaddress =
  dbport = 3306
  dbuser = bareos
  dbpassword = "****"

3) Code block from script to check bareos job status


sql="/usr/bin/mysql --defaults-file=$bareosDbPass -h$bareosDbAddr -P$bareosDbPort -u$bareosDbUser -D$bareosDbName -NB -e" ;;

# Get Job exit status from database
bareosJobStatus=$($sql "select JobStatus from Job where JobId=$bareosJobId;" 2>/dev/null)

case $bareosJobStatus in
        "T") status=0 ;;
        "W") status=1 ;;
        *) status=2 ;;
TagsNo tags attached.
bareos-master: impact
bareos-master: action
bareos-18.2: impact
bareos-18.2: action
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impact
bareos-14.2: action
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action




2018-01-27 20:21

administrator   ~0002889

I understand, that the mail command shows the exit status before it is written to the database.

However, this is the first time I see the Mail Command being used to interact with a monitoring tool. Why is this required?

Some update has to be done at first. As the Mail Command may also send reports about a lost database connection, sending mails before updating the database makes sense.

I would have chosen an other option for communicating with a monitoring system.
How about:
  Run Script {
        Runs When = After
        Runs On Client = No

or a plugin like


2018-01-29 12:28

reporter   ~0002892

For historical reason :)

Thank you, I've enabled Run Script command in JobDefs template and it works fine.

Issue History

Date Modified Username Field Change
2017-12-22 13:19 Shodan New Issue
2018-01-27 20:21 joergs Note Added: 0002889
2018-01-29 12:28 Shodan Note Added: 0002892
2018-01-29 12:31 joergs Status new => resolved
2018-01-29 12:31 joergs Resolution open => fixed
2018-01-29 12:31 joergs Assigned To => joergs
2018-01-29 12:31 joergs Status resolved => closed
2018-01-29 12:31 joergs Assigned To joergs =>