Sponsored Content
Full Discussion: System status query script
Top Forums Shell Programming and Scripting System status query script Post 302288925 by bakunin on Wednesday 18th of February 2009 10:09:51 AM
Old 02-18-2009
First, collect all the files from all the servers and save them. Go through them one after the other and compile a list of services to be available. Load this list in an array. Create a second array with corresponding subscripts consisting of empty string values.

Then go through the collected files a second time and write the server name to the second array when the respective service status is up.

Example: First step, get all the service names and create the two arrays, you end up with two arrays, looking like this:

Code:
servname[1]="service_1"
servname[2]="service_2"
servname[3]="service_3"

servhost[1]=""
servhost[2]=""
servhost[3]=""

Step two is going through the collected files and scan for service-host-relationships. If you find in the file of host1 that service_2 is up you would add "host1" to the content of $servhost[2], etc.

Last step is to go through the servname/servhost pair of arrays, and print the name of the service (from servname[]) follwoed by the list of hosts (from servhosts[]) to create the list you wanted.

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

system status report script

hi i m new to this forum as well as UNIX. I've got an assignment but i don't know how can I start it. can anyone please help to tell me how can I start it? I added here few lines from my assignment. In industry, it is common for a single organisation to provide technical support for a... (0 Replies)
Discussion started by: moco
0 Replies

2. Infrastructure Monitoring

SNMP OID for System Status LED's

I am trying to locate the proper MIB and OID location, to determine if the system attention light is on IBM-702x servers running 5.x. Currently, we get this on our Blade Centers Management Modules at location: 1.3.6.1.4.1.2.3.51.2.2.8.2.1.1.7.xx were xx is the actual Blade number. A value of 1... (0 Replies)
Discussion started by: stamfdf
0 Replies

3. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

4. Shell Programming and Scripting

Hide status value from awk system command

Hi, When i use the system( ) function inside a awk, i am getting the ouput with a 0 appended in a new line. Can someone guide me to eliminate the extra line containing 0. Ex : awk -F"|" '{print system("convert.sh" $1}' The output is displayed with 0 in a new line. ... (8 Replies)
Discussion started by: muruganksk
8 Replies

5. Solaris

svc:/system/filesystem/local is always in maintenance status

Hello Friends, I need to change network filesystem status as online but it always seems in maintenance mode, I appreciate your any suggestion to change its state as online. shell>svcadm enable svc:/system/filesystem/local shell>svcs -l svc:/system/filesystem/local fmri ... (4 Replies)
Discussion started by: EAGL€
4 Replies

6. Shell Programming and Scripting

file system status mail notifications

HI I want to get an e-mail @ my yahoo address when the file system used space gets more than 89% , & the message contents must be the outputs of df -g errpt netstat -i ??????? (3 Replies)
Discussion started by: majd_ece
3 Replies

7. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

8. Homework & Coursework Questions

Listing Live System Status

1. Edit a script named update.sh that generates status.html in your web directory: ~/public_html/. I need to write specific commands to show each specific item 2. The generated webpage should include information related to: UNIX : kernel version of ed-lab server USER : number of users on the... (13 Replies)
Discussion started by: devinj
13 Replies

9. What is on Your Mind?

Status of Badging System - Beta 1

Dear All, Here is the current status of the badging system: The Beta 1 phase of the new badging system is close to completion. 42 prototype badges have been "allocated" 6 prototype badge slots are held in reserve The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies
GAI_STRERROR(3) 					   BSD Library Functions Manual 					   GAI_STRERROR(3)

NAME
gai_strerror -- get error message string from EAI_xxx error code SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> const char * gai_strerror(int ecode); DESCRIPTION
The gai_strerror() function returns an error message string corresponding to the error code returned by getaddrinfo(3) or getnameinfo(3). The following error codes and their meaning are defined in <netdb.h>: EAI_ADDRFAMILY address family for hostname not supported EAI_AGAIN temporary failure in name resolution EAI_BADFLAGS invalid value for ai_flags EAI_BADHINTS invalid value for hints EAI_FAIL non-recoverable failure in name resolution EAI_FAMILY ai_family not supported. EAI_MEMORY memory allocation failure EAI_NODATA no address associated with hostname EAI_NONAME hostname or servname not provided, or not known EAI_OVERFLOW argument buffer overflow EAI_PROTOCOL resolved protocol is unknown EAI_SERVICE servname not supported for ai_socktype EAI_SOCKTYPE ai_socktype not supported EAI_SYSTEM system error returned in errno RETURN VALUES
gai_strerror() returns a pointer to the error message string corresponding to ecode. If ecode is out of range, an implementation-specific error message string is returned. SEE ALSO
getaddrinfo(3), getnameinfo(3) BSD
February 22, 2006 BSD
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy