WAdama / nas_ab_status

Bash script for monitoring status of device backup in Synology Active Backup for Business in PRTG
GNU General Public License v3.0
9 stars 2 forks source link

Monitoring Backup State of VMs #6

Closed HLAGCoding closed 3 years ago

HLAGCoding commented 3 years ago

Hi, thanks for the scripts. We are successfully monitoring the Backup Status of Clients which are in the "PC" and "Physical Server" Group of Active Backup for Business.

Once adding a new sensor which is using the Task List of the "Virtual Machine" Group it fails with "No result or error in XML response" in PRTG.

Error Logging <?xml version="10.0" encoding="UTF-8" ?> /var/prtg/scriptsxml/nas_ab_status_m.sh: line 22: [: too many arguments /var/prtg/scriptsxml/nas_ab_status_m.sh: line 32: 1617003892 2|11|VM|70915194880|1617000491|1617001668 2|12|VM1|47917826048|1617001670|1617002639 2|13|VM02|28607250432|1617002640|1617003470 2|14|VM02|50050629632|1617003471|1617004533 2|15|VM05|30224154624|1617003893|1617004610 - 1617000491: syntax error in expression (error token is "2|11|VM01|70915194880|1617000491|1617001668 2|12|VM04|47917826048|1617001670|1617002639 2|13|VM06|28607250432|1617002640|1617003470 2|14|VM07|50050629632|1617003471|1617004533 2|15|V3820008|30224154624|1617003893|1617004610 - 1617000491")

Task VM_BACKUP: VM01 VM02 best
WAdama commented 3 years ago

Hi,

I have some questions to be sure about the script used and the configuration: You're using the latest version? The config file is constructed as described in the readme? The VMS are all in the same task? Is one of the VM names containing special characters?

Best regards Ingo

HLAGCoding commented 3 years ago

Hi,

thanks for your comment! I will collect the necessary details and get back in this Thread soon. (busy times)

Cheers HLAGCoding

HLAGCoding commented 3 years ago

Hi,

Using v1.0.3 image

Configuration File image

PRTG Sensor image

ABB Task image

PRTG Logs <?xml version="10.0" encoding="UTF-8" ?> /var/prtg/scriptsxml/nas_ab_status_VM_TEST.sh: line 22: [: too many arguments /var/prtg/scriptsxml/nas_ab_status_VM_TEST.sh: line 32: 1617242628 2|2|V2990004|8052998144|1617242402|1617242590 2|3|V2990005|1358577664|1617242590|1617242669 2|4|V2990007|105939730432|1617242628|1617243615 - 1617242402: syntax error in expression (error token is "2|2|V2990004|8052998144|1617242402|1617242590 2|3|V2990005|1358577664|1617242590|1617242669 2|4|V2990007|105939730432|1617242628|1617243615 - 1617242402")

Task VM_BACKUP: A999V001 V2990004
WAdama commented 3 years ago

I can't really see what the problem is... Can you start the script manually in the bash console? Maybe the output there tell us more than the PRTG log.

Maybe it's just a feeling but how do you created the script on your Syno?

HLAGCoding commented 3 years ago

Output when running the Script from the console:

image

I have no Internet Access from the Synology, so i created an empty file and copied the source code manually via Clipboard into vi.

WAdama commented 3 years ago

Then should it be correct, I thought at first about CRLF at line end.

But your screenshot may show the problem: It can't open the SQLite database file.

Did you run the script with sudo? The database file can only be accessed with root access.

HLAGCoding commented 3 years ago

Sry forgot to use sudo.

image

WAdama commented 3 years ago

I have no really clue what's going wrong in your case. I know from another guy here that the script is working correct. Maybe it's the way you created the script.

Can you download the script via "Code" "Download as zip" and try with the script from the downloaded zip?

HLAGCoding commented 3 years ago

I have now given temporary Internet access to the NAS. Once i try to download it via wget it throws an 404 Error

image

WAdama commented 3 years ago

Just saw: There's an error with the URL. It has to be wget https://raw.githubusercontent.com/WAdama/nas_ab_status/master/nas_ab_status_m.sh

HLAGCoding commented 3 years ago

Just noticed it needs to be https://github.com/WAdama/nas_ab_status/blob/master/nas_ab_status_m.sh

WAdama commented 3 years ago

I've already corrected it...

HLAGCoding commented 3 years ago

Great thanks, unfortunately no change with the new Script. Exact outcome as in Post: https://github.com/WAdama/nas_ab_status/issues/6#issuecomment-814112985

I am able to monitor the ABB status of the VMs with the old version 1.0.2 of the script.

WAdama commented 3 years ago

Do you have added the task name to the config file? It should like this: DEVICES=(Device1 Device2 Server1 Server2) TASK=Task1

HLAGCoding commented 3 years ago

Found the issue... The Taskname in Synology is named: VM_BACKUP Have renamed the Task in ABB and in the .conf to VMBACKUP and its working as expected!

WAdama commented 3 years ago

I asked about special characters https://github.com/WAdama/nas_ab_status/issues/6#issuecomment-809554852, but I have to admit, an underscore I didn't had in mind... :-)

You could also set the names in quotation marks...

I will changed the description...

HLAGCoding commented 3 years ago

I thought special characters are not allowed for the Device Name but also for the Tasks: good to know! Thanks for the support and for the script. Will now roll it out to 70+ Synology NAS Systems :-)

WAdama commented 3 years ago

You're quite welcome...

I learn with each issue...

By the way: Then please close this one... ;-)

HLAGCoding commented 3 years ago

Closing issue as its fixed. Issue was a special character in the Task Name