shinken-monitoring / mod-nsca

Shinken module for listening exteranl commands from a NSCA like daemon
GNU Affero General Public License v3.0
1 stars 2 forks source link

Fatal error when message not well formated #7

Open ddurieux opened 9 years ago

ddurieux commented 9 years ago
[nsca] Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Shinken-2.4_rc4-py2.7.egg/shinken/basemodule.py", line 164, in start_module
    self._main()
  File "/usr/local/lib/python2.7/site-packages/Shinken-2.4_rc4-py2.7.egg/shinken/basemodule.py", line 296, in _main
    self.main()
  File "/usr/local/libexec/shinken/modules/nsca/module.py", line 213, in main
    self.process_check_result(databuffer[s], IVs[s])
  File "/usr/local/libexec/shinken/modules/nsca/module.py", line 164, in process_check_result
    (timestamp, rc, hostname, service, output) = self.read_check_result(databuffer, IV, payload_length)
  File "/usr/local/libexec/shinken/modules/nsca/module.py", line 136, in read_check_result
    struct.unpack(unpackFormat, data)
error: bad char in struct format
mohierf commented 9 years ago

Should try to catch the exception to avoid module break ... and to make a log of the bad message ?

ddurieux commented 9 years ago

It's difficult to log the bad message because this error mean the unpack binary message failed

mohierf commented 9 years ago

Should log byte per byte ?

ddurieux commented 9 years ago

Possible, but it's a very long chain and in binary, andvery hard to unpack if you don't have the pack string