Open-Future-Belgium / zabbix-papercut

Papercut Script For Zabbix 3.2
6 stars 13 forks source link

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

Open maxlehot1234 opened 5 years ago

maxlehot1234 commented 5 years ago

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 commented 5 years ago

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

Trikke76 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

maxlehot1234 commented 5 years ago

@Trikke76 wget what?

You mean update the zabbix server?

Trikke76 commented 5 years ago

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 commented 5 years ago

@Trikke76 It works great without any error

Joffcom commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

I already try with = and same problem

Do I need = only in the template or in the host too?

Thanks again for your time 

Envoyé par myMail pour iOS

lundi 3 décembre 2018 03:47 -0500 de notifications@github.com notifications@github.com:

@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. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

Joffcom commented 5 years ago

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

maxlehot1234 commented 5 years ago

@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 commented 5 years ago

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

maxlehot1234 commented 5 years ago

Same error.

I will test your template later today to see if it fixed the problem I have

Envoyé par myMail pour iOS

lundi 3 décembre 2018 08:14 -0500 de notifications@github.com notifications@github.com:

Do you get the same error or is it a 500 this time? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

Trikke76 commented 5 years ago

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 commented 5 years ago

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

cawolkart commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

In my case wget works normally

cawolkart commented 3 years ago

image

cawolkart commented 3 years ago

image

cawolkart commented 3 years ago

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

cawolkart commented 3 years ago

image

Joffcom commented 3 years ago

@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 commented 3 years ago

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

Trikke76 commented 3 years ago

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 commented 3 years ago

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?