LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-09-2022, 07:25 AM   #1
finalturismo
Member
 
Registered: May 2019
Posts: 120

Rep: Reputation: Disabled
Needing to run an array in parallel does anyone know how i can get this done?


cpumodel[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i -E -m1 "model name" | sed 's&model name:&&Ig' | sed 's&(r)&&Ig'| sed 's&@.*&&Ig' | xargs );\
totalcores[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i "core(s)\|socket(s)" | sed 's&core.*:&&gI' | sed 's&socket.*:&&gI' | sed 's& &&gI' | xargs | awk '{print $1*$2}' | xargs );\
cpuuseallcores[$i]=$(ssh ${server[i]} -p ${sshport[i]} mpstat -P ALL | awk '{print "<td><font color=orange>"$6"</font color>""<font color=teal>%</font color></td>"}' | tail +4 | sed '1~4 s&^&<tr align=left>&gI' | sed '0~4 s&$&</tr>&gI' | sed '$s&$&</tr>&' | xargs );\
corespersocket[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i "core(s) per socket" | awk '{print $4}'|xargs);\
threadpercore[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i "thread(s) per core" | awk '{print $4}' | xargs);\
cpumhz[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i -E -m1 "max mhz" | sed 's&CPU max MHz:&&Ig' | sed 's&.0000&&Ig' | awk '{print "<font color=orange>"$1"</font color>""<font color=teal>MHz</font color>"}'| xargs );\
cpusockets[$i]=$(ssh ${server[i]} -p ${sshport[i]} lscpu | grep -i "socket(s)" | awk '{print $2}'| xargs);\
cpu1temp[$i]=$(ssh ${server[i]} -p ${sshport[i]} sensors | grep -i "package id 0" | awk '{print $4}' | sed 's&+&&gI' | xargs);\
cpu2temp[$i]=$(ssh ${server[i]} -p ${sshport[i]} sensors | grep -i "package id 1" | awk '{print $4}' | sed 's&+&&gI' | xargs);\
subnet[$i]=$(ssh ${server[i]} -p ${sshport[i]} hostname -I | sed 's& &\n&' | grep -v "${wanip[i]}" | awk -F'.' -vOFS='.' '{$NF=0}1;'| xargs );\
totalcpuusage[$i]=$(ssh ${server[i]} -p ${sshport[i]} grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'| xargs );\
ramtotal[$i]=$(ssh ${server[i]} -p ${sshport[i]} free --giga -h |grep -i -v "swap" | grep -i "g" | awk '{print $2"B"}' | xargs );\
ramused[$i]=$(ssh ${server[i]} -p ${sshport[i]} free --giga -h |grep -i -v "swap" | grep -i "g" | awk '{print $3"B"}' | xargs );\
ramascache[$i]=$(ssh ${server[i]} -p ${sshport[i]} free --giga -h |grep -i -v "swap" | grep -i "g" | awk '{print $6"B"}' | xargs );\
ramfree[$i]=$(ssh ${server[i]} -p ${sshport[i]} free --giga -h | grep -i -v "swap" | grep -i "g" | awk '{print $4"B"}' | xargs );\
zfsarcram[$i]=$(ssh ${server[i]} -p ${sshport[i]} arc_summary | grep -i "arc size" | awk '{print "<font color=orange>"$6"</font color><font color=teal>"$7"</font color>"}' | xargs );\
zfsarchit[$i]=$(ssh ${server[i]} -p ${sshport[i]} arc_summary | grep -i "cache hit ratio" | awk '{print "<font color=orange>"$4"</font color><font color=teal>"$5"</font color>"}' | xargs );\
 
Old 09-09-2022, 07:48 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,836

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
yes, open your original thread and read the answers.
https://www.linuxquestions.org/quest...ts-4175716567/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Get more done at the Linux command line with GNU Parallel LXer Syndicated Linux News 0 05-11-2018 09:30 AM
To-Do/Task list, Idea documenting (thought diary)for monitoring things needing done cilbuper Linux - Software 5 10-21-2015 04:10 PM
BASH-Adding array element: Naming issue using array[${#array[*]}]=5 calvarado777 Programming 8 07-26-2013 09:48 PM
LXer: Nvidia and ARM: It's a parallel, parallel, parallel world LXer Syndicated Linux News 0 03-21-2013 06:10 PM
[SOLVED] Before I run lilo, does anyone know *for certain* how to get it to 'see' all OSes? Robert.Thompson Slackware 9 01-19-2011 07:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration