Hi,
strange. I tried to reproduce this
and also run bareos.job.py in a loop against a test Bareos Director.
Here it now runs for several minutes without problems.
A difference I noticed is that I always get the usual warning:
UserWarning: Connection encryption via TLS-PSK is not available (not
available in 'ssl' and extra module 'sslpsk' is not installed).
as I've not installed sslpsk and my Python version does not support
TLS-PSK natively.
Anyhow, the error you receive is:
.api: is an invalid command.
which should not happen, if you always connect with the same user.
All that said means, I've no idea why it behaves strange in your
environment.
You could check if bareos-audit.log (/usr/log/bareos/bareos-audit.log)
reveals something suspicious.
If not, you can enable debug, to verify which user python connects.
Start with loglevel 50.
bconsole
Enter a period (.) to cancel a command.
*setdebug dir timestamp=1 level=50 trace=1
Regards,
Jörg
On 25.09.24 at 10:18 wrote Mine Forumski:
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]
<mailto:[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 <https://groups.google.com/d/msgid/bareos-users/8f8990ce-226d-4f22-9c38-157ff6c7b2bdn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Jörg Steffens [email protected]
Bareos GmbH & Co. KG Phone: +49 221 630693-91
https://www.bareos.com
Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer: Stephan Dühr, Jörg Steffens, Philipp Storz
--
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/vd0oj6%24gud%241%40ciao.gmane.io.