Skip to content

Commit fb1ea30

Browse files
committed
Merge pull request #8 from vadv/master
more info from zabbix
2 parents 11d7c53 + 902f24c commit fb1ea30

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.pyc
22
*.egg-info
3+
*.swp
34
__pycache__
45

56
tags

mamonsu/lib/zbx.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import struct
77
import socket
88
import json
9+
import logging
910

1011
import mamonsu.lib.platform as platform
1112
from mamonsu.lib.plugin import Plugin
@@ -25,6 +26,8 @@ def __init__(self, config):
2526
self.max_queue_size = config.fetch('sender', 'queue', int)
2627
self.fqdn = config.fetch('zabbix', 'client')
2728
self.queue = Queue()
29+
self.log = logging.getLogger(
30+
'ZBX-{0}:{1}'.format(self.host, self.port))
2831

2932
def json(self, val):
3033
return json.dumps(val)
@@ -75,6 +78,10 @@ def _send_data(self, data):
7578
resp_body_len = struct.unpack('<Q', resp_header[5:])[0]
7679
resp_body = self._receive(sock, resp_body_len)
7780
self.log.debug('response: {0}'.format(resp_body))
81+
if 'failed: 0' not in str(resp_body):
82+
self.log.error(
83+
'Response from server'
84+
' with failed items: {0}'.format(resp_body))
7885
finally:
7986
sock.close()
8087

0 commit comments

Comments
 (0)