Importing users from Core -> xi migration

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
aylesworth
Posts: 31
Joined: Mon Mar 22, 2021 12:57 pm

Importing users from Core -> xi migration

Post by aylesworth »

Hello,

We're 99% through the migration from Core to xi and I am wondering if there's a way to import the users and their privileges from the old Core install?

We have helpdesk users that need to be able to login and ack/disable alerts, as well as users that log in to view the status of things, in addition to the normal admin based users. I'm not sure where the userbase is stored in Core as I was sort of handed this project and am learning as I go. The only thing I can seem to find is the contacts, which migrated, but any users that need access to the xi I've created manually for testing.

Thanks!
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Importing users from Core -> xi migration

Post by pbroste »

Hello @aylesworth

Thanks for reaching out, the core User Accounts are maintained in htpasswd and unfortunately, we do not currently have any way to import from htpasswd.

I see that there has already been a feature request for this added.

Thanks,
Perry
aylesworth
Posts: 31
Joined: Mon Mar 22, 2021 12:57 pm

Re: Importing users from Core -> xi migration

Post by aylesworth »

Cool, thanks Perry.

Is there a specific file I can stare/compare on the Core system in order to manually input the user accounts/privs in xi?

Thanks!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Importing users from Core -> xi migration

Post by ssax »

If all of the contacts imported you can view them in Configure > Core Config Manager > Contacts.

If you're specifically referring to the Core server, the best place would likely be the objects.cache file which shows the final calculated objects:

Code: Select all

find / -name objects.cache
Then use that file in this command:

Code: Select all

grep -zPo 'define contact (\{([^{}]++|(?1))*\})' /usr/local/nagios/var/objects.cache
aylesworth
Posts: 31
Joined: Mon Mar 22, 2021 12:57 pm

Re: Importing users from Core -> xi migration

Post by aylesworth »

Thanks,

The contacts/groups have been imported into xi, I'm looking for specifically users that are able to log into the Core system of old, is that defined by contacts or somewhere else?

I need to make sure that everyone that has login ability and admin ability on the old core system has the same privileges on the new system.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Importing users from Core -> xi migration

Post by pbroste »

Hello @aylesworth

You can get a list of User's that able to login to the Nagios Core from the htpasswd

Code: Select all

cat /usr/local/nagios/etc/htpasswd.users
From the Nagios Core Web console > System (from the left column) > Configuration > Object Type: 'Contacts' and/or 'Contacts Groups' will provide a list as well. You can look through the archives to see if there were others that were logged in:

Code: Select all

grep -Eir 'contact'  /usr/local/nagios/var/archives/* | awk -F "=" '{print $4}' | sort -u
You will only be able to pull a list but no other data types will be available from the Nagios Core.

Thanks,
Perry
aylesworth
Posts: 31
Joined: Mon Mar 22, 2021 12:57 pm

Re: Importing users from Core -> xi migration

Post by aylesworth »

Thanks Perry,

The hthpasswd file only lists the 'nagiosadmin' account, and running that grep command returns a small list but I'm not sure if it's correct as I don't see my user account present.

In trying to get into the contacts section on Core, I'm greeted with an error "It appears as though you do not have permission to view the configuration information you requested..." Is this list available via CLI somewhere as well? Currently users log in and are authed via LDAP on both core and xi, would there be a log somewhere of LDAP authentications that I could look at?

Thanks!
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Importing users from Core -> xi migration

Post by pbroste »

Hello @aylesworth

Thanks for following up, the contacts are auth'ed off your Authentication server however we should see a list of contacts within your eventman.log.

Code: Select all

zcat /usr/local/nagiosxi/var/eventman.log-*.gz | grep -Ei 'contact'
Thanks,
Perry
aylesworth
Posts: 31
Joined: Mon Mar 22, 2021 12:57 pm

Re: Importing users from Core -> xi migration

Post by aylesworth »

Thanks Perry,

I'm looking for this info on the Core instance, the command seems to be for the xi box. Trying to compile a list of users that I need to create on the xi side based on previous logins to the core UI.

Thanks!
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Importing users from Core -> xi migration

Post by pbroste »

Hello @aylesworth,

In a previous post on this thread we pointed out the that the Nagios Core stores User information in htpasswd. On the core you can look through the nagios logs to get a list of contacts associated with checks; here is an example:
wproc: host=localhost; service=Root Partition; contact=nagiosadmin
Get a list:

Code: Select all

less /usr/local/nagios/var/archives/*.log | grep -Ei 'contact' | awk -F "contact=" '{print $2}' | sort -u
Thanks,
Perry