#!/bin/bash

function printit() {
  rload=$(ssh xena cat /proc/loadavg|cut -d' ' -f1)  
  lload=$(cat /proc/loadavg |cut -d' ' -f1) 
  numrunning=$(megatest -list-runs % | grep RUNNING | wc -l) 
  numlogs=$(ls logs | wc -l)
  numalive=$(megatest -list-servers |grep alive|wc -l)
  echo "$(date +%s) Numlogs: ${numlogs} NumRunning: ${numrunning} Lload ${lload} Rload: ${rload} NumAlive: ${numalive}"
}

function runforever () {
  while true;do
     printit
     sleep 5
  done
}

runforever
