Ad Widget

Collapse

Run SSH command on Cisco Router and record value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahahum
    Member
    • Jan 2009
    • 79

    #1

    Run SSH command on Cisco Router and record value

    I'm looking to see if it is possible to run a SSH command on a Cisco router and record that value in the database.

    Specifically, I'm looking to run this command to determine which physical interface my VPN tunnel(s) are running on.

    Here is the command:
    sh run int t11 | inc tunnel source

    In our environment the tunnel source will be 1 of 2 interfaces and they failover automatically. I'd like to have a way to trigger on this.

    Any possibilities?

    Thanks everyone!
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    First of all, the Zabbix Item can be only number or line of text.
    Then, Zabbix triggers works very well with numerical Items but has a weird problem with textual Items

    So, if you can provide numerical value as a result of SSH script - it will be easy.
    Item type: ssh agent
    Executed script: sh run int t11 | inc tunnel source | (something to get only number 1 or number 2)

    If it's not possible - you can start thinking about External Scripts.
    Sincerely yours,
    Aleksey

    Comment

    • ahahum
      Member
      • Jan 2009
      • 79

      #3
      Originally posted by aib
      First of all, the Zabbix Item can be only number or line of text.
      Then, Zabbix triggers works very well with numerical Items but has a weird problem with textual Items

      So, if you can provide numerical value as a result of SSH script - it will be easy.
      Item type: ssh agent
      Executed script: sh run int t11 | inc tunnel source | (something to get only number 1 or number 2)

      If it's not possible - you can start thinking about External Scripts.
      Very nice, thanks for the tip - I forgot about that item type.

      The retruned value will be a string, so I think it will be an easy match on the trigger. I'll report back my final solution in case anyone else is interested.

      Comment

      • ahahum
        Member
        • Jan 2009
        • 79

        #4
        I was getting the info I needed, but then I started seeing my poller alert for usage over 75% and my queue became very deep.

        I disabled the new items and that didn't seem to resolve it. I was getting this logged in the zabbix_server.log file very often:
        ssh_run() cannot close generic session channel: Unable to send EOF on channel

        What does this mean? What can I do about this? Any ideas?

        Comment

        • garthvs
          Junior Member
          • Feb 2014
          • 3

          #5
          I am seeing similar log entries on our setup:

          3183:20140825:215748.322 ssh_run() cannot close generic session channel: Unable to send EOF on channel
          3197:20140825:215748.322 ssh_run() cannot close generic session channel: Unable to send EOF on channel


          I have just tried increasing the number of pollers and will try increasing the timeout if it still does not resolve it.

          Comment

          • ahahum
            Member
            • Jan 2009
            • 79

            #6
            Originally posted by garthvs
            I am seeing similar log entries on our setup:

            3183:20140825:215748.322 ssh_run() cannot close generic session channel: Unable to send EOF on channel
            3197:20140825:215748.322 ssh_run() cannot close generic session channel: Unable to send EOF on channel


            I have just tried increasing the number of pollers and will try increasing the timeout if it still does not resolve it.
            Let me know if that helps yours - I kinda abandoned this in my environment, but I'd still like to do it eventually as time permits.

            Comment

            • garthvs
              Junior Member
              • Feb 2014
              • 3

              #7
              I increased the number of pollers and it had the same problem today. I will try increase the timeout for each check.

              Comment

              Working...