Open-Future-Belgium / zabbix-papercut

Papercut Script For Zabbix 3.2
6 stars 13 forks source link

No data from Agent #6

Closed Uzzi closed 4 years ago

Uzzi commented 4 years ago

Get value from agent failed: cannot connect to [[172.16.6.69]:9191]: [111] Connection refused

and on Linux Papercut server: `python papercut.py --verbose

Traceback (most recent call last): File "papercut.py", line 20, in response = urllib.urlopen(url) File "/usr/lib/python2.7/urllib.py", line 87, in urlopen return opener.open(url) File "/usr/lib/python2.7/urllib.py", line 213, in open return getattr(self, name)(url) File "/usr/lib/python2.7/urllib.py", line 350, in open_http h.endheaders(data) File "/usr/lib/python2.7/httplib.py", line 1035, in endheaders self._send_output(message_body) File "/usr/lib/python2.7/httplib.py", line 879, in _send_output self.send(msg) File "/usr/lib/python2.7/httplib.py", line 841, in send self.connect() File "/usr/lib/python2.7/httplib.py", line 822, in connect self.timeout, self.source_address) File "/usr/lib/python2.7/socket.py", line 571, in create_connection raise err IOError: [Errno socket error] [Errno 110] Connection timed out`

And this is zabbix_agent.log: 29876:20191001:122404.292 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused) 29876:20191001:122404.292 End of refresh_active_checks():FAIL

Trikke76 commented 4 years ago

Get value from agent failed: cannot connect to [[172.16.6.69]:9191]: [111] Connection refused

seems you have no access probably wrong user/psw or ip ?

Trikke76 commented 4 years ago

for the 127.0.0.0 you need to update papercut.conf

Uzzi commented 4 years ago

this is python papercut.py output: Traceback (most recent call last): File "papercut.py", line 20, in <module> response = urllib.urlopen(url) File "/usr/lib/python2.7/urllib.py", line 87, in urlopen return opener.open(url) File "/usr/lib/python2.7/urllib.py", line 213, in open return getattr(self, name)(url) File "/usr/lib/python2.7/urllib.py", line 364, in open_http return self.http_error(url, fp, errcode, errmsg, headers) File "/usr/lib/python2.7/urllib.py", line 377, in http_error result = method(url, fp, errcode, errmsg, headers) File "/usr/lib/python2.7/urllib.py", line 689, in http_error_401 errcode, errmsg, headers) File "/usr/lib/python2.7/urllib.py", line 386, in http_error_default raise IOError, ('http error', errcode, errmsg, headers) IOError: ('http error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x7f0d32ffe128>)

Joffcom commented 4 years ago

Can you check your auth token in the config file to make sure it matches the setting in PaperCut.

Uzzi commented 4 years ago

wget http://127.0.0.1:9191/api/health?Authorization=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwget http://externalip:9191/api/health?Authorization=A8NoDnKPH6esUlR2BJxLA8p7cQ7yKEMC

Works fine above

Joffcom commented 4 years ago

Have you checked in the server.log of PaperCut to see if it shows anything else? You are getting a 401 response back from the server which normally means the auth token is wrong but the log file should say if there was anything else going on.

Uzzi commented 4 years ago

In server.log no entries about agent. This is zabbix_agent.log: 18910:20191002:091214.991 In refresh_active_checks() host:'127.0.0.1' port:10051 18910:20191002:091214.991 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused) 18910:20191002:091214.991 End of refresh_active_checks():FAIL

Trikke76 commented 4 years ago

are you sure the quotes '' are still in your config file and that there is no error in your auth string

Trikke76 commented 4 years ago

In server.log no entries about agent. This is zabbix_agent.log: 18910:20191002:091214.991 In refresh_active_checks() host:'127.0.0.1' port:10051 18910:20191002:091214.991 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused) 18910:20191002:091214.991 End of refresh_active_checks():FAIL

that is your zabbix agent not able to connect in active mode to the zabbix server

Uzzi commented 4 years ago

papercut.conf: papercut_ip="IP:9191" papercut_auth="Authorizationxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Trikke76 commented 4 years ago

papercut_auth='Authorization=oFxc5nFBKBAkqb8MAg98HFGZlovFVpXG' are you sure you have not forgotten the =

Uzzi commented 4 years ago

O my god now python -v papercut.py works fine Now I've to solve zabbix_agent problem. Is it right: Server=127.0.0.1 ServerActive=127.0.0.1 in Papercut Server Agent

Trikke76 commented 4 years ago

glad you fixed it.

i normaly never use the loopback interface and always use the ip this ip is the ip of the zabbix server btw so loopback can work if your agent is on the zabbix server.

Also the hostname in the zabbix agent file should match exact with the hostname in the zabbix frontend

there are some excelent trainings that you can follow that will certainly help you with zabbix setup and configuration https://www.zabbix.com/training

Uzzi commented 4 years ago

Thank You Works Fine!!!!