This is a discussion on remote server monitoring for Solaris within the Solaris/OpenSolaris forums, part of the UNIX operating systems category; Hello, I need to gather uptime info from different servers (all Solari . I have a little script running using ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Hello,
I need to gather uptime info from different servers (all Solari . I have a little script running using 'rup', but management require more information and a recommendation of which server to login to do build. Here is the desire output that I am looking for (text output is fine):>svrload 10-11-2005 server 1 4 users, load average: 0.06, 0.08, 0.09 server 2 4 users, load average: 0.06, 0.08, 0.07 server 3 4 users, load average: 0.01, 0.01, 0.01 Recommendation: server 3 I have tried to use ruptime, and that did not work. Please help Thank you, Philip |
| Sponsored Links | ||
|
|
|
|||
|
Thank you for the information.
How can one rank the result? For example: server 1 4 users, load average: 0.06, 0.08, 0.09 server 2 4 users, load average: 0.06, 0.08, 0.07 server 3 4 users, load average: 0.01, 0.01, 0.01 Recommendation: server 3 is best server to use. thank you, Philip |
|
||||
|
Assuming that your output is as follows:
Code:
server 1 4 users, load average: 0.06, 0.08, 0.09 server 2 4 users, load average: 0.06, 0.08, 0.07 server 3 4 users, load average: 0.01, 0.01, 0.01 And above output stored in three variable as you need to process output to find out the best server, here is the code: Code:
#!/bin/sh
F="server 1 4 users, load average: 0.06, 0.08, 0.09"
F1="server 2 4 users, load average: 0.06, 0.08, 0.07"
F2="server 3 4 users, load average: 0.01, 0.01, 0.01"
# get server load i.e. 0.09, 0.07 and 0.01 in S1, S2, S3
S1=$(echo $F | awk '{ print $9}')
S2=$(echo $F1 | awk '{ print $9}')
S3=$(echo $F2 | awk '{ print $9}')
# now compare S1 load with S2 and S3
T=$(echo "$S1 < $S2 && $S1 < $S3" | bc)
if [ $T -eq 1 ]; then # if result is TRUE, then this is the best server to run application
echo "Server1 is the best to run"
exit 0
fi
T=$(echo "$S2 < $S1 && $S2 < $S3" | bc)
if [ $T -eq 1 ]; then
echo "Server2 is the best to run"
exit 0
fi
T=$(echo "$S3 < $S2 && $S3 < $S1" | bc)
if [ $T -eq 1 ]; then
echo "Server3 is the best to run"
exit 0
fi
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remote access to linux server | RamPD | Linux software | 9 | 05-26-2008 08:21 AM |
| Solaris Disk Monitoring | vimalgoel | Getting started tutorials | 0 | 12-19-2007 05:53 PM |
| VMware ESX server && Solaris 10 on same PC ?? | vikas027 | Linux software | 1 | 11-24-2007 11:52 AM |
| script hangs when a remote server is down | vikas027 | Shell scripting | 2 | 11-11-2007 04:47 PM |
| Server monitoring (samba,NFS,telnet,ssh,ftp) | warren | Linux software | 11 | 06-26-2006 08:10 PM |