25 lines
431 B
Bash
Executable File
25 lines
431 B
Bash
Executable File
#!/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}.$$"
|
|
|
|
if ./stats.sh "${ifname}" > "${tmpname}"; then
|
|
mv "${tmpname}" "${targetname}"
|
|
else
|
|
rm "${tmpname}"
|
|
exit 1
|
|
fi
|