2022-04-11 18:17:00 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
base=$(dirname "$(readlink -f "$0")")
|
|
|
|
cd "${base}"
|
|
|
|
|
|
|
|
instance=$1
|
|
|
|
ifname=$2
|
|
|
|
|
|
|
|
if [ -z "${instance}" -o -z "${ifname}" ]; then
|
|
|
|
echo >&2 "Syntax: $0 instancename clientifname"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
targetname="/var/lib/prometheus/node-exporter/capport-${instance}.prom"
|
|
|
|
tmpname="${targetname}.$$"
|
|
|
|
|
2023-11-15 17:29:59 +01:00
|
|
|
if ./stats.sh --instance "${instance}" --interface "${ifname}" > "${tmpname}"; then
|
2022-04-11 18:17:00 +02:00
|
|
|
mv "${tmpname}" "${targetname}"
|
|
|
|
else
|
|
|
|
rm "${tmpname}"
|
|
|
|
exit 1
|
|
|
|
fi
|