Copy frontend user accounts to other servers
Copy frontend user accounts to other servers
I have 20 Nagios XI 5.2.3 monitoring servers. The login accounts for the GUI are not using LDAP authentication, but a manual password that is set when the account is created.
Is there a way of copying front end, GUI logins from one server to other servers while retaining the same password and permissions ?
I spend way too much time manually creating logins on Server A and then manually creating the same logins on Server B, Server C, etc. I am talking about 100 to 300 users or more per server for a large company.
Is there a script that will do this for me or a table from the database that can be backed up and restored on the other servers as a means of copying the user accounts ?
Any help would be appreciated.
Is there a way of copying front end, GUI logins from one server to other servers while retaining the same password and permissions ?
I spend way too much time manually creating logins on Server A and then manually creating the same logins on Server B, Server C, etc. I am talking about 100 to 300 users or more per server for a large company.
Is there a script that will do this for me or a table from the database that can be backed up and restored on the other servers as a means of copying the user accounts ?
Any help would be appreciated.
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Copy frontend user accounts to other servers
Can you post the output of the following two commands?
Thanks!
Code: Select all
echo '\d;' | psql nagiosxi nagiosxi
echo 'show databases;' | mysql -t -u root -pnagiosxi
Re: Copy frontend user accounts to other servers
The first command you listed, the command psql cannot be found as we are on a version of Nagios XI that no longer requires Postgres. For the second command you listed, see output below.
Code: Select all
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| nagiosxi |
| performance_schema |
| test |
+--------------------+
Re: Copy frontend user accounts to other servers
It looks like everything is on SQL so that's a good sign.
There was actually this functionality added into a newer version. 5.3.x. It works with an API call by using something like this -
which returns -
There was actually this functionality added into a newer version. 5.3.x. It works with an API call by using something like this -
Code: Select all
curl -XPOST "http://192.168.3.115/nagiosxi/api/v1/system/user?apikey=32klfcka&pretty=1" -d "username=jmcdouglas&password=test&name=Jordan%20McDouglas&email=jmcdouglas@localhost"
Code: Select all
{
"success": "User account jmcdouglas was added successfully!",
"userid": "16"
}
Former Nagios Employee
Re: Copy frontend user accounts to other servers
Is there a way to use curl to obtain a list of users from the GUI ?
Re: Copy frontend user accounts to other servers
Something like this should do the trick:
Code: Select all
curl -XGET "http://<xi_host>/nagiosxi/api/v1/system/user?apikey=<api_key>&pretty=1"Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Copy frontend user accounts to other servers
I have another question on this same topic if I can append it here without opening a new topic.
On a Nagios XI 5.2.3 server, I can paste the following into my browser and see a list of all the users in the GUI.
http://myserver:8085/nagiosxi/backend/?cmd=getusers
I want to get the same output from the command line using curl, but so far I can only retrieve a single account by running the following for example. If I try to curl the http line above, I will get an authentication error.
curl -XGET "http://myserver:8085/nagiosxi/backend/? ... cketnumber" -o myfile
There is reference in this topic and others as to using: curl -XGET "http://<xi_host>/nagiosxi/api/v1/system/user?apikey=<api_key>&pretty=1" but this path does not exist on my 5.2.3 Nagios XI server.
On a Nagios XI 5.2.3 server, I can paste the following into my browser and see a list of all the users in the GUI.
http://myserver:8085/nagiosxi/backend/?cmd=getusers
I want to get the same output from the command line using curl, but so far I can only retrieve a single account by running the following for example. If I try to curl the http line above, I will get an authentication error.
curl -XGET "http://myserver:8085/nagiosxi/backend/? ... cketnumber" -o myfile
There is reference in this topic and others as to using: curl -XGET "http://<xi_host>/nagiosxi/api/v1/system/user?apikey=<api_key>&pretty=1" but this path does not exist on my 5.2.3 Nagios XI server.
Re: Copy frontend user accounts to other servers
There are many REST API improvements in the latest revisions of Nagios XI. I would recommend upgrading your Nagios XI instance to the latest. Then, you will be able to run something like this:
where you substitute "xxx" with the actual API key.
Code: Select all
curl -XGET "http://myserver:8085/nagiosxi/api/v1/system/user?apikey=xxx&pretty=1" -o myfileBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Copy frontend user accounts to other servers
Our company installs Nagios XI differently and so an upgrade path isn't always easy. I won't go into all the details, but is what I am attempting to do in anyway possible in the 5.2.3 version ?
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Copy frontend user accounts to other servers
Complicated or not, if you want to use the modern API, you'll need to upgrade to at least 5.3.x.rkennedy wrote: There was actually this functionality added into a newer version. 5.3.x.