Event-driven SSH script


Hello everyone!

Well, gotta be honest, im really new to linux, and scripting, so i have no idea what to do, and got only 1 week left to finish.

Setup: Got an ubuntu server, which has influxdb and grafana installed, and a router, which i can access with ssh.
The router sends management data periodically in our influx.

Goal: I have given thresholds (like droprate, errors), and when we reach the threshold, with a script i have to change a parameter in the router using ssh.

Im tottaly clueless, literally anything could be useful :slight_smile:

Thank you!


Hi Bence,

Im tottaly clueless, literally anything could be useful

This is not a problem if you are willing to educate yourself and do some reading on your own. Here is how you can approach this task.

  1. Configure ssh passwordless connection to your router
  2. Write a bash script which will detect whether or not the routers parameters need to be changed. Upon the execution the script should have some if/else statements to make the decision based on your threshold
  3. Write ssh commands to remotely perform the remote configuration.
  4. Insert the ssh commands as per step 3 into your bash script program as per step 2
  5. Lastly setup a cron job to periodically execute your bash script

Hope this helps…