Ad Widget

Collapse

Can I collect multiple values on a single ssh check?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abjornson
    Member
    • Oct 2013
    • 34

    #1

    Can I collect multiple values on a single ssh check?

    Hello,

    I love the simplicity of ssh checks. I have some wireless radios which report some data by SNMP, but there are a few key datapoints that I can only get via ssh.

    I have individual ssh checks written for each or 5 items on a test node, and I'm about to roll this out to my whole network.

    I was wondering, though, if there's any way to collect multiple values during the same SSH session. It seems silly to do all the setup and teardown work 5 times every 5 minutes on every node...when I could just as easily open one ssh command, run 5 commands, and capture the output of each.

    Any ideas?

    Thanks!
  • abjornson
    Member
    • Oct 2013
    • 34

    #2
    Bump

    Has anyone found a way to collect multiple data points on a single ssh login? It seems like this would be a common need?

    Thanks!

    Comment

    • steveboyson
      Senior Member
      • Jul 2013
      • 582

      #3
      Write a script that performs the SSH check, collects the values and sends these via zabbix_sender one by one to your zabbix host items.

      aka:
      RES=`ssh your.ip.add.res GetMyMultiValues`

      for i in `echo RES`; do
      zabbix_sender -z <zabbix_host> -s <zabbix-host-target> -k your_key -o ${i}
      done

      (untested)

      Comment

      • abjornson
        Member
        • Oct 2013
        • 34

        #4
        Thanks Steve,

        I did not know about zabbix_sender, that's helpful.

        I think that this would be called an external check in zabbix terminology, is that right?

        I neglected to mention that I'm trying to do this through a zabbix proxy, but it does seem like external checks should work through a proxy as long as I put them on the proxy rather than on the zabbix server.

        I see the warning on the external checks page that "Do not overuse external checks! It can decrease performance of the Zabbix system a lot."

        I wonder if I'm collecting 4 datapoints from 100 nodes every 5 minutes what is more intensive:
        • 4 separate ssh sessions to each host every 5 minutes to gather one data point each
        • 100 external checks every 5 minutes generate one ssh session to gather 4 data points each check


        Thanks!

        Comment

        • steveboyson
          Senior Member
          • Jul 2013
          • 582

          #5
          An external check is executed on the zabbix server (or proxy). Just place it in the correct directory as specified in the conf.

          When you make a "UserParameter=" key in your agents conf file you can also reference scripts. These are then executed on the agent itself.

          See the docs for more info.

          I would assume that 4 ssh checks which collect 100 values each are less performance consuming.
          Or give us detailed infos on what, when, how and how often ;-)

          Comment

          • abjornson
            Member
            • Oct 2013
            • 34

            #6
            I'll have to use external checks, these hosts are just wireless radios with no ability to install the zabbix agent on them.

            Given the performance warning about lots of external checks, I think I may just try rolling out the individual ssh checks and see how that goes.

            Comment

            • steveboyson
              Senior Member
              • Jul 2013
              • 582

              #7
              External checks make sense if you create dummy entries for your SNMP devices with a zabbix interface of 127.0.0.x
              Then the collected item data are bound to your "non zabbix"-device while the real checks run against the zabbix_server (or proxy).

              On the other hand: if you use ssh with zabbix_sender it makes no difference where the ssh script runs. It can be any machine since these items are "trapper" items and ca be "feeded" by any host you allow.

              You could even schedule your ssh checks via crontab on ANY system and let that system send the collected data via zabbix_sender.

              Comment

              Working...