#!/bin/bash
#VARS: HOST,SSH_PORT,LOGIN,PASSWORD
#for not empty password required sshpass

if [ -z "$PASSWORD" ]
then
    ssh $LOGIN@$HOST -p $SSH_PORT grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'
else
    sshpass -p $PASSWORD ssh $LOGIN@$HOST -p $SSH_PORT grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'
fi



#FLOAT RESULT VAR TYPE (int)