Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] I got error 401 and required status code 200 #4

Open
maxlehot1234 opened this issue Dec 1, 2018 · 28 comments
Open

[Issue] I got error 401 and required status code 200 #4

maxlehot1234 opened this issue Dec 1, 2018 · 28 comments

Comments

@maxlehot1234
Copy link

Hi, After following the guide and everything, I got this error in zabbix:

response code "401" did not match any of the required status codes "200"

It was able to reach the papercut server, but it returned this error.

If I test the
http://xxx.xxx.xxx.xxx:9191/api/health?Authorization=R79SAqDpstNwlxxxxxxxxxxxOtwIlIWrIYb
on a web browser, it works great.

If you have an idea, let me know.

Thanks again and have a nice day/night

@maxlehot1234
Copy link
Author

@Trikke76 Let me know if you have an idea ;)

@Trikke76
Copy link
Collaborator

Trikke76 commented Dec 2, 2018

check if host macros are correct
and if web monitoring is properly configured
can be many things

best way to check is to open de log file on the zabbix server as webmonitoring is done from the zabbix server. Maybe increase the logging for web monitoring.

@maxlehot1234
Copy link
Author

@Trikke76
Thanks and I just check zabbix server log and I see this:

Message from xxx.xxx.xxx.xxx is missing header. Message ignored.

Zabbix agentr can be joined by zabbix, but papercut script doesn't work since zabbix was not able to "contact" papercut I think

@Trikke76
Copy link
Collaborator

Trikke76 commented Dec 2, 2018

thats probably the issue
you can check it by running wget
from the zabbix server

@maxlehot1234
Copy link
Author

@Trikke76 wget what?

You mean update the zabbix server?

@Trikke76
Copy link
Collaborator

Trikke76 commented Dec 2, 2018

wget http://xxx.xxx.xxx.xxx:9191/api/health?Authorization=R79SAqDpstNwlxxxxxxxxxxxOtwIlIWrIYb
from the zabbix server to see if it can access the web site as zabbix webmonitoring is done from the zabbix server or proxy

@maxlehot1234
Copy link
Author

@Trikke76
It works great without any error

@Joffcom
Copy link
Contributor

Joffcom commented Dec 3, 2018

The 401 error means it isn’t authorised (wrong or no credentials) make sure you have changed the authorisation macro and set the key to yours that should get you up and running.

@Trikke76
Copy link
Collaborator

Trikke76 commented Dec 3, 2018

@maxlehot1234
if the wget works then communication between zabbix server and papercut server is fine
then check credentials again like mentioned by @Joffcom or check the zabbix server log to see what url is been used. probably there is a typo like whitespace, extra / etc..

@Joffcom
Copy link
Contributor

Joffcom commented Dec 3, 2018

@maxlehot1234 I just took a look on my setup and the template is wrong, The web status check uses the Authorization Macro but expects you to put in Authorization:YOUR_API_KEY which isn't how the web check URL works.

Go to your host and change the Macro to Authorization=YOUR_API_KEY instead and you should be all good.

@maxlehot1234
Copy link
Author

maxlehot1234 commented Dec 3, 2018 via email

@Joffcom
Copy link
Contributor

Joffcom commented Dec 3, 2018

@maxlehot1234 If you add it to your macro on the host it should take care of it for you.

@maxlehot1234
Copy link
Author

@Trikke76 I just change it in the macro of the host and I get the same error :(

I just change it in the template to and I switch from = to : and same error occured

@Joffcom
Copy link
Contributor

Joffcom commented Dec 3, 2018

Do you get the same error or is it a 500 this time?

@maxlehot1234
Copy link
Author

maxlehot1234 commented Dec 3, 2018 via email

@Trikke76
Copy link
Collaborator

Trikke76 commented Dec 4, 2018

Is the problem fixed with this template @maxlehot1234
if not i suggest you open zabbix server log
and increase log for web and check what kind of url zabbix tries to reach to see where the issue is.

@Joffcom
Copy link
Contributor

Joffcom commented Dec 5, 2018

@Trikke76 you should be able to use demo.papercut.com to test the http status or grab a free trial

@cawolkart
Copy link

Good Morning!
I had the problem similar to our friend above and the problem was just the authorization key, but after correcting I'm having error 500, does anyone know how to solve this problem?
response code "500" did not match any of the required status codes "200"

@Trikke76
Copy link
Collaborator

Trikke76 commented Mar 9, 2021

i dont use papercut i made this as a test case
but a wget http://xxx.xxx.xxx.xxx:9191/api/health?Authorization=R79SAqDpstNwlxxxxxxxxxxxOtwIlIWrIYb where you replace ip and auth token should work or a curl maybe even more usefull if this doesnt work then the problem is on your papercut server where the api is not accessible maybe firewall related ?

@cawolkart
Copy link

In my case wget works normally

@cawolkart
Copy link

image

@cawolkart
Copy link

image

@cawolkart
Copy link

using wget or curl it is connecting normally, at least that's what it looks like

@cawolkart
Copy link

image

@Joffcom
Copy link
Contributor

Joffcom commented Mar 9, 2021

@cawolkart I will check one of my test instances in the morning for you. I did an install for a customer of ours a few weeks back and it seemed to work.

@cawolkart
Copy link

I will be very grateful for the help, thank you!

@Trikke76
Copy link
Collaborator

are you sure that both macros are correctly set as described in the guide ?https://www.papercut.com/kb/Main/SystemHealthZabbix#step-6-configure-papercut-ng-or-mf-host-macros

since curl works from the zabbix server it should work as zabbix basically does the same

@Joffcom
Copy link
Contributor

Joffcom commented Mar 11, 2021

Done a bit of testing it seems to be ok with 20.1.2, 20.1.3 and the soon to be released 21.0.

It looks like it could be a config error somewhere, it has been a while since I have had to troubleshoot Zabbix but does it have a log somewhere that might contain something useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants