Sponsored Content
Top Forums Shell Programming and Scripting Script to monitor Machine Health (Project Doctortux) Input needed. Post 302437766 by pinga123 on Friday 16th of July 2010 05:20:23 AM
Old 07-16-2010
Script to monitor Machine Health (Project Doctortux) Input needed.

I have written little script to check the CPU performance of the machine.
Request you to contribute your comments on the same.

Feel free to add your own scriptlet to make it better.

I have decided to call it as doctortux

I have decided to run the script in two mode
1)Interactive.(Not yet included in script)
2)Automatic.(currently giving CPU information.)

Automatic mode ( -a ) (default):This mode shoudnt ask any input from user and should run automatically.

Interactive mode (-i) : This mode should ask user for input .

Code:
##############################Option Check###############################
#!/bin/bash

#########################UPTIME########################################
fn_uptimeinfo()
{
echo "Machine Uptime Information:"
echo -e "\033[32m uptime"
tput sgr0                    #restores the terminal settings to normal.
uptime
echo "Command Description:"
echo "<current time> <Uptime since> <hour:min>"
echo "Number of users logged in to machine"
echo "load average <for last one minute>,<for last 5 minutes>,<for last 15 minutes>"
echo "________________________________________________________________"
}
fn_terminalinfo()
{
echo "Terminal Information:"
echo -e "\033[32m w"
tput sgr0
w
echo "________________________________________________________________"
}
#################################################################

#######################Disk Information###############################
fn_diskinfo()
{
echo "Disk Utilization"
echo -e "\033[32m df -h"
tput sgr0
df -h
echo "________________________________________________________________"
}
fn_partitioninfo()
{
echo "Disk Partition Information"
echo -e "\033[32m cat /proc/partitions"
tput sgr0
cat /proc/partitions
echo "________________________________________________________________"
}
######################################################################
fn_automatic()
{
echo "########Disk Information########"
fn_diskinfo
fn_partioninfo
}
if [ $# -eq 0 ]
then
  echo "Automatic Mode Selected"
  fn_automatic
else
  while getopts ai option 2>/dev/null
  do
    case "$option" in
      a) echo "Automatic Mode Selected"
         fn_automatic
         echo "Thanks";;
      i) echo "Interacive Mode Selected";;
      ?) echo "Please select proper option"
         echo list of available options
         -a automatic -i interactive ;;
    esac
  done
fi

Modified with CPU and Memory Information.

Last edited by pinga123; 07-21-2010 at 01:28 AM..
 

8 More Discussions You Might Find Interesting

1. BSD

how to monitor a freebsd machine using nagios

hi everyone. Any idea how to monitor a machine running freebsd 7.0 using Nagios? The Nagios server is currently on another machine. thanks :( (1 Reply)
Discussion started by: coolatt
1 Replies

2. Solaris

Monitor server's health

Dear all, There wasn't any monitoring on our server except on the filesystem. Therefore, I was wondering anything i should do on a daily basis to check on the server's status, health, hardware, or any other thing as a disaster prevention? Also, what command i should use to do that? ... (2 Replies)
Discussion started by: beginningDBA
2 Replies

3. Shell Programming and Scripting

Script creation (Input needed)

Hi , I m trying to write a script in linux . The problem is the output of command get changed every now and then. Just like top command in linux. How would i manipulate the output of the command ? The command i m talking about gives the real time values of performance of hosted guest... (3 Replies)
Discussion started by: pinga123
3 Replies

4. Programming

Help Needed Regarding Project

hai guys, I'am a newbie to this forum and to unix as well...as a part of our syllabus i got a project in Unix which i have to do in 4 days.Project is kinda File locking i will give the project specs...guys please help me.. Established client-server architecture using socket... (1 Reply)
Discussion started by: rosemolr
1 Replies

5. Shell Programming and Scripting

System Health - Cpu, Load, IO Monitor

hello there, can someone please tell me the commands that makes sense, from a production point of view, to be used to make sure CPU, LOAD or IO usages on a Linux or Solaris server isn't too high? I'm aware of vmstat, iostat, sar. But i seriously need real world advice as to what fields in... (1 Reply)
Discussion started by: SkySmart
1 Replies

6. Solaris

Solaris machine without monitor!!!

Dear friends, I have solaris machine which doesn't have a monitor attached to it, I access it from another computer using putty. I was wondering if it is possible that by the time the computer starts, I could see all those boot messages live on my putty terminal. And is there any terminal... (8 Replies)
Discussion started by: gabam
8 Replies

7. Solaris

Best way to monitor health of Solaris zones ?

What is the best way to monitor the health of solaris zones? Through the global zone or through the individual zones itself ? (5 Replies)
Discussion started by: CuriousDev
5 Replies

8. Shell Programming and Scripting

Input password to bash script, save, and enter when needed

I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed. #!/usr/bin/expect -f... (2 Replies)
Discussion started by: jbrass
2 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.10 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy