Ad Widget

Collapse

Custom UserParameter returns not supported

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itvet
    Member
    • Jul 2010
    • 31

    #1

    Custom UserParameter returns not supported

    I am trying to monitor some custom commands in my zabbix server. inside the config file I have the line

    UserParameter=asterisk304,asterisk -rx "sip show peer 304" | grep "Status"

    however when I add the zabbix agent key "asterisk304" into zabbix, I get a status of not supported, with an error message of "not supported by the zabbix agent".
    what am I doing wrong?
  • xibbaz
    Member
    Zabbix Certified Specialist
    • Jun 2009
    • 74

    #2
    Probably that your UserParameter command is returning an empty string or maybe your datatype in the item is incompatible. Test it by doing telnet <host> 10050 and just type "asterisk304". Does it return a line contain "Status"? Is your Item of data type Character?

    Comment

    • itvet
      Member
      • Jul 2010
      • 31

      #3
      root@zabbix:~# telnet 172.16.4.101 10050
      Trying 172.16.4.101...
      Connected to 172.16.4.101.
      Escape character is '^]'.
      asterisk304
      ZBXDZBX_NOTSUPPORTEDConnection closed by foreign host.
      root@zabbix:~#

      Comment

      • xibbaz
        Member
        Zabbix Certified Specialist
        • Jun 2009
        • 74

        #4
        These things I will usually try to cut and paste the command from the user zabbix itself.

        Try as root:
        # su - zabbix
        # asterisk -rx "sip show peer 304" | grep "Status"

        Does it work?

        Comment

        • itvet
          Member
          • Jul 2010
          • 31

          #5
          this may be the problem;

          Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

          Comment

          • xibbaz
            Member
            Zabbix Certified Specialist
            • Jun 2009
            • 74

            #6
            So, there you go. It might be an environment problem (variables not set) or other. At least, I think you have a hint. When you succeed in making the command work as the user zabbix, it should then work when it is run by the agent. Good luck

            Comment

            • David K
              Junior Member
              • Feb 2020
              • 1

              #7
              Hello everyone!

              I solved this problem by adding a "zabbix" user to a group "asterisk", because without it zabbix user does not have permissions to run asterisk cli...
              command to add user zabbix to group asterisk:
              Code:
              usermod -a -G asterisk zabbix
              In my case (zabbix-agent version 4.4.x and centos 7) it works fine.
              Hope it will help someone oneday.
              Thanks!

              Comment

              Working...