Icinga plugin state UNKNOWN after upgrade

I was updating the monitoring setup at work the other day and suddenly got hit by a few State: UNKNOWN - **ePN /usr/lib/nagios/plugins/check_rbl: plugin did not call exit() messages.

When the plugin was executed outside of Icinga it worked fine, online searches revealed nothing of use, I spent ages trying to adjust the config file and check command for the plugin but with no success.

Eventually I was able to track it down to the embedded Perl interpreter used by Icinga. The solution was fairly simple I just had to add nagios: -epn as a comment within the first 10 lines of the script. This told Nagios to use an external Perl interpreter when running this plugin.

This solution should apply to anything based on Nagios by the way: Icinga, Shinken, Centreon-Engine, Opsview, etc.