Ad Widget

Collapse

How can I parse a remote command (ssh) and create elements.

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • greg35
    Junior Member
    • Jun 2024
    • 5

    #1

    How can I parse a remote command (ssh) and create elements.

    Hi Everyone,

    I need to check a network device (Cisco), by ssh, and parse some results to create some items.
    I don't know how can I do that.
    My goal : to monitor peering BGP by VRF (up or down). The exisiting template it's not enough for my needs. So, I must check by ssh (sh bgp vrf all summary) and parse differents peers.
    Have you an idea ? I checked the documentation but I didn't find

    Thanks a lot

    Greg
  • Answer selected by greg35 at 26-06-2024, 10:16.
    Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781



    The item of type "SSH agent" will return textual data by default, but you can use preprocessing rules to extract the specific data you are looking for. Or, you can use "show bgp vrf all summary" output as a master item and then create several dependent items for parsing different BGP sessions.

    For BGP session monitoring, however, I personally would investigate using an HTTPS API or even SNMP to query the BGP session information, instead of using the (slow) SSH connections.

    Markku

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #2


      The item of type "SSH agent" will return textual data by default, but you can use preprocessing rules to extract the specific data you are looking for. Or, you can use "show bgp vrf all summary" output as a master item and then create several dependent items for parsing different BGP sessions.

      For BGP session monitoring, however, I personally would investigate using an HTTPS API or even SNMP to query the BGP session information, instead of using the (slow) SSH connections.

      Markku

      Comment

      • greg35
        Junior Member
        • Jun 2024
        • 5

        #3
        Hi Markku,
        Thanks, I'll try 'use "show bgp vrf all summary" output as a master item and then create several dependent items for parsing different BGP sessions'
        We can't use SNMP because we need to create "contexts" snmp and we haven't rights to do that, just read right on devices.
        Stay tuned !
        Greg

        Comment

        • greg35
          Junior Member
          • Jun 2024
          • 5

          #4
          So, I have to parse "my text" by JavaScript, and return somes values ${IP} -> ${STATUS}, to create several depends items ?
          I 'll try.

          Comment

          • greg35
            Junior Member
            • Jun 2024
            • 5

            #5
            No, it doesn't works... I would like create dynamically dependent items by peering VRF but with JavaScript parsing, I have return just one value, so I don't know how can I do my needs

            Comment

            • Markku
              Senior Member
              Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
              • Sep 2018
              • 1781

              #6
              https://www.zabbix.com/documentation...y/custom_rules has some examples of LLD JSON output that gives you idea how to format the discovery rule output.

              Markku

              Comment

              • greg35
                Junior Member
                • Jun 2024
                • 5

                #7
                Thanks Markku, it's a success !
                I can now parse (with pre processing JavaScript) my command result and create some elements (via an item prototype).
                Thanks !
                Greg

                Comment

                Working...