bjobs -u all -a \
| tail -n+2
| awk '
{
split($6, z,
node=z[2];
# No "*" means 1 core
if ("" ~
node=z[1];
node=z[1];
x[$2, $3, $4,
} else {
# Number of cpus given
node=z[2];
x[$2, $3, $4, node] += z[1]
}
}
END
for (i in x)
split(i, y,
print "lsf,username="y[1]",status="y[2]",queue="y[3]",node="y[4]"
}
}
}' \
echo "$i `date +%s"000000000"`"
done | while read i ;
echo "curl
done
squeue -l -o "%.18i %.9P %.8j %.8u %.8T %5c %10C %10m %.10M %.9l %.6D %R" \
| tail -n+3 \
| awk '
{
# user, status, queue, node = cpu
x[$4, $5, $2, $12] += $7
}
END {
for (i in x) {
split(i, y, SUBSEP);
print "slurm,username="y[1]",status="y[2]",queue="y[3]",node="y[4]" value="x[y[1], y[2], y[3], y[4]]
}
}' \
| while read i ; do
echo "$i `date
done | while read i ;
curl -i -XPOST 'http://localhost:8086/write?db=mydb'
echo "curl -X POST 'http://influxdb/write?db=slurm' --data-binary
done