![]() |
![]() |
Subject: | How to restore Zenoss from a backup? |
Author: | [Not Specified] |
Posted: | 2014-05-20 09:06 |
I created some backups using the GUI in the web browser, however I don't see any options on restoring. What's the process for restoring zenoss from a backup
Thanks
Subject: | When I try to run: |
Author: | [Not Specified] |
Posted: | 2014-05-20 10:08 |
When I try to run:
zenrestore --file=$ZENHOME/backups/zenbackup_20140520.tgz
I get this:
ERROR 1227 (42000) at line 994: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
--------
I tried running it under the zenoss user and root.
--------
System OS: CentOS 6.5
Zenoss: 4.2.5
I NEED HELP! :)
Thanks
Subject: | It sounds like you need to |
Author: | [Not Specified] |
Posted: | 2014-05-20 11:38 |
It sounds like you need to specify the MySQL credentials: http://community.zenoss.org/docs/DOC-3048
That is an old link but I'm on my phone ;)
Hydruid
Subject: | Thanks for the quick reply. : |
Author: | [Not Specified] |
Posted: | 2014-05-20 12:22 |
Thanks for the quick reply. :)
So, i tried adding the MySQL credentials. Still not working and I'm 100% sure i'm using the correct password.
zenrestore --zepdbname=Zenoss --zepdbuser=Zenoss --zepdbpass=***** --file=zenbackup_20140520.tgz
When I installed Zenoss, I used the auto-deployed method. i remember it asking me to set a password for the database, however I don't know what the dbname and dbuser (Default) the auto-deployed method created (I don't remember it asking me to do that) .
Thanks
Subject: | You can use the command below |
Author: | [Not Specified] |
Posted: | 2014-05-20 12:38 |
You can use the command below to test your MySQL credentials:
mysql -u root -p
or
mysql -u zenoss -p
However I don't think the --zep* commands you're using are correct, I believe it's just --dbname and etc. but I would only specify user/pass not databases.
Hydruid
Subject: | I got the --zep* commands |
Author: | [Not Specified] |
Posted: | 2014-05-20 13:39 |
I got the --zep* commands from 'zenrestore --help', it seems they changed the commands for 4.2.5 (the other ones don't work). I was able to successfully test my MySQL credentials using the 'mysql -u root -p' and using the password that I created during the auto deployed method.
When i try again;
zenrestore --zepdbname=Zenoss --zepdbuser=root --zepdbpass=***** --file=zenbackup_20140520.tgz
I'm still getting the same error :(
Subject: | Okay I found an old post |
Author: | [Not Specified] |
Posted: | 2014-05-21 07:50 |
Okay I found an old post about issues with an encrypted MySQL password, and also another old post that mentioned changing the root password to solve it. Unfortunately I could only preview those posts as part of the old forums is unavailable.
Give this a try!
stop zenoss
restart mysql (to verify there are no errors)
mysql -u root -p
grant all privileges on zenoss_zep.* to 'root'@'localhost' identified by 'newpassword';
grant all privileges on zodb.* to 'root'@'localhost' identified by 'newpassword';
grant all privileges on zodb_session.* to 'root'@'localhost' identified by 'newpassword';
exit
Then try your above command with the new password. I'll produce a backup on my 4.2.5 DEV server and try the same.
Hydruid
Subject: | I just successfully restored |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:13 |
I just successfully restored using the following command:
zenrestore --file=/opt/zenoss/backups/zenbackup_20140521.tgz
I think once you grant the privileges to the above tables, then you should be good to go. I would also give the full path to the backup file just to make sure!
Hydruid
Subject: | Alright I'm starting to get |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:27 |
Alright I'm starting to get mad at this zenrestore crap... I follow your instruction with no issues. However, I'm still getting the same access denied error. I even tried to create a new backup in the command line using; zenbackup --zepdbuser=root zepdbpass=**** . When i try to restore it, still get the same damn error. Is there another way to backup zenoss
Subject: | Just tried the full pass, |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:31 |
Just tried the full path, same error.
Subject: | If you can jump on IRC in the |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:36 |
If you can jump on IRC in the #zenoss channel, might be faster to troubleshoot.
Have you tried just running 'zenbackup' from the CLI should be enough, as that automatically stores the credentials from the global.conf file Then just 'zenrestore --file=/path/to/zenoss.tgz'
Hydruid
Subject: | Yes I did. Same results...I |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:39 |
Yes I did. Same results...I will jump on the IRC channel when i get time. Thanks, for all your help. :)
Subject: | That is very strange.....is |
Author: | [Not Specified] |
Posted: | 2014-05-21 08:46 |
That is very strange.....is your zenoss server having other issues Did you upgrade mysql
Hydruid
Subject: | OMG....just made a fresh |
Author: | [Not Specified] |
Posted: | 2014-05-22 13:34 |
OMG....just made a fresh install of zenoss, created a backup with CLI and got the same f****ing error..........I didn't update anything either.... lol
Subject: | Hmmm did you use just the |
Author: | [Not Specified] |
Posted: | 2014-05-22 13:46 |
Hmmm did you use just the 'zenbackup' command I am double checking now on a fresh install!
Hydruid
Subject: | Yes I did |
Author: | [Not Specified] |
Posted: | 2014-05-22 13:50 |
Yes I did
Subject: | Fresh install of 4.2.5 |
Author: | [Not Specified] |
Posted: | 2014-05-22 14:40 |
Fresh install of 4.2.5 zenbackup and zenrestore worked for me with no issue......Are you doing anything weird with CentOS, or with the install
Hydruid
Subject: | Ha, I just did another fresh |
Author: | [Not Specified] |
Posted: | 2014-05-22 14:50 |
Ha, I just did another fresh install of Zenoss, with no password setup for the MySQL database...same error....
When I install CentOS 6.5, I change the IPv4 settings and I also customize the applications that are being install. I add GUI (Gnome), X Windows System, Network Tools, and I remove Java. Also, when it ask for what type of CentOS you want to install, I choose 'Basic Server'. Nothing too dramatic.
Subject: | Hmmm not sure. Is it |
Author: | [Not Specified] |
Posted: | 2014-05-22 15:31 |
Hmmm not sure. Is it installed on the bare metal or in a VM Is it in the cloud Anything else about your environment that isn't standard. Are you modifying /etc/hosts or /etc/hostname by hand and then installing Zenoss before a reboot Remote MySQL server
Hydruid
Subject: | I know this is an old post, |
Author: | [Not Specified] |
Posted: | 2014-12-17 13:47 |
I know this is an old post, but i'm having a similar issue.
The server where I had Zenoss installed started to had some hardware problems, so I installed a new one.
When I'm restoring the backup made in my old Zenoss in the new server, I have the same error that was mentioned here.
I do this:
/opt/zenoss/bin/zenrestore --dir=/home/zenoss/zenbackup
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
gzip: stdout: Broken pipe
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
2014-12-17 17:11:47,137 WARNING relstorage.adapters.mysql: Unable to connect: (1045, "Access denied for user 'zenoss'@'localhost' (using password: YES)")
I don't remember what was the mysql password that I used to install my old server, but in the new one when I try to connect to mysql I can do it without problems.
There is a possibility to set up the mysql user and password to restore the backup
Thanks!
Subject: | FIX! |
Author: | Paul Manno |
Posted: | 2016-04-07 15:57 |
Hi all,
So this really got me going. I had the same problem, so I set up a VM and worked at it until I found a solution. It's kinda involved, but here's what I encountered and how I fixed it.
1) Existing Zenoss installation that's running fine. Running CentOS 2.6.18-348.12.1.el5. Let's call this machine management.
ZenossZenoss 4.2.5
OSLinux (x86_64) 2.6.18 (Linux management 2.6.18-348.12.1.el5 #1 SMP Wed Jul 10 05:28:41 EDT 2013 x86_64)
ZopeZope 2.13.13
PythonPython 2.7.2
DatabaseMySQL 5.5.44 (5.5.44)
RRDRRDtool 1.4.7
TwistedTwisted 11.0.0
RabbitMQRabbitMQ 2.8.6
ErlangErlang 5.6.5
NetSnmpNetSnmp 5.3.2
PyNetSnmpPyNetSnmp 0.30.7
WMIWmi 1.3.15
2) New Clean CentOS VM 2.6.18-348.el5, let's call this machine vm
Zenoss Zenoss 4.2.5
OS Linux (x86_64) 2.6.18 (Linux vm 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64)
Zope Zope 2.13.13
Python Python 2.7.2
Database MySQL 5.5.37 (5.5.37)
RRD RRDtool 1.4.7
Twisted Twisted 11.0.0
RabbitMQ RabbitMQ 2.8.7
Erlang Erlang 5.8.5
NetSnmp NetSnmp 5.3.2
PyNetSnmp PyNetSnmp 0.30.7
WMI Wmi 1.3.15
3) Did a normal zenbackup on management.
4) Did an auto-deploy install on vm. This is where I ran into the first problem. RabbitMQ couldn't install due to problem with erlang. Fixed this by issuing:
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo
Once this repo is installed the auto-deploy script works fine. I chose to leave the root password blank in this test. You'll see that in step 6.
5) So... copy the zenbackup_
6) So, zenrestore tries to be a bit clever about the config files and backs things up, then overwrites them with what's in the zenbackup.tgz file. This is a problem because on a clean install the passwords don't match up with what you backed up from the other server... so we have to add some options to the zenrestore command when we execute it. But first, what I did was after doing the clean auto-deploy, have a look at and document the zenoss password that is in /opt/zenoss/etc/global.conf. You'll see something like this:
zodb-db-type mysql
zodb-host localhost
zodb-port 3306
zodb-db zodb
zodb-user zenoss
zodb-password 1LMy5hRaCUn7VXI
zodb-admin-user root
zodb-admin-password
zodb-cacheservers 127.0.0.1:11211
zodb-cachesize 1000
amqphost localhost
amqpport 5672
amqpvhost /zenoss
amqpuser zenoss
amqppassword 1LMy5hRaCUn7VXI
amqpusessl 0
amqpadminport 55672
amqpadminusessl 0
zep-db-type mysql
zep-host localhost
zep-port 3306
zep-db zenoss_zep
zep-user zenoss
zep-password 1LMy5hRaCUn7VXI
zep-admin-user root
zep-admin-password
zep-uri http://localhost:8084
hubpassword 1LMy5hRaCUn7VXI
You're going to need that password (which is in plain text in global.conf and in this case is 1LMy5hRaCUn7VXI ). You can verify connectivity to the mysql database with that password by issuing:
mysql -uzenoss -p1LMy5hRaCUn7VXI
So copy and paste your password in a text file for now and keep it handy.
7) We need to alter the behavior of zenrestore now, so edit the /opt/zenoss/Products/ZenUtils/ZenRestore.py file, find the restoreEtcFiles(self) method and make it look like this:
def restoreEtcFiles(self):
self.msg('Restoring config files.')
cmd = 'cp -p %s %s' % (os.path.join(zenPath('etc'), 'global.conf'), self.tempDir)
if os.system(cmd):
return -1
cmd = 'tar Cxf %s %s' % (
zenPath(),
os.path.join(self.tempDir, 'etc.tar')
)
if os.system(cmd):
return -1
if self.options.fetchArgs:
if not os.path.exists(os.path.join(zenPath('etc'), 'global.conf')):
self.msg('Restoring default global.conf')
cmd = 'mv %s %s' % (os.path.join(self.tempDir, 'global.conf'), zenPath('etc'))
if os.system(cmd):
return -1
else:
cmd = 'mv -f %s %s' % (os.path.join(self.tempDir, 'global.conf'), zenPath('etc'))
if os.system(cmd):
return -1
That will take care of the wrong password being used by the zenoss user.
8) The next problem we have is that when you're restoring the db, zenrestore tries to use the zenoss user to do the restore, but the zenoss user isn't a super user and can't create tables! So... we need to modify our friend /opt/zenoss/Products/ZenUtils/ZenRestore.py again. In the _restoreZEPDB(self) function, there is a self.restoreMySqlDb(...) call between two self.msg('Restoring ZEP database.') and self.msg('ZEP database restored') method calls. Change it to look like this:
self.restoreMySqlDb(self.options.zepdbhost, self.options.zepdbport,
self.options.zepdbname, self.options.zepdbadmin,
getPassArg(self.options, 'zepdbadminpass'), zepSql)
9) Now in the last step we changed self.options.zepdbuser to self.options.zepdbadmin and getPassArg(self.options, 'zepdbpass') to getPassArg(self.options, 'zepdbadminpass'), but those options don't exist yet. We have to add them. So edit /opt/zenoss/Products/ZenUtils/ZenBackupBase.py and in the class ZenBackupBase(CmdBase) def buildOptions(self) method, where it's doing all the "self.parser.add_option" stuff, add in these lines:
self.parser.add_option('--zepdbadmin',
dest='zepdbadmin',
default='root',
help='ZEP database admin username.'
' By default this will be fetched from Zenoss'
' unless --dont-fetch-args is set.'),
self.parser.add_option('--zepdbadminpass',
dest='zepdbadminpass',
default='',
help='ZEP database admin password.'
' By default this will be fetched from Zenoss'
' unless --dont-fetch-args is set.'),
10) Now you're actually ready to do a zenrestore! Since we want our first change to apply, we have to restore with the --dont-fetch-args switch on, but if we don't fetch args, we have to give zenrestore passwords and stuff when we call it. Here is what I did:
zenrestore --verbose --file=zenbackup_20160405.tgz --dont-fetch-args --zepdbname=zenoss_zep --zepdbuser=zenoss --zepdbpass=1LMy5hRaCUn7VXI --zepdbhost=localhost --zepdbport=3306 --zodb-host=localhost --zodb-port=3306 --zodb-user=zenoss --zodb-password=1LMy5hRaCUn7VXI --zodb-db=zodb --zenpacks
Yeah.. I did zenpacks too, which MOSTLY seems to work... but there are some issues there still too that I need to look at more closely.
So run that restore, and it should work just fine... but we're not done yet!
11) So some of the conf files we restored have the other machine's zenoss password and we have to fix those. These files are all in the /opt/zenoss/etc directory and are named as such:
zodb_db_main.conf
zodb_db_session.conf
zenhub.conf
edit those files and fix the zenoss password. In zodb_db_*.conf, they are XML files and the password is pretty obvious. In zenhub.conf it's the zodb-password.
Next, while in the /opt/zenoss/etc directory, change the hubpasswd file like this (remember to put YOUR password in, not mine):
echo 'admin:1LMy5hRaCUn7VXI' > hubpasswd
Then... again use YOUR password, not mine:
sed -i 's/^#*hubpassword .*/hubpassword 1LMy5hRaCUn7VXI/' *.conf
12) So now all the passwords are right and life is looking good, but I had to do one more thing to get things to work right. I was getting some crazy org.apache.lucene.index.IndexFormatTooOldExceptions in my /opt/zenoss/log/zeneventserver.log file. So.. I had to delete some indexes in /opt/zenoss/var/zeneventserver/index. I did this:
cd /opt/zenoss/var/zeneventserver
tar -czvf index.tar index
cd index
cd summary
rm -f *
cd ..
cd archive
rm -f *
cd ~
13) Now you're done! You can go ahead and start Zenoss, and it SHOULD work... I have a few zenpacks installed that still bitched... for example:
Daemon: zenwin starting...
/opt/zenoss/bin/python: can't open file '/opt/zenoss/zenwin.py': [Errno 2] No such file or directory
Daemon: zeneventlog starting...
/opt/zenoss/bin/python: can't open file '/opt/zenoss/zeneventlog.py': [Errno 2] No such file or directory
Daemon: zenwinperf starting...
/opt/zenoss/bin/python: can't open file '/opt/zenoss/zenwinperf.py': [Errno 2] No such file or directory
Daemon: zenpython /opt/zenoss/bin/zenoss: line 115: /opt/zenoss/bin/zenpython: No such file or directory
But the web interface was working and everything else looks good!
Hope this helps some poor soul not waste days of his/her life trying to figure all the messed up stuff out for themselves.
All the best,
Paul
< |
Previous SNMP agent down but snmpwalk and zenperfsnmp work |
Next Internal exception processing event: IndexError('list index out of range',) |
> |