recently we got Jump Host to interact with all our devices. It's red had 6.x and we have no root access. We can script on Autoexpect and bash only - no modules possible.
Source: I have 5000 devices (1 per line, 3 arguments each - Location HostName IP - and they are tab separated).
Task: Search for all devices per location (ARGV1) (say out 5000, 40 would be for one location), redirect the output to a temp file (no output, echo off) and run a command for each device in the temp directory. Output should be for HostName ARGV2 not IP.
Say ping each device in tmp and return success for each host, or log into each device, run command, output result for the host and move to the next in the tmp file.
Input file structure example:
AA Torp1 184.108.40.206 AA Torp2 220.127.116.11 BB Torp97 18.104.22.168
Say you want to ping each device from locaton AA.
How do I script the
cat hosts.txt | grep AA to tmp
and then ping each IP e.g.
22.214.171.124 and output is :
Torp1 OK if ping succeed Torp2 NOK if ping not ok
Its the basic example ....or say for each IP grepped based on location, ssh , run command print output and then remove the tmp file.