mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
gpsd python error (#352)
gpsd script occasionally results in python error. cause: the expected info from GPS unit on each update has more than 10 lines, therefore, python didn't find the expected wording and result in a python error correction: increase the line from gpspipe from 10 to 20 lines
This commit is contained in:
@@ -26,7 +26,7 @@ TMPFILE=$(mktemp)
|
||||
trap "rm -f $TMPFILE" 0 2 3 15
|
||||
|
||||
# Write GPSPIPE Data to Temp File
|
||||
$BIN_GPIPE -w -n 10 > $TMPFILE
|
||||
$BIN_GPIPE -w -n 20 > $TMPFILE
|
||||
|
||||
# Parse Temp file for GPSD Data
|
||||
VERSION=`cat $TMPFILE | $BIN_GREP -m 1 "VERSION" | $BIN_PYTHON -c 'import sys,json;print json.load(sys.stdin)["rev"]'`
|
||||
@@ -42,4 +42,4 @@ SATSUSED=`cat $TMPFILE | $BIN_GREP -m 1 "SKY" | $BIN_PYTHON -c 'import sys,json;
|
||||
# Output info for SNMP Extend
|
||||
echo '{"data":{"mode":"'$GPSDMODE'", "hdop":"'$HDOP'", "vdop":"'$VDOP'", "latitude":"'$LAT'", "longitude":"'$LONG'", "altitude":"'$ALT'", "satellites":"'$SATS'", "satellites_used":"'$SATSUSED'"}, "error":"0", "errorString":"", "version":"'$VERSION'"}'
|
||||
|
||||
rm $TMPFILE
|
||||
rm $TMPFILE
|
||||
|
||||
Reference in New Issue
Block a user