Hello Shinken users,
I have to monitor some equipments behind NAT so I thought about using a distant Nagios server that would send infos through NSCA. I already have a Shinken server working fine on Debian 8 and the distant Nagios is also working on Debian 8.
I installed the nsca module on my Shinken server and added it to the receiver.cfg, then I restarted shinken and ran into :
Code:
2016-04-21 09:32:15,215 [1461223935] Error : [receiver-1] The module nsca raised an exception _log() takes at most 6 arguments (11 given), I remove it!
2016-04-21 09:32:15,215 [1461223935] Error : [receiver-1] Back trace of this remove: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/shinken/modulesmanager.py", line 191, in get_instances
inst = module.get_instance(mod_conf)
File "/usr/share/pyshared/shinken/modules/nsca/module.py", line 84, in get_instance
backlog)
File "/usr/share/pyshared/shinken/modules/nsca/module.py", line 103, in __init__
logger.info("[NSCA] configuration, allowed hosts : '%s'(%s), buffer length: %s, payload length: %s, encryption: %s, max packet age: %s, check future packet: %s, backlog: %d", self.host, self.port, self.buffer_length, self.payload_length, self.encryption_method, self.max_packet_age, self.check_future_packet, self.backlog)
File "/usr/lib/python2.7/dist-packages/shinken/log.py", line 123, in info
self._log(logging.INFO, msg, *args, **kwargs)
TypeError: _log() takes at most 6 arguments (11 given)
I didn't search long and just changed the logger.info line :
Code:
#logger.info("[NSCA] configuration, allowed hosts : '%s'(%s), buffer length: %s, payload length: %s, encryption: %s, max packet age: %s, check future packet: %s, backlog: %d", self.host, self.port, self.buffer_length, self.payload_length, self.encryption_method, self.max_packet_age, self.check_future_packet, self.backlog)
logger.info("[NSCA] configuration, allowed hosts : '%s'(%s), encryption: %s", self.host, self.port, self.encryption_method)
Then it started well and listened on 5667. I configured my distant Nagios server to send notifications using NSCA :
Code:
define command {
command_name notify-service-by-nsca
command_line /usr/bin/printf "%s\t%s\t%s\t%s\n" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICESTATEID$" "$SERVICEOUTPUT$|$SERVICEPERFDATA$" | tee -a /tmp/service_alert.log | /usr/sbin/send_nsca -H $CONTACTADDRESS1$ -c /etc/nagios/send_nsca.cfg
}
define command {
command_name notify-host-by-nsca
command_line /usr/bin/printf "%s\t%s\t%s\n" "$HOSTNAME$" "$HOSTSTATEID$" "$HOSTOUTPUT$" | /usr/sbin/send_nsca -H $CONTACTADDRESS1$ -c /etc/nagios/send_nsca.cfg
}
And I configured my only contact to use those commands :
Code:
define contact {
contact_name root
...
service_notification_commands notify-service-by-nsca
host_notification_commands notify-host-by-nsca
}
I checked and when a notification is triggered, it's properly sent to the Shinken server. Now, every time nsca received a notification, I get that error :
Code:
2016-04-21 11:37:49,262 [1461231469] Error : [receiver-1] The external module nsca goes down unexpectedly!
2016-04-21 11:47:48,569 [1461232068] Error : [receiver-1] The external module nsca goes down unexpectedly!
Would you have any idea why it happens? Same question ( but less urgent ) for the first logger.info error.
Thanks
Best regards