righter83 / checkmk-synology-hyperbackup

Checks if a specific job was runt successfully
0 stars 0 forks source link

Permission denied when run via CheckMK #2

Open joergotttus opened 1 year ago

joergotttus commented 1 year ago

Thanks for adapting the script - run as root directly on the Synology NAS works, but running without root-privileges from CheckMK gives a "permission denied" error. If I try to run the script on the NAS directly as admin-user (member of administrators; same user used in CheckMK) I don't have access to /volume1/@appdata/....

Any ideas besides changing the permissions on the NAS-System?

joergotttus commented 1 year ago

Intermediate solution found. ;-) Edit /etc/suedoers, added following lines:

# Allow members of group administrator to execute HyperBackup-Script as root
%administrators ALL=(root) NOPASSWD: /volume1/check_hyperbackup.sh

May not be very secure but on the other hand, nothing really eval will happen when executing the script....

Changed CheckMK to run sudo /volume1/chech_hyperbackup.sh

righter83 commented 1 year ago

There is also a Python API Library which should get the status. Maybe I gonna have a look into:

https://github.com/N4S4/synology-api

righter83 commented 1 year ago

I have uploaded a beta for grabbing the results over the API. I tested it quickly but not intensive.

joergotttus commented 1 year ago

API check seems to be working. Basic, but working. Thanks for your efforts! Working on a solution to bring all possible backups together: Active Backup for Business, Active Backup for M365, Hyper Backup, Cloud Sync - that's the tools we're using right and I somehow must have the backup results available in CheckMK...

righter83 commented 1 year ago

Ok I only use HB and AB not the other Tools, so I cannot test it and look into the others. If I have more free time at work, maybe I can look into and create a real CheckMK plugin which would be the best solution for that over the API. But that would need much more time :-)