Restore only Xi users?
Restore only Xi users?
Is there a way to restore only the Nagios XI users? I was trying to clean up some old user entries and cleaned up a several too many. The rest of the server is fine.
Re: Restore only Xi users?
Hi
When was the last time you did a backup?
Looks like you sent us a System Profile around December 8 for ticket https://support.nagios.com/tickets/scp/ ... p?id=16789
If that is current enough I could send you the mysqldumps from it.
Let me know.
Thanks
When was the last time you did a backup?
Looks like you sent us a System Profile around December 8 for ticket https://support.nagios.com/tickets/scp/ ... p?id=16789
If that is current enough I could send you the mysqldumps from it.
Let me know.
Thanks
Re: Restore only Xi users?
Hello @DFaught
Thanks for reaching out, there are several ways you could go about going through your User Accounts, and want to go over 'api' method:
To get a list:
or without 'pretty' for easier formating for adding new:
Once you have a list you can delete the User account based on 'user_id'. If you want you could automate this with a script:
* XX=user_id#
Thanks,
Perry
Thanks for reaching out, there are several ways you could go about going through your User Accounts, and want to go over 'api' method:
Code: Select all
https://yourhostaddresshere/nagiosxi/help/api-system-reference.php#user
Code: Select all
curl -XGET "https://192.168.23.200/nagiosxi/api/v1/system/user?apikey=yourapikeyhere&pretty=1"
Code: Select all
curl -XGET "https://192.168.23.200/nagiosxi/api/v1/system/user?apikey=yourapikeyhere"
Code: Select all
curl -XDELETE "https://192.168.23.200/nagiosxi/api/v1/system/user/XX?apikey=yourapikeyhere&pretty=1"
Thanks,
Perry
Re: Restore only Xi users?
I have between 20 and 40 or so users each on 10 different NagiosXI servers that I need to get back.
@pbroste, this is what got me into trouble in the first place. I'm trying to recover now.
@gsmith, I have backups from each server from a couple days ago. The question is - is there a way to get all the users back without having to restore everything?
Thank you for your responses.
Dave
@pbroste, this is what got me into trouble in the first place. I'm trying to recover now.
@gsmith, I have backups from each server from a couple days ago. The question is - is there a way to get all the users back without having to restore everything?
Thank you for your responses.
Dave
Re: Restore only Xi users?
Hello @DFaught
Thanks for following up and providing further details.
You can take your compressed backup and extract: tar -xvf 16xxxxxxxx.tar.gz
In the directory path: 16xxxxxxxxx/mysql will find the individual databases:
To review the table output to verify:
Looks good then import:
I am providing one way of working your way through export/import, but there are many other alternatives that will work. Please use what you are comfortable with. Very important to make a backup before importing to the database just in case something goes wonky.
Thanks
Perry
Thanks for following up and providing further details.
You can take your compressed backup and extract: tar -xvf 16xxxxxxxx.tar.gz
In the directory path: 16xxxxxxxxx/mysql will find the individual databases:
- In nagiosql --> tbl_user is the schema, not much to see there
- In nagiosxi --> xi_users is the user data that you will be interested in
Code: Select all
./mysqldumpsplitter.sh --source /tmp/16xxxxxxxx/mysql/nagiosxi.sql --extract TABLE --match_str xi_users --compression none
Code: Select all
cat out/xi_users.sql
Code: Select all
mysql -uroot -p -D nagiosxi < whicheverdirectory/xi_users.sql
Thanks
Perry
Re: Restore only Xi users?
Thank you very much, This will work.
Happy Holidays!
Regards,
Dave
Happy Holidays!
Regards,
Dave
Re: Restore only Xi users?
Excellent Dave, have a Happy New Year, I will go ahead and lock.
Thanks,
Perry
Thanks,
Perry