Hi all,
I'm trying to figure out how to run a command on a device and then store the output of the command in a variable. Specifically, I want to do the following:
1. Log into an F5
2. Execute the command "b failover unit show"
* If the output is "FAILOVER - Failover Unit Id: 1" then continue, else stop
3. Execute the command "grep -c 'HA Connection with peer.*lost' /var/log/ltm"
* If the output is "0" then continue, else stop
4. If steps 2 and 3 pass then I'll have the script execute a few tasks
The problem is, I don't know how to take the output of something on a terminal and store it as a variable. Is that something that's possible? If so, can someone point me in the right direction? I've been searching the manual and the forums and haven't gotten anywhere so far.
P.S. - I know this would probably be a lot easier to just do as a script on the F5s themselves, but I'm trying to keep all the network configuration centralized on NCM. Using NCM also makes it a lot easier for reporting, auditing, etc.
Thanks,
Josh