File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 11* .pyc
22* .egg-info
3+ * .swp
34__pycache__
45
56tags
Original file line number Diff line number Diff line change 66import struct
77import socket
88import json
9+ import logging
910
1011import mamonsu .lib .platform as platform
1112from 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
You can’t perform that action at this time.
0 commit comments