Hello, I am using the below ssh script for my ssh script sensor to grep error messages in log. however this give me error - response not well-formed (code pe132) . Cam someone help in this.

script is as below.

#!/bin/bash
# definethe log path
LOG_FILE="/var/log/messages"

#read the last 100 lines of the log file and search for the keyword "error"
ERROR=$(tail -n 100 "$LOG_FILE" | grep "error")

#count the number of error occurences
ERROR_COUNT=$(echo "$ERRORS" | wc -l)

# output the error count to stdout
echo "ERRORS:$ERROR_COUNT"

# output the error messages to stdout
echo "$ERRORS" | while read -r line; do
echo "ERROR: $line"
done

Article Comments

Hello,

this sensor expects a numerical value as return.

Please refer to the sensors manual page for an example.

If you need further assistance with this sensor, feel free to open a support ticket.


Kind Regards
Johannes Beyerlein, Paessler Technical Support


May, 2023 - Permalink