Interrogation Script (sample)
All scripts in this page are used with the ACME Humidifier 2140.
Initial Script
This script has no requirements (see "requires" in the configuration of it). It will be run for any device responding to SSH, whether it's the ACME Humidifier or not.
#! META name: ssh-show-version-for-humidifier description: run "show version" over SSH hoping to find the ACME Humidifier type: interrogation #! REMOTE::SSH show version #! PARSER::AWK BEGIN { } # Sample line from the output of "show version" on the ACME Humidifier: # This ACME Humidifier is running AOS 9.14.11 /ACME Humidifier/ { writeTag("vendor", "acme") writeTag("product", "humidifier") writeTag("os.name", "AOS") writeTag("os.version", $NF) # We get the last element in the line for the os version info } END { }
The result of running the above script on the ACME Humidifier is this:
TAG:vendor=acme TAG:product=humidifier TAG:os.name=AOS TAG:os.version=9.14.11
These tags are now associated with the device.
Followup Script
Now that we know it's the ACME Humidifier, we can run other commands and get more information.
#! META name: humidifier-show-model description: run "show model" over SSH on the ACME Humidifier type: interrogation requires: vendor: acme product: humidifier #! REMOTE::SSH show model #! PARSER::AWK BEGIN { } # Sample line from the output of "show model" on the ACME Humidifier: # Model name: ACME Humidifier 2140 /Model name/ { writeTag("model", $NF) } # Serial number: ACMEHUM2140AHO0519661 /Serial number/ { writeTag("serial", $NF) } END { }
The result of running the above script on the ACME Humidifier is this:
TAG:model=2140 TAG:serial=ACMEHUM2140AHO0519661
These tags will also now be associated with the device.