Hello everyone,

I monitor Bareos via Zabbix. However, after upgrading to Bareos 23.0.3 
(Debian 12), sometimes only 
When returned empty, Zabbix was considered a bad value backup. And that 
several times a day.

I was then able to identify the problem as the Python script that queried 
the status.

https://github.com/IvanBayan/Zabbix-bareos/blob/master/bareos.job.py

To further narrow down the problem, I wrote a little script. 

#! /bin/bash

RED='\033[0;31m'
NC='\033[0m' # No Color

while true; do
    #zabbix_get -s 127.0.0.1 -k bareos.job[last_status,"SRV-File01_DriveE"]
    WERT=$(/etc/zabbix/scripts/bareos.job.py last_status SRV-File01_DriveE)
    if [[ "$WERT" != "T" ]]; then
        echo -e "${RED}Wert stimmt nicht: $WERT ${NC}"
        else
            echo -e "$WERT"
    fi
done

It returns the last job status, normally T.
In this case there is also a Python error and the job status remains empty, 
which is why Zabbix gives a backup error.
The output then looks like this:

T
T
T
T
Traceback (most recent call last):
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
112, in call_fullresult
    data = json.loads(resultstring.decode("utf-8"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/etc/zabbix/scripts/bareos.job.py", line 99, in <module>
    args.func(args)
  File "/etc/zabbix/scripts/bareos.job.py", line 26, in last_status
    console = create_console()
              ^^^^^^^^^^^^^^^^
  File "/etc/zabbix/scripts/bareos.job.py", line 19, in create_console
    console = bareos.bsock.DirectorConsoleJson(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
59, in __init__
    super(DirectorConsoleJson, self).__init__(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/bareos/bsock/directorconsole.py", 
line 203, in __init__
    self._init_connection()
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
65, in _init_connection
    self.logger.debug(self.call(".api json"))
                      ^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
87, in call
    json = self.call_fullresult(command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
117, in call_fullresult
    raise bareos.exceptions.JsonRpcInvalidJsonReceivedException(data)
bareos.exceptions.JsonRpcInvalidJsonReceivedException: Expecting value: 
line 1 column 1 (char 0): b'.api: is an invalid command.\n'
Wert stimmt nicht nicht:
T
T
T
T
T
T
Traceback (most recent call last):
  File "/etc/zabbix/scripts/bareos.job.py", line 99, in <module>
    args.func(args)
  File "/etc/zabbix/scripts/bareos.job.py", line 26, in last_status
    console = create_console()
              ^^^^^^^^^^^^^^^^
  File "/etc/zabbix/scripts/bareos.job.py", line 19, in create_console
    console = bareos.bsock.DirectorConsoleJson(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
59, in __init__
    super(DirectorConsoleJson, self).__init__(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/bareos/bsock/directorconsole.py", 
line 203, in __init__
    self._init_connection()
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
66, in _init_connection
    self.logger.debug(self.call(".api json compact=yes"))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/usr/lib/python3/dist-packages/bareos/bsock/directorconsolejson.py", line 
93, in call
    raise bareos.exceptions.JsonRpcErrorReceivedException(json)
bareos.exceptions.JsonRpcErrorReceivedException: failed: .api: is an 
invalid command.

Wert stimmt nicht nicht:
T
T
T

An update to 23.0.4 didn't help either. 

Since I don't know anything about Python, I hope you could help me.

Thank you
Robert

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bareos-users/8f8990ce-226d-4f22-9c38-157ff6c7b2bdn%40googlegroups.com.

Reply via email to