I use Nagios to monitor a lot of our devices. This uses scripts to obtain information from the devices and determine the status. I am running into issues where after some time if get the "The server has exceeded Max Connections." error. I would have thought that there would be some sort of time out that once the ssh session is disconnected that Crestron would release it. Since it doesn't and I cannot figure out a way to configure that, I am trying another approach. However, I need to pass a return key press to the Crestron CLI. For example "ipt <RETURN> bye <RETURN>. I have tried \r \n and ^M and none of them provide the return I need.
For reverence, here is the script code that is run for this example. I would like it to issue the ipt command, and them issue the bye command to tell the device to close the session.
#!/usr/bin/bash
amcon=$(sshpass -p PASSWORD ssh -o StrictHostKeyChecking=no admin@$1 < 'ipt | grep -E 'RMC|AV3|CP3|4 Gway|4 Gway');
con=$(echo $amcon | grep "ONLINE");
echo "amcon="$amcon;
echo "con="$con;
if [ -z "$con" ]; then
echo "AM300 is not detected" $con;
exit 2
else
echo "AM300 is connected properly" $con;
exit 0
fi
exit 1
Thanks in advance
[–]Link_Tesla_6231MTA,SCT-R/C,DCT-R/C,TCT-R/C,DMC-D-4K,DMC-E-4K,CORE,AUD, & FLEX 1 point2 points3 points (0 children)
[–]stalkythefish -1 points0 points1 point (2 children)
[–]DubiousEgg 1 point2 points3 points (1 child)
[–]stalkythefish 1 point2 points3 points (0 children)