Sponsored Content
Top Forums Shell Programming and Scripting Create a script to monitor host interface up down Post 302542853 by momo0617 on Thursday 28th of July 2011 10:59:36 PM
Old 07-28-2011
Create a script to monitor host interface up down

Can anyone provide me some idea. I would like to create a script to monitoring some host interface up down issue. The scirpts will be schedule very 4 minutes to keep monitor the hosts interface. I draw my deside to show how to count the up down. default count value is 11111. that mean the interface is normal. it keep in up status. if the interface change to down. than it will be change to 11110. then the scripts will count it the 0 occurence more than 1 times it will do something like sent email. How can I campare with the old log and newlog to group the records to the newlog? or maybe do you have any good idea to be more esay to finish this scripts?

Counting the occurence of "0"
Code:
# echo "10101" | awk '{ x=gsub("0",""); print x }'
2
# echo "10001" | awk '{ x=gsub("0",""); print x }'
3
# echo "10000" | awk '{ x=gsub("0",""); print x }'
4

Two table format like the follow:

old log
###########
Code:
host Ip status Count
hosta XXX.XXX.XXX.XXX Critical 11011
hostb XXX.XXX.XXX.XXX Critical 11110

###########

newlog
###########
Code:
host Ip status Count
hosta XXX.XXX.XXX.XXX Critical 11110
hostc XXX.XXX.XXX.XXX Critical 11110

###########
Final group the records to templog and replace to the old log
###########
Code:
host Ip status Count
hosta XXX.XXX.XXX.XXX Critical 10110
hostb XXX.XXX.XXX.XXX Critical 11101
hostc XXX.XXX.XXX.XXX Critical 11110

###########

Last edited by pludi; 07-29-2011 at 03:13 AM..
 

9 More Discussions You Might Find Interesting

1. HP-UX

HP-UX - how to create virtual interface

OS - HP-UX B.10.20 A 9000/777 Anyone know how to set up a virtual interface on HP-UX? I've looked quickly through docs.hp.com and searched this site. No luck. And my HP Guru is sleeping today. (4 Replies)
Discussion started by: thehoghunter
4 Replies

2. Shell Programming and Scripting

launch & monitor process on remote host

Hi, I am working on HPUX11 systems. I intend to achieve following: Need to write a shell script that will launch a program on remote UNIX machine. It will be gr8 if in addition, the remote process can be monitored using some feedback. I donno how to use rsh / ssh for this. (specifying... (1 Reply)
Discussion started by: mrx
1 Replies

3. UNIX for Dummies Questions & Answers

please suggest computer languages to create man-machine interface for Linux applicati

I am new to program development on Linux. I wonder what computer languages are easy to grasp to create man - machine interactive interface software, which can accept inputs (parameters) from usrers, and present (display) the calculation results to users. Before, I have heared about Perl,... (10 Replies)
Discussion started by: cy163
10 Replies

4. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

5. Shell Programming and Scripting

How to create a user interface pointing to a file?

I have to create a user interface in which user can easily update ,delete or insert a new record which is pointing to a file in AIX Server? Using awk,sed ican update ,modify the file. how to create a link to userlike GUI(without using Tomcat,IIS) (3 Replies)
Discussion started by: laknar
3 Replies

6. Shell Programming and Scripting

Write an automated shell program(s) that can create, monitor the log files and report the issues for

Hi , Please help me getting this done. Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies

7. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

8. AIX

Need a graphical interface on AIX server to create database

Hello, Please suggest me the ways how to get graphical interface on AIX server.I need to create oracle database for which I need graphical access. Best regards, Vishal (4 Replies)
Discussion started by: Vishal_dba
4 Replies

9. Red Hat

Create an unconfigured VMware host from a template that is set to do firstboot --reconfig

I have an Oracle Linux 7.1 vsphere host built. It's be preconfigured with our security configurations. What I would like to do is unconfigure this host. Then set the host to do firstboot --reconfigure. how do I do that using /etc/sysconfig/firstboot? I've tried setting ... (10 Replies)
Discussion started by: os2mac
10 Replies
RPC.STATD(8)						    BSD System Manager's Manual 					      RPC.STATD(8)

NAME
rpc.statd -- host status monitoring daemon SYNOPSIS
rpc.statd [-d] DESCRIPTION
The rpc.statd utility is a daemon which co-operates with rpc.statd daemons on other hosts to provide a status monitoring service. The daemon accepts requests from programs running on the local host (typically, rpc.lockd(8), the NFS file locking daemon) to monitor the status of specified hosts. If a monitored host crashes and restarts, the remote daemon will notify the local daemon, which in turn will notify the local program(s) which requested the monitoring service. Conversely, if this host crashes and re-starts, when the rpc.statd re-starts, it will notify all of the hosts which were being monitored at the time of the crash. The following option is available: -d Cause debugging information to be written to syslog, recording all RPC transactions to the daemon. These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. -n Just send SM_NOTIFY messages to notify any hosts of a restart. Do not start daemon. The rpc.statd utility must NOT be invoked by inetd(8) because the protocol assumes that the daemon will run from system start time. Instead, it should be run from rc(8) after the network has been started. FILES
/var/db/statd.status non-volatile record of currently monitored hosts. /usr/include/rpcsvc/sm_inter.x RPC protocol specification used by local applications to register monitoring requests. SEE ALSO
syslog(3), rc(8), rpc.lockd(8) BUGS
There is no means for the daemon to tell when a monitored host has disappeared permanently (eg. catastrophic hardware failure), as opposed to transient failure of the host or an intermediate router. At present, it will re-try notification attempts at frequent intervals for 10 min- utes, then hourly, and finally gives up after 24 hours. The protocol requires that symmetric monitor requests are made to both the local and remote daemon in order to establish a monitored rela- tionship. This is convenient for the NFS locking protocol, but probably reduces the usefulness of the monitoring system for other applica- tions. The current implementation uses more than 1Kbyte per monitored host in the status file (and also in VM). This may be inefficient for NFS servers with large numbers of clients. STANDARDS
The implementation is based on the specification in X/Open CAE Specification C218, "Protocols for X/Open PC Interworking: XNFS, Issue 4", ISBN 1 872630 66 9 BSD
September 19, 1995 BSD
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy