nagiosadmin script does not work

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Post Reply
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

nagiosadmin script does not work

Post by riahc3 »

Hello

This isnt the first time this has happened but when moving the data directory, I get a "Invalid username or password."

I run the script to reset the password and still same thing.

The pass could be simple, could be complex. It does not work.

When I manually run the commands in the script:


[root@server ~]# newpass="12345"
[root@server ~]# $newpass
-bash: 12345: command not found
[root@server ~]# passhash=$(printf "$newpass" | openssl sha256)
[root@server ~]# passhash=${passhash:9}
[root@server ~]# update="{\"doc\":{\"password\":\"$passhash\"}}"
[root@server ~]# curl -XPOST http://localhost:9200/nagioslogserver/user/1/_update -d "$update"
{"error":"DocumentMissingException[[nagioslogserver][0] [user][1]: document missing]","status":404}[root@server ~]#

So it doesnt even find the nagiosadmin user?

Please do not make me reinstall Nagios Log Server AGAIN.

On a side note, how do I get old logs/indexes imported back to another Nagios Log Server? I already have a bunch of logs and wouldnt like to lose them.
jsimon
Posts: 106
Joined: Wed Aug 23, 2023 11:27 am

Re: nagiosadmin script does not work

Post by jsimon »

Hi @riahc3,

Generally speaking assuming you are using virtual machines for your Log Server installations, I would highly recommend snapshotting your VM before making these or any other important changes to ensure you can restore your working state if anything goes wrong.

Could you explain more about moving your data directory? We do have a guide for moving the data directory elsewhere, but I'm not sure how you could run into this password issue just from these steps, so I'd like to know more about what steps you took to move yours.

https://assets.nagios.com/downloads/nag ... Server.pdf

For your password issue, can you advise what happens when you run the "reset_nagiosadmin_password.sh" script? Does it give you error output, or complete successfully?

As for migrating your data, I would recommend following this guide:

https://nagiosenterprises.my.site.com/s ... r-30aca6d0

Our recommended process on this sort of data migration would be to add the new Log Server node to the old node to make a cluster and sync your data. Once the data is synced you can remove the old node from your cluster.
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

Re: nagiosadmin script does not work

Post by riahc3 »

jsimon wrote: Wed Apr 03, 2024 9:49 am Could you explain more about moving your data directory? We do have a guide for moving the data directory elsewhere, but I'm not sure how you could run into this password issue just from these steps, so I'd like to know more about what steps you took to move yours.

https://assets.nagios.com/downloads/nag ... Server.pdf
I have the logs on a remote Linux server that is just for storage of said logs. On the remote server, the entire VMDK is represented on /data

Then, on the Nagios Log Server, I mounted that to /data located on the Nagios Log Server. I see the files and everything and of course, can read and write. From then, I followed all the steps to move the data, set permissions, etc. I also see new folders/files/indexes/etc being created

Once I finish that, I cannot get in anymore. It says it the username and password is incorrect.
jsimon wrote: Wed Apr 03, 2024 9:49 am For your password issue, can you advise what happens when you run the "reset_nagiosadmin_password.sh" script? Does it give you error output, or complete successfully?
It says it has completed successfully. No errors or anything.

jsimon wrote: Wed Apr 03, 2024 9:49 am As for migrating your data, I would recommend following this guide:

https://nagiosenterprises.my.site.com/s ... r-30aca6d0

Our recommended process on this sort of data migration would be to add the new Log Server node to the old node to make a cluster and sync your data. Once the data is synced you can remove the old node from your cluster.
This is just a one node cluster; What I wanted to do is reimport for a old node and a old cluster.
jsimon
Posts: 106
Joined: Wed Aug 23, 2023 11:27 am

Re: nagiosadmin script does not work

Post by jsimon »

It sounds like something is going wrong with the data index containing your NLS login credentials. These are stored inside an index in your data, and moving the data source seems to have caused an issue with your server knowing where the login creds are. If you want to import data from an old node to a new one, our recommendation would be to follow the instructions at the end of my previous post and merge the new node into the old one to make a two node cluster, wait for the data to sync, and then remove the old node so you have a one node cluster again.

That being said, given that you have a data source and not an active NLS node, this may not be the solution to your current issue -- if your old data source contains an NLS index from your previous server, it may conflict with the new one from the new server. Given the complexity involved in diagnosing the full issue, I think the next best step would be for you to open a case with Nagios Support.

https://answerhub.nagios.com/support/s/
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

Re: nagiosadmin script does not work

Post by riahc3 »

I believe this is a bug because if the index is read from the new location, why dont the credentials work anymore? Or even reset them?
jsimon
Posts: 106
Joined: Wed Aug 23, 2023 11:27 am

Re: nagiosadmin script does not work

Post by jsimon »

I don't believe we have enough information to diagnose the issue at this point. I would recommend again that your next step should be to contact Nagios Support and open a case. A more in-depth investigation into the status of your Log Server should be able to determine if the issue is with the steps you are taking or with the password repair script, or some other part of the process.

https://answerhub.nagios.com/support/s/
Post Reply