cluster monitor to influxdb

From Hot Armadillo, 4 Years ago, written in Plain Text, viewed 226 times. This paste is a reply to Untitled from Crippled Gibbon - go back
URL https://paste.steamr.com/view/15231e4c/diff Embed
Viewing differences between Untitled and cluster monitor to influxdb

cat /tmp/bob \
  
#!/bin/bash

bjobs -u all -a \
        
| tail -n+2 \
  
\
        
| awk '
{
         node
 
node
        
split($6, z, "*");
 node=z[2];
 
"*");

        # No "*" means 1 core
        
if ("" ~ node)
   node=z[1];

  
z[2]) {
                node=z[1];
                
x[$2, $3, $4, node]++
node] += 1
        } else {
                # Number of cpus given
                node=z[2];
                x[$2, $3, $4, node] += z[1]
        }
}
END 
  
{
        
for (i in x) 
    
{
                
split(i, y, SUBSEP); 
    
SUBSEP);
                
print "lsf,username="y[1]",status="y[2]",queue="y[3]",node="y[4]" value="x[y[1], cpu_alloc="x[y[1], y[2], y[3], y[4]] 
  } 
y[4]]
        }
}' \
          |  while read i ; do
                echo "$i `date +%s"000000000"`"
        done 
| while read i ; do do
                
echo "curl -i -X POST xxx 'http://influxdb/write?db=lsf' --data-binary '$i '$i'" | sh
        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 +%s"000000000"`" +%s"000000000"`"
        done | while read i 
done



curl -i -XPOST 'http://localhost:8086/write?db=mydb' 
do
                echo "curl -X POST 'http://influxdb/write?db=slurm' 
--data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 

'$i'" | sh
        done



Reply to "cluster monitor to influxdb"

Here you can reply to the paste above