Clear questions and runnable code
get the best and fastest answer
Need help with a grep scriptby seenu18 (Initiate)
|on Nov 08, 2013 at 10:32 UTC||Need Help??|
seenu18 has asked for the
wisdom of the Perl Monks concerning the following question:
Hi I'm asked to write a sample script for the following scenario
Step 1: Login to the node using SSH or Telnet.
Step 2: Execute the below command
i. Show process cpu | grep Total à get the 5s time value
Note: Total CPU utilization is based on an average of all the cores.
ii. Show memory -> get the Total, Used, Free
iii. Show process -> get the process name, CPU % and memory
iv. Show process card # -> get the process name, cpu % and memory
Step 3: Wait for the interval (60s) and go in an infinite loop
1. File name : CPU_Utilization_<NodeIP>_<Date>_<Time> à This file will have the format as below
2. File name : MEMORY_Utilization_<NodeIP>_<Date>_<Time> à This file will have the format as below
I've scripted the login part so far
I need help with issuing commands and storing them in the file in the above specified format. At least help me with one show command and storing it's output in a file in the above specified format which is (I'm repeating here again).
h. File name : MEMORY_Utilization_<NodeIP>_<Date>_<Time> à This file will have the format as below