Sponsored Content
Top Forums UNIX for Advanced & Expert Users Script to access multiple linux servers to get system details such as CPU usage Post 302489361 by purdym on Thursday 20th of January 2011 09:32:14 AM
Old 01-20-2011
What you need is possible.

See here:
HTML Code:
https://www.unix.com/unix-advanced-expert-users/151905-command-run-across-servers.html
I wrote a wrapper for SSH that will run commands on other servers in parallel. It accepts a file, which contains host names.

I don't know about ping'ing 700 in under a second, but in theory it should work. But come to think of it, you wouldn't run the ping command on remote hosts by running commands on the remote hosts.

Anyway, here is an idea:

Code:
root@ms:/>gdsh
   Usage: [[-s working_col_file|OS_name] | -w nodename{,nodename}] -c command

   Required Parameters:
         -s or -w and -c

   Optional Parameters:
         [-n]
         [-d] [-h] [-n] [-T] [-v]

   Where:
         -C
            Collapses output. Used with dshbak.
         -c specifies the command to run
            Required.
         -n
            No Parallel mode. By default the command is run on every node at the same time.
         -s
            Specify a working collective file OR specify an OS name. Use uname -s to specify
             a working collective file with that postfix. ie. /.gwcoll.AIX.
         -w nodename{,nodename}
            Default: ALL nodes

   Options that affect only how the script runs:
         -d
            Enable debug mode. Variable contents will be printed. May be specified more than once.
         -h
            Prints this help screen.
         -q
            quiet. Limits output to the essentials.
         -T
            Testing mode. NO actual work will be done.
         -v
            Verbose mode. May be specified more than once.

   Notes:
         One of -s or -w is required.
         Piping the output to dshbak -c will group like results together.
         Use -C with dshbak, or you will get no output.
         -c must be the last flag on the command line.

   Example execution statements:
         gdsh -s /.gwcoll.AIX -c date
         gdsh -s AIX -c date
         gdsh -C -s AIX -c date | dshbak -c
         gdsh -s all.Linux_HP-UX -c date
         gdsh -C -w unxn_sw,wpgux005 -c "date" | dshbak -c

Example run:
Code:
gdsh -C -s HP-UX -c "/usr/bin/date" | dshbak -c

HOSTS -------------------------------------------------------------------------
wpgux001_sw, wpgux003_sw, wpgux004_sw, wpgux005_sw, wpgux006_sw, wpgux007_sw, wpgux010_sw, wpgux011_sw
-------------------------------------------------------------------------------
Thu Jan 20 08:29:18 CST 2011


HOSTS -------------------------------------------------------------------------
wpgux002_sw
-------------------------------------------------------------------------------
Thu Jan 20 08:29:19 CST 2011

 

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

The usage of mount file system of different servers

There is a file system in server1 which is mounted on different file system on server2. Filesystem kbytes used avail capacity Mounted on server1:/users/user1 7047581 5994192 982914 86% /u01 /data/datafiles/user1 The data in... (1 Reply)
Discussion started by: vamshikrishnab
1 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

4. Ubuntu

High System CPU Usage

I am running a Dell PE R815 with 4 x AMD 12 core CPUs with 128GB of RAM and a RAID 5 array of 6 SAS disks. This is an HPC application and is definitely CPU bound, however once I run 16 of these processes (thus pinning 16 cores) the work performed slows down dramatically, to maybe 5 or 10% of what... (2 Replies)
Discussion started by: mowmentous
2 Replies

5. UNIX for Advanced & Expert Users

UNIX / LINUX OS CPU configuration details

Hi, How to find the cpu configuration details of Cores, Speed MHz, virtual processors for the following servers: LINUX OS Servers: Linux 2.6.9-89.0.3.ELsmp #1 SMP Sat Jun 13 07:05:54 EDT 2009 i686 i686 i386 GNU/Linux. (Cores, Speed, Processor) Linux 2.6.18-164.el5 #1 SMP Tue Aug 18... (5 Replies)
Discussion started by: jagtheesh
5 Replies

6. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

7. AIX

Monitor Physical CPU usage on multiple servers

Hello, Looking for some help. I am trying to gather data at each server showing when the physical CPU is being used the most based on a weekly timeframe. I know this data can be seen through NMON but with multiple servers in our environment it could take a real long time. is there a easier... (4 Replies)
Discussion started by: audis$
4 Replies

8. Linux

System Went panic after CPU usage high

Hi All, Yesterday my Linux server went panic and even a small command took a lot of time to run. When i monitored pl find the below output Cpu(s): 0.1%us, 98.4%sy, 0.0%ni, 1.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st the time spent on kernel mode is 98 % and also idle time is around 1.5 %...... (4 Replies)
Discussion started by: jegaraman
4 Replies

9. Shell Programming and Scripting

Shell script for logging cpu and memory usage of a Linux process

I am looking for a way to log and graphically display cpu and RAM usage of linux processes over time. Since I couldn't find a simple tool to so (I tried zabbix and munin but installation failed) I started writing a shell script to do so The script file parses the output of top command through... (2 Replies)
Discussion started by: andy_dufresne
2 Replies

10. Shell Programming and Scripting

Script for CPU usage -Linux

Hi all I was wondering if its possible to write a script to keep CPU usage at 90%-95%? for a single cpu linux server? I have a perl script I run on servers with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area. I now need a script that raises the CPU to... (4 Replies)
Discussion started by: sudobash
4 Replies
CLUBAK(1)						     ClusterShell User Manual							 CLUBAK(1)

NAME
clubak - format output from clush/pdsh-like output and more SYNOPSIS
clubak [ OPTIONS ] DESCRIPTION
clubak formats text from standard input containing lines of the form "node:output". It is fully backward compatible with dshbak(1) but provides additonal features. For instance, clubak always displays its results sorted by node/nodeset. You do not need to use clubak when using clush(1) as all output formatting features are already included in. It is provided for other usages, like post-processing results of the form "node:output". Like clush(1), clubak uses the ClusterShell.MsgTree module of the ClusterShell library (see pydoc ClusterShell.MsgTree). INVOCATION
clubak should be started with connected standard input. OPTIONS
--version show clubak version number and exit -b, -c gather nodes with same output (-c is provided for dshbak(1) compatibility) -d, --debug output more messages for debugging purpose -L disable header block and order output by nodes -r, --regroup fold nodeset using node groups -s GROUPSOURCE, --groupsource=GROUPSOURCE optional groups.conf(5) group source to use -G, --groupbase do not display group source prefix (always @groupname) -S SEPARATOR, --separator=SEPARATOR node / line content separator string (default: :) -F, --fast faster but memory hungry mode (preload all messages per node) -T, --tree message tree trace mode; switch to enable ClusterShell.MsgTree trace mode, all keys/nodes being kept for each message element of the tree, thus allowing special output gathering --color=WHENCOLOR whether to use ANSI colors to surround node or nodeset prefix/header with escape sequences to display them in color on the terminal. WHENCOLOR is never, always or auto (which use color if standard output refers to a terminal). Color is set to [34m (blue foreground text) and cannot be modified. --diff show diff between gathered outputs EXIT STATUS
An exit status of zero indicates success of the clubak command. EXAMPLES
1. clubak can be used to gather some recorded clush(1) results: Record clush(1) results in a file: # clush -w node[1-7] uname -r >/tmp/clush_output # clush -w node[32-159] uname -r >>/tmp/clush_output Display file gathered results (in line-mode): # clubak -bL </tmp/clush_output 2. Another example, iterate over node* text files in current directory and gather characters count for all of them: # find -name "node*" -exec wc -c {} ; | awk '{ gsub("./","",$2); print $2": "$1 }' | clubak -bL node[1,3]: 7 node2: 9 SEE ALSO
clush(1), nodeset(1), groups.conf(5). BUG REPORTS
Use the following URL to submit a bug report or feedback: https://github.com/cea-hpc/clustershell/issues AUTHOR
Stephane Thiell, CEA DAM <stephane.thiell@cea.fr> COPYRIGHT
CeCILL-C V1 1.6 2012-03-28 CLUBAK(1)
All times are GMT -4. The time now is 08:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy