Possible to migrate users between instances?

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Possible to migrate users between instances?

Post by vAJ »

I've built a very large set of users in my test instance. Given our very large AD tree, it's been quite an effort to get these users added over time.

Now those users all needed to be added to our Prod cluster. Any chance of being about to bulk-load users from one instance to another? Anyway to script it?
Andrew J. - Do you even grok?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Possible to migrate users between instances?

Post by rkennedy »

There isn't exactly a clean way to do this yet, but I've filed a feature request for it. ID #9051.

There is a way to do this though. On the machine that you have all of the accounts created, run the following command -

Code: Select all

curl -XGET 'http://localhost:9200/nagioslogserver/_search?type=user&pretty' | grep _source | sed -e 's/"_source"://' -e '/nagiosadmin/ d'
This will produce a list of users, similar to below -

Code: Select all

{"name":"frank","username":"frank","email":"[email protected]","password":"fcba8051ec9c89dfa788d2e093b54765629bc153237a2a4d26c0ae959500b4c5","apiaccess":"0","apikey":"","auth_type":"user","language":"default","auth_settings":[],"created":"2016-07-12 11:27:12","created_by":"1","default_dashboard":"\/dashboard\/elasticsearch\/AVXf7wsIHR1LuUxatCko"}
Now, take the information that is pulled from that command, and we can create a CURL request to use on the newly created machine, to add frank in. One thing to note, is the default_dashboard must be changed to /dashboard/elasticsearch/default. You'll also need to change the number 2 to an increasing value, in the CURL -- so if user id '2' already exists, use '3'. Everything else should be good to copy / paste -

Code: Select all

curl -XPUT 'http://localhost:9200/nagioslogserver/user/2' -d '{"name":"frank","username":"frank","email":"[email protected]","password":"fcba8051ec9c89dfa788d2e093b54765629bc153237a2a4d26c0ae959500b4c5","apiaccess":"0","apikey":"","auth_type":"user","language":"default","auth_settings":[],"created":"2016-07-12 11:27:12","created_by":"1","default_dashboard":"/dashboard/elasticsearch/default"}'
Former Nagios Employee
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: Possible to migrate users between instances?

Post by vAJ »

I'll give this a try and see if it meets my needs.

While we're adding feature requests, it would be great to have ability to pull up an AD group in the add user wizard and already grey out which users are already added.

Otherwise we can close this up. I'll PM you later if we need to open it back up or I have other issues with this backend fix.

Thanks,
Andrew
Andrew J. - Do you even grok?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Possible to migrate users between instances?

Post by rkennedy »

Sounds good. I added a feature request to gray out AD users after they've been added, so they are unselectable once again. The ID is #9053.

One thing I almost over looked, you'll also need to modify the # in the link you POST to to increment as you add users -

Code: Select all

'http://localhost:9200/nagioslogserver/user/2'
I'll edit my original thread, and close this up.
Former Nagios Employee
Locked