0

I have made an external script (snmp_max_io written in Perl). When run with and IP-address, it logs input to syslog and it prints a single 64-bit numeric value and set the exit value to 0.

Example output:

916418801

I have added it in /usr/lib/zabbix/externalscripts where I have a different script, that works.

I have configured an item:

  • Type: External check
  • Key: snmp_max_io["{HOST.CONN}"]
  • Host interface: i.p.n.r 10050
  • Type of information: Numeric
  • Data type: decimal
  • Units: b

After a while Zabbix changes the status to: 'Not supported' and "Received value [] is not numeric".

The command works fine when run on the command line as root or as zabbix.

But the command is never run by the zabbix server (nothing is logged).

How do I find out why Zabbix thinks the command returns [] while it clearly never runs it?

The solution is in the comments: The script MUST be a bash script. So a perl-script must have a bash wrapper.

Ole Tange
  • 2,946
  • 6
  • 32
  • 47

1 Answers1

1

Do you have SELinux enabled in your server? I've bitten by it several times in the similar situations while using Zabbix.

If getenforce returns enabled for you, then it's time to see /var/log/audit directory logs and see what particularly prevents Zabbix running the script.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • Good guess, but no: getenforce is Disabled. Also it would not explain why the other script works (this other script is a discover script). – Ole Tange Sep 30 '14 at 11:15
  • And your script does not return any other output than the numeric value? No strange empty lines or anything like that? – Janne Pikkarainen Sep 30 '14 at 11:18
  • Correct: A single line with a single 64-bit integer followed by a single \n. – Ole Tange Sep 30 '14 at 11:21
  • How about `stat yourworkingscript yournonworking script` and `getfacl yourworkingscript yournonworkingscript` to see the possible differences in file permissions? I know I'm asking the obvious things, but sometimes they can be the reason. :) – Janne Pikkarainen Sep 30 '14 at 11:24
  • If I su - zabbix, I can run the command no problem. – Ole Tange Sep 30 '14 at 11:29
  • Only difference I can see, is that the working is using bash, and the non-working is written in perl. – Ole Tange Sep 30 '14 at 11:34
  • 2
    Zabbix documentation says `Standard error and exit codes are discarded. In case the requested script is not found or Zabbix server has no permissions to run it, item will be marked as ZBX_NOTSUPPORTED and an according error message will be returned.` Perl itself should not be a problem and I assume your script starts with the standard `#!/usr/bin/perl` – Janne Pikkarainen Sep 30 '14 at 11:35
  • But Perl itself WAS the problem: I wrote a one-line wrapper in bash that simply executed the Perl script and then everything worked! – Ole Tange Sep 30 '14 at 12:54