Sponsored Content
Full Discussion: Daily health check script
Top Forums Shell Programming and Scripting Daily health check script Post 302691533 by methyl on Friday 24th of August 2012 06:36:09 PM
Old 08-24-2012
Let's pick one of the tests and assume that OutputW and OutputOK are other scripts or local functions.

Quote:
if [ `ioscan -fnC disk |wc -l` != 1 ]
then
if [ `ioscan -fnC disk |grep CLAIMED|wc -l` != `ioscan -fnC disk |grep NO_HW|wc -l` ]
then
outputW "Disks: Not CLAIMED disks detected."
else
outputOK "Disks: All Disks are CLAIMED"
fi
else
outputOK "Disks: No Disks found."
fi
There is a basic logic error here. The main condition does not work unless perhaps there is only ever one disk on a HP-UX system! Not sure about the syntax either.
We should run ioscan only once because it is a very powerful program and can cause the view to change. Be aware that running ioscan can cause dead hardware to completely disappear from the inventory (and therefore not show as NO_HW).
Let's try something lke this (untested and purely to demonstrate logic and not recommended).

Code:
ioscan -fnC disk > /tmp/ioscan_fnC_disk # Store output from ioscan
total_count=$(egrep "CLAIMED|NO_HW" ioscan_fnC_disk|wc -l)
dead_count=$(grep "NO_HW" ioscan_fnC_disk|wc -l)
if [ ${total_count} -eq  0 ]
then
        outputW "Disks: No Disks found."
else
        if [ ${dead_count} -gt 0 ]
        then
              outputW "Disks: Not CLAIMED disks detected."
        else
              outputOK "Disks: All Disks are CLAIMED"
        fi
fi
rm -f ioscan_fnC_disk # Clean up workfile

On my systems I run ioscan -fn (i.e. all hardware) daily and compare this output with the output from the same command yesterday. No attempt to predict every possible error output from ioscan. If there are differences, this is reported as a major error. Obviously if you detect a failure and repair it you will get one false alert for the broken hardware re-appearing.
I started doing this after discovering that a major hardware failure can cause a crash and reboot during which the dead hardware can completely and silently disappear from the ioscan inventory.
That reminds me. Don't forget to have a script to read the syslog and identify anything abnormal (and I don't mean broken printers).

Last edited by methyl; 08-24-2012 at 07:44 PM.. Reason: minor typos
This User Gave Thanks to methyl For This Post:
 

10 More Discussions You Might Find Interesting

1. HP-UX

check health

Dear Gentelmen I need command for display to me the following statement: -battery state -The application if working or not -The cpu is working or not -The power supply is working or not -The Data base is workig or not (2 Replies)
Discussion started by: magasem
2 Replies

2. Shell Programming and Scripting

need help to write script to check the process health and automatically restart it

I am working on a project, which need to constantly watch the process, and check its status, if it was dead, it should be restart automatically. Please kindly refer me to URL which teach how to write this kind of script, or service. Thanks. (1 Reply)
Discussion started by: dragondad
1 Replies

3. AIX

AIX Health Check

Hi All, I would like to know if there is a downloadable AIX health check script available from IBM that would print a report of a servers health status. I've been working on a number of Sun Solaris servers and Sun provide a sun checkup script which can give you an ORI figure as well as a list... (3 Replies)
Discussion started by: backslash
3 Replies

4. Shell Programming and Scripting

Health check script

Hi, I have a server type(A group of AIX,HP-UX and Linux servers running with different appn) in which i need to do health check(memory,cpu,h/w etc). I am planning to automate the same. Please help me out in writing the same. Thanks Renjesh Raju (9 Replies)
Discussion started by: Renjesh
9 Replies

5. AIX

AIX Health Check script

Hi Everyone, Can you please help me put together a aix health check script that will check the status of CPU,Memory,Adapter, Filesystems (threshold 80%) and Disks.Im thinking of deploying a script to gather the required data in all the 22 servers and probably send out a mail if anything needs... (3 Replies)
Discussion started by: R!C
3 Replies

6. Shell Programming and Scripting

Health check script

There are 3 servers . I want to fire commands df -kh and mpstat -P ALL on those individual servers and retrieve particular values to genrate reports. This part is almost done. But i am facing issue when i need to compile the reports from all three servers on to one server in order to generate a... (1 Reply)
Discussion started by: pratikm23
1 Replies

7. HP-UX

HP-UX Health Check

Hi Experts, I want to check health of hp-ux box. Basically I want to check if there are possibilities of network/memory/cpu bottleneck? Are there are any commands available other than glance in hp-ux for the same? (11 Replies)
Discussion started by: sai_2507
11 Replies

8. Shell Programming and Scripting

Script to check the health of a database

need a script to check the health of a session server database. It must read the data base and send an alert if the database is unavailable. If its unavailable, we will want to bring down the database listener to force failover. can u guyz help me in doing this. what information do i need... (1 Reply)
Discussion started by: remo999
1 Replies

9. Shell Programming and Scripting

Health check report

Hi Team, I am writing a small script in that I want collect all servers of /opt and /stage. Below is my small script #!/bin/ksh #checking Media server opt_Disk_Space_logs myclient=`cat media_server.txt` > opt_logs.txt printf " Server Name\tsize\tused\tavail\tcapacity\tMounted... (12 Replies)
Discussion started by: bashi77
12 Replies

10. AIX

AIX Health Check

Hi everyone, I am new to the Unix admin position, needed some help. My management wants to report how their over all AIX servers / environment is doing so far. I've been researching and found multiple commands to run on each LPAR, well I have few questions and also wanted to share the commands Im... (12 Replies)
Discussion started by: Adnans2k
12 Replies
uudemon(4)						     Kernel Interfaces Manual							uudemon(4)

NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons SYNOPSIS
These shell scripts reside in the following directory: /usr/lib/uucp DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file. This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com- mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script. FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file. RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1) Files: /usr/lib/uucp delim off uudemon(4)
All times are GMT -4. The time now is 10:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy