Ad Widget

Collapse

"Not supported by Zabbix Agent"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mork
    Junior Member
    • Jun 2016
    • 8

    #1

    "Not supported by Zabbix Agent"

    Apologies if this is a stupid question: I did a lot of googling and reading docs before coming here.

    I have a script on a server that checks a log file to see if a task ran succesfully. If it did, the script returns 1, if not it returns 0. The item is showing as Not supported by Zabbix Agent

    I have it set up as an item on Zabbix using with system.run[usr/bin/logcheck/logcheck.sh ] as the key and Zabbix Agent as the Type

    The zabbix_agentd.conf file on the host has EnableRemoteCommands=1 and AllowRoot=1. The script is executable and works fine using ./logcheck.sh from the command line.

    The script will not return an empty value.


    I cannot figure out why this is happening. Any help would be greatly appreciated.

    I am running zabbix 2.2.9 on Ubunutu 14.0.1

    EDIT: I have found the solution, please see below.
    Last edited by mork; 07-06-2016, 17:46. Reason: found solution
  • zabx_ks
    Member
    • May 2016
    • 48

    #2
    Hi Mork,

    Have you tried item for log file monitoring? Maybe it would be better option for you in this case + trigger.

    Type - Zabbix Agent (active)
    key - log[file,<regexp>,<encoding>,<maxlines>,<mode>,<output >]
    (example: log[/var/log/zabbix/zabbix_server.log,stopped])
    Type of information - log

    Also there is a topic on documentation:


    zabx_ks
    Last edited by zabx_ks; 07-06-2016, 15:05. Reason: wrong link to documentation

    Comment

    • lordeldor
      Junior Member
      • Jun 2016
      • 8

      #3
      The best way to troubleshoot external scripts is to use the zabbix_get command from a zabbix server or proxy. If you don't already have it installed "apt-get install zabbix-get" should install it for you.

      To test your command it would be something like:
      zabbix_get -s %IP% -k system.run[usr/bin/logcheck/logcheck.sh]

      That should hopefully give you more detail than just "Not supported".

      If I had to guess there might be a few things going on here.

      First your system.run command appears to be missing the leading /.

      Second, you may need to enable remote commands on the agent side with the following setting in the zabbix_agent.conf:
      EnableRemoteCommands=1

      However enabling the execution of arbitrary commands could be considered bad security. So instead of that I would recommend creating a custom user parameter that is designed to only execute that script.

      To do this you could put something like this into a zabbix_agent.d/userparameter_logcheck.conf:
      UserParameter=custom.logcheck,(test -f /usr/bin/logcheck/logcheck.sh && /usr/bin/logcheck/logcheck.sh)

      All this does different is create a custom key called "custom.logcheck". That key executes two commands. First the test command makes sure that the logcheck.sh script exists. Then the logcheck.sh script is executed. This is the way the out of box mysql user parameters are written.

      Then you would setup your zabbix item with the following key:
      custom.logcheck

      Comment

      • mork
        Junior Member
        • Jun 2016
        • 8

        #4
        Solved

        Hey guys,

        Thanks for the replies but I managed to get it working myself. It was a peculiar problem that I do not think could be solved by changing the item config.

        Here is the solution I found:

        I checked the agentd.conf file to find the location of the log file on the monitored host. After using tail -f -n50 zabbix_agentd.log I found the following info in the log:

        usr/bin/logcheck/logcheck.sh: 7: usr/bin/logcheck/logcheck.sh: function: not found
        usr/bin/logcheck/logcheck.sh: 26: usr/bin/logcheck/logcheck.sh: Syntax error: "}" unexpected

        I had defined my function as:

        function runCheck {}

        It seems the function keyword is a feature of bash and not fully POSIX compliant. Zabbix must have been using some shell other than bash to execute the script and as a result was halting at the function keyword. Instead I had to use the following syntax

        runcheck () {}

        This SO article has more information: http://stackoverflow.com/questions/1...ld-this-appear

        Comment

        Working...