jasonacox / Powerwall-Dashboard

Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
MIT License
268 stars 57 forks source link

Synology no ping as non-root user #488

Closed zcpnate closed 2 weeks ago

zcpnate commented 2 weeks ago

Running on synology with PW3, setup fails due to non-root user not having ping permissions

sudo chmod +s /bin/ping will fix

might be better to use curl for the pw3 check for synology users

jasonacox commented 2 weeks ago

Thanks @zcpnate !

Brilliant idea. Can you test this script for me on you setup?

#!/bin/bash
#
# Function to test an IP to see if it returns a ping
function test_ip() {
    local IP=$1
    if [ -z "${IP}" ]; then
        return 1
    fi
    if curl -k --head --connect-timeout 1 --silent https://${IP} > /dev/null 2>&1; then
        return 0
    else
        return 1
    fi
}

# check IP and if it returns a ping print "IP is up" else print "IP is down"
echo "Positive test"
if test_ip "192.168.91.1" ; then
    echo "IP is up"
else
    echo "IP is down"
fi

echo "Negative test"
if test_ip "192.168.91.2" ; then
    echo "IP is up"
else
    echo "IP is down"
fi