Ad Widget

Collapse

Running multiple "show" commands for SSH Agent item type against a Router

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sb195c@att.com
    Member
    • Oct 2017
    • 41

    #1

    Running multiple "show" commands for SSH Agent item type against a Router

    I'm trying to run multiple show commands via the SSH Agent item type against a router (Cisco, Juniper, etc.). Per the documentation I am putting multiple commands in the External scripts box, each on a new line. However when Zabbix tries to run the commands on the host, it seems like it's sending all the commands at once and I'm getting back syntax errors as output. Almost seems like it's not sending a line feed correctly? When I look in the database I'm seeing there are CRLF characters after each line, but the router is seeing it as one long line?
    When i send a single command it works. When i send more than one it does not.

    Ex.
    term length 0
    show running-config
  • sb195c@att.com
    Member
    • Oct 2017
    • 41

    #2
    To me it looks like it's trying to do the equivalent of this if you were on the cli of a linux machine trying to send multiple ssh commands as a "one liner"

    user@host:~$ ssh [email protected] 'term len 0
    > show run'

    results in
    "Syntax error while parsing 'term len 0
    show run'

    Cmd exec error."


    Instead of ssh to the device, get a connection, send command and wait for output. then send another command and wait for output. then terminating the connection

    Comment

    • sb195c@att.com
      Member
      • Oct 2017
      • 41

      #3
      After digging into this Zabbix is sending the commands in a single ssh exec channel. Unfortunately most routers don't support that, it will receive it all as a single command and syntax error.

      Comment

      Working...