Updates feature list, added ssh exitcode sensor

main
Jonas Lührig 3 years ago
parent 084b8d1a41
commit 70473782b9

@ -9,14 +9,12 @@ processing in other applications.
- Modular design with sensors being run from a sensors.d directory
- Common functions and variables passed to the sensors for ease of programming
- Sensor types:
- [x] Ping (int, latency)
- [x] TCP Port (Bool, open or not)
- [ ] SSH command (int, return code)
- [ ] SSH command (string, output)
- [x] Speedtest Internet (int, Download Bandwith in Mb/s)
- [x] Speedtest Internet (int, Upload Bandwidth in Mb/s)
- [x] Speedtest IPerf (int, Download Bandwidth in Mb/s)
- [x] Speedtest IPerf (int, Upload Bandwith in Mb/s)
- [x] Ping
- [x] TCP Port open
- [x] SSH command (exit code)
- [ ] ~~SSH command (output)~~
- [x] Speedtest Internet
- [x] Speedtest IPerf3
## Important ToDos:
- [ ] Add systemd file

@ -0,0 +1,28 @@
#!/bin/bash
# Usage: doSshExitCode <command-name> <user@host> [<additional-ssh-args>] <remote-command>
function doSshExitCodeTest {
COMMAND_NAME="${1}"
CONNECTION_STRING="${2}"
if [ $# -eq 3 ]; then
SSH_COMMAND="${3}"
else
SSH_EXTRA_ARGS="${3}"
SSH_COMMAND="${4}"
fi
ssh -q \
-o BatchMode=yes \
-o StrictHostKeyChecking=no \
${CONNECTION_STRING} \
${SSH_EXTRA_ARGS} \
"${SSH_COMMAND}" | \
while read -r LINE; do :; done
EXIT_CODE=${PIPESTATUS[0]}
writeData \
ssh-exitcode \
"sourceHost=$(hostname -f),targetHost=${CONNECTION_STRING}" \
"exit_code=${EXIT_CODE},command_name=\"${COMMAND_NAME}\",last_line=\"${LINE}\""
}

@ -0,0 +1,3 @@
INTERVAL=180
doSshExitCodeTest "example-ssh-test" "user@host" "-i ~/.ssh/id_rsa" "/opt/script/do-something.sh"
Loading…
Cancel
Save