zeus
4 years ago
3 changed files with 38 additions and 1 deletions
@ -0,0 +1,37 @@ |
|||
|
|||
|
|||
function ifup { |
|||
if [[ ! -d /sys/class/net/${1} ]]; then |
|||
return 1 |
|||
else |
|||
[[ $(</sys/class/net/${1}/carrier) == 1 ]] |
|||
fi |
|||
} |
|||
|
|||
if ifup $1; then |
|||
hybridswarm='Online' |
|||
else |
|||
hybridswarm='NotOnline' |
|||
fi |
|||
|
|||
|
|||
dockerswarm=$(docker info --format "{{json .}}" | jq .Swarm.LocalNodeState) |
|||
tempswarm="${dockerswarm%\"}" |
|||
tempswarm="${tempswarm#\"}" |
|||
dockerswarm=$tempswarm |
|||
|
|||
dockerswarmid=$(docker info --format "{{json .}}" | jq .Swarm.NodeID) |
|||
tempswarm1="${dockerswarmid%\"}" |
|||
tempswarm1="${tempswarm1#\"}" |
|||
swarmlabid=$tempswarm1 |
|||
#echo $dockerswarm |
|||
#echo $hybridswarm |
|||
#echo $swarmlabid |
|||
|
|||
#jq --arg key0 'swarmlab' --arg swarmlab $dockerswarm --arg key1 'hybrid' --arg hybrid $hybridswarm --arg key2 'swarmlabid' --arg swarmlabid $swarmlabid'. | .[$key0]=$swarmlab | .[$key1]=$hybrid | .[$key2]=$swarmlabid' <<<'{}' |
|||
jq \ |
|||
--arg key0 'swarmlab' --arg swarmlab $dockerswarm \ |
|||
--arg key1 'hybrid' --arg hybrid $hybridswarm \ |
|||
--arg key2 'swarmlabid' --arg swarmlabid $swarmlabid \ |
|||
'. | .[$key0]=$swarmlab | .[$key1]=$hybrid | .[$key2]=$swarmlabid' <<<'{}' |
|||
|
@ -1 +0,0 @@ |
|||
32013 |
Loading…
Reference in new issue