Hi
I’d save the DB, as well as the images folder / templates folder…
My 2 cents…
Andy
New zabbix module update with included backup/restore, thanks to @Andy_Wismer
/etc/zabbix
/usr/share/zabbix
, /usr/lib/zabbix
I put it to the wiki as suggested:
@mrmarkuz
How do I update existing servers?
yum -y install nethserver-zabbix
Doesn’t update anything…
Thx
Andy
To update this way you have to install the repo:
https://wiki.nethserver.org/doku.php?id=mrmarkuz_repository
If it does not work, here is the direct download:
yum -y install https://smart-ict.services/mirror/mrmarkuz/7/noarch/nethserver-zabbix-0.0.1-6.ns7.noarch.rpm
Hi
Thanks, that worked well - didn’t know you had a repo…
Somehow oversaw that info.
Great Work, Markus!
Andy
Good Morning,
I am getting download errors when trying to install this package.
Sorry, the domain changed, see this thread
Please execute
yum -y install https://nethserver.globalcortex.net/mirror/mrmarkuz/7/noarch/nethserver-mrmarkuz-0.0.1-2.ns7.noarch.rpm
to make the downloads work again.
It worked. Thanks!
I’m using MrMarkuz’s packaged Zabbix - so far working excellently.
Since one of the last updates, all systems won’t correctly repport the backup. The Backup, however, is correctly done.
Any ideas?
Most likely it has something to do with changed reporting in the update of the backup module…
Thanks!
Yes, it seems like the backup-data log file that’s used by the script has changed. It’s now located in /var/log/backup/backup-backup-data-TIMESTAMP.log
and has a slightly different format. The backup-script now takes the latest file to check if the backup time is ok and if it contains SUCCESS.
For now I adapted the script of @syntaxerrormmm with my weak python skills, it should work but please check and improve when needed. It now checks in the latest log file if the backup time is ok and if it contains SUCCESS.
Change /usr/local/bin/nethbackup_check.py
to this:
#!/usr/bin/env python
# vim:sts=4:sw=4
# encoding: utf-8
import datetime, re, sys
import glob
import os
list_of_files = glob.glob('/var/log/backup/backup-backup-data-*.log')
latest_file = max(list_of_files, key=os.path.getctime)
BACKUPTYPE = {
'Data': latest_file,
'Config': '/var/log/backup-config.log'
}
def backup_check(backuptype, validity):
# get line with time
f = open(BACKUPTYPE[backuptype])
timeline = f.readlines()[-6]
f.close()
# get line with status, hopefully success
f = open(BACKUPTYPE[backuptype])
successline = f.readlines()[-7]
f.close()
# Splitting the lines once read
timeline_arr = str.split(timeline)
successline_arr = str.split(successline)
# Extract the date
check = datetime.datetime.strptime(timeline_arr[3], '%Y-%m-%d').date()
end = datetime.date.today()
start = end - datetime.timedelta(days = int(validity))
# Verifies the status of the last backup
if start <= check <= end and re.match(r'SUCCESS', successline_arr[2]):
return 1
return 0
if __name__ == '__main__':
print(backup_check(sys.argv[1], sys.argv[2]))
Please test and adapt, if it works I’ll add it to the module.
@mrmarkuz
It’s on my home server in TESTING !!!
Thx, will give a feedback when the check is done (ca 09:00) and when both checks are successful…
Andy
Ooops, it seems the backup-config logfile has changed too, so for now only the backup-data check is working…
Thanks for testing!
EDIT:
I adapted the script /usr/local/bin/nethbackup_check.py
for testing with working backup-config check, I am afraid I have to rewrite it because the original logic implies log files with same format and now config is checked via /var/log/messages
.
#!/usr/bin/env python
# vim:sts=4:sw=4
# encoding: utf-8
import datetime, re, sys
import glob
import os
import subprocess
list_of_files = glob.glob('/var/log/backup/backup-backup-data-*.log')
latest_file = max(list_of_files, key=os.path.getctime)
BACKUPTYPE = {
'Data': latest_file,
'Config': '/var/log/messages.log'
}
def backup_check(backuptype, validity):
if backuptype == 'Data':
# get line with time
f = open(BACKUPTYPE[backuptype])
timeline = f.readlines()[-6]
f.close()
# get line with status, hopefully success
f = open(BACKUPTYPE[backuptype])
successline = f.readlines()[-7]
f.close()
# Splitting the lines once read
timeline_arr = str.split(timeline)
successline_arr = str.split(successline)
# Extract the date
check = datetime.datetime.strptime(timeline_arr[3], '%Y-%m-%d').date()
end = datetime.date.today()
start = end - datetime.timedelta(days = int(validity))
# Verifies the status of the last backup
if start <= check <= end and re.match(r'SUCCESS', successline_arr[2]):
return 1
if backuptype == 'Config':
cmd = ["""grep 'post-backup-config SUCCESS' /var/log/messages | tail -1"""]
output = subprocess.check_output(cmd,shell=True)
# Splitting the lines once read
line_arr = str.split(output)
# From last line I will also extract the date
check = datetime.datetime.strptime(line_arr[0] + " " + line_arr[1] + " " + str(datetime.datetime.now().year), '%b %d %Y').date()
end = datetime.date.today()
start = end - datetime.timedelta(days = int(validity))
# Verifies the status of the last backup
if start <= check <= end:
return 1
return 0
if __name__ == '__main__':
print(backup_check(sys.argv[1], sys.argv[2]))
Hi
Seems your Python capabilities are understated…
The check seems to work - at least for the Data Backup part, as stated.
The Config Backup still needs to be adapted.
Maybe this evening I’ll find time to go over the code…
Just had an emergency call from my client (Hotel). The conference room with over 50 people for the subject “Challenges of Digitization” - and Internet does not work! (Murphy does such things!)
In the end it was a half year old High Speed USB Disk, acting as the firewall HD. On ANY System, formatting would work - till ca. 50%. Then dead! Sandisk usually have good quality stuff, and the firewall wasn’t doing much writing in there…
Sh"t happens, as the saying goes… It’s working again, had to buy a new USB Stick…
Thanks!
Andy
Hi
I was too early about the backup-check… The returned data (Latest data) still implies a negativ check…
I wasn’t able to debug that script yet, but it’s still on my to-do list. Maybe you or syntaxerrormmm could have another look…
Thx
Andy
Guys, thanks for all the efforts trying to cope with updates.
Obviously, I have a lot of NSs failing the backups (which is obviously not the case) in our monitoring system, so I am affected on the update too.
I was working on a new version of the script on last friday, so stay tuned Just hope our customers don’t ask for the moon in the meantime
This is the sort of thing when “Upstream” changes something in the middle of the game…
It’s ok and fine with me if such changes happen in Major Upgrades - not in minor updates…
I do remember when still using SME-Server - and RH decided to change the encoding page for the samba part from ISO8859-1 to UFT8 or something like that a few years back…
OK, so what happens to all users who had valid passwords in the Database (LDAP/AD). No one can log in any more!
Great!
I think, on that particular day, someone “Upstream” didn’t turn on their brain in the morning!
Not the stuff to start a day in IT…
Keep up the great work, syntaxerrormmm !!!
Andy
I worked on a complete rewrite and:
1 - I am not completely satisfied with the result (much spaghetti code, a lot of repetitions);
2 - It does not support the multiple backup jobs yet (only ‘Config’ and ‘Data’ can be passed for check);
3 - Should be less change-prone (since it checks out /var/log/messages
instead of the single backup file) — Now it only depends on the syntax of the SUCCESS/FAILURE line;
4 - Because it needs to access to /var/log/messages
, now it requires to be run with sudo
in userparameters (at least if you run your zabbix system with a user different from root
).
You can find the updated files within the last commit on the previous reported repo on GitHub.
Zabbix 4.0 LTS is here!
https://www.zabbix.com/life_cycle_and_release_policy
https://www.zabbix.com/release_notes
It’s working in first tests but I did not test an update. Don’t test in production.
Installation instructions:
https://wiki.nethserver.org/doku.php?id=zabbix#zabbix_repo
I am going to test and integrate the script of @syntaxerrormmm, if someone has already tested it please report…
great!
just a quick test… i’ve updated an almost clean install of 3.4 (only a discovery rule was set) . it worked and didn’t see any error in logs.
tnx!