Sponsored Content
Top Forums Shell Programming and Scripting Grep Alerting - command or script assistance Post 302391572 by sbchecko on Monday 1st of February 2010 08:59:25 PM
Old 02-01-2010
Grep Alerting - command or script assistance

Hello! I need some help with grep from various logs we use for monitoring transactions. The logs contain the following information (which is consistent in all of the files):

Code:
 12:28:33.157 EWY  D 1 (tcpip.c:282): tcpip.c: Unable to connect to x.x.x.x on port xxxx. (79) Connection refused
  
 12:28:43.053 MSG  D 1 (eventmngr.cxx:426): Select loop emulation timed out.
12:28:43.053 EWY  D 1 (logging_compat.c:215): tcpip.c: Returning Socket fd 11
  
 12:28:43.054 EWY  D 1 (tcpip.c:282): tcpip.c: Unable to connect to x.x.x.x on port xxxx. (79) Connection refused
  
 12:28:53.947 MSG  D 1 (eventmngr.cxx:426): Select loop emulation timed out.
12:28:53.948 EWY  D 1 (logging_compat.c:215): tcpip.c: Returning Socket fd 11

So I can grep the "connection refused" information which alerts me that something has happened and I currently use the following command: grep -i "Connection Refused" /prodlogs/ew_RX_OUT.log and if the error level = 0, then alert me. But when the issue is resolved the following is then written to the log:

Code:
 12:28:53.948 EWY  I 1 (logging_compat.c:131): We Successfully became a TCP/IP Client
12:28:53.949 EWY  I 1 (logging_compat.c:131): Connected to port : [xxxx] on machine : <x.x.x.x>

So I'm looking to do a couple of things here (because I have hundreds of these logs that I need to keep an eye on):

1) How do I search on just the last "connection refused" or "Successfully became a TCP/IP Client"
2) If the "Successfully became a TCP/IP Client" occurs after the "connection refused", I need to know this because the problem has been resolved.

I have another program to do the actual alerting but either need a command line to do all of this above or I'm guessing that a script will be in order to which I can run which will give me an indication (such as a 0 or 1). Any help would be appreciated and thanks!

-Scott

Last edited by pludi; 02-02-2010 at 02:02 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script assistance; paste word into external command

I'm attempting to create a Perl script that will: Take the contents of the usernames.tmp file (usernames.tmp is created from an awk one-liner ran against /etc/passwd) Take one line at a time and pass it to the su command as a users name. This should go on until there is no more name to... (10 Replies)
Discussion started by: bru
10 Replies

2. UNIX for Dummies Questions & Answers

Command assistance

Hi, We currently use the below basic scripts to output details that the business requires for our AIX and Sun servers. I have been asked to produce the same sort of script to be used for our NCR MP-RAS UNIX and OS/2 UNIX servers but am not formilar with these forms of Unix. Would greatly... (0 Replies)
Discussion started by: kmuir
0 Replies

3. HP-UX

HPUX monitoring and alerting script per CPU

Hi Guys, Hopefully someone would be able to help me out. Basically I have an HPUX 11.11i system which is backed up by Data Protector 4.5. Every so often the vdba process hangs and chews up 100% of one of the systems CPU resources. As our monitoring tool can only monitor on a per system basis... (3 Replies)
Discussion started by: fulhamfcboy
3 Replies

4. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

5. Homework & Coursework Questions

Grep expressions homework, need assistance

Please dont delete, im listing my assignment and will be editing as i work on it. I am NOT looking for answers but help in understanding how to use grep 1. The problem statement, all variables and given/known data: For each question, list the command lines used in addition to any other details... (3 Replies)
Discussion started by: alindner
3 Replies

6. Shell Programming and Scripting

Assistance to use ls and GREP

Hi We have several folders and subfolders in a heirarchy, representing clients and files we send to them. Files that are not processed are placed in reject folder. I am able to run a LS that will scan all these folders, and ones that show entries (rejected files) are seen here. I am looking for... (8 Replies)
Discussion started by: cdc01
8 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Assistance with find command please

Trying to locate files less than xx days old, throughout all directories/subdirectories, but excluding certain types of directories and files. The directories I want to search all contain the same characteristic (dbdef, pldef, ghdef, etc), and there are subdirectories within that I need to... (2 Replies)
Discussion started by: Condmach
2 Replies

8. UNIX for Dummies Questions & Answers

Sed/command assistance

Hello all, I need some help and education creating a script. Basically I have a file with a list of numbers.. 2125554444 2124445555 I need to put them into a format that looks like this.... UQ-V8.1,2125554444,hdaudio UQ-V8.1,2124445555,hdaudio Any help would be greatly... (6 Replies)
Discussion started by: jay11789
6 Replies

9. UNIX for Dummies Questions & Answers

Sed/command assistance

Hello, I'm attempting to play with sed commands again... I have a file named test1 with numbers...ex:5551234567 I run this sed on the file... cat test1 | sed 's/^/homeDnModify "/g' | sed 's/$/" "" 3/g' >test2 Im hoping it will look like this... homeDnModify "551235" "4567" ""... (5 Replies)
Discussion started by: jay11789
5 Replies

10. UNIX for Beginners Questions & Answers

Student needs grep command assistance

I am a student in a UNIX/Linux classes having hard time with grep looking for assistance on some home work I need to figure out some kind of grep command to get a out put that only gives me information from a sample file and only list the people with the first name John the sample file is named... (1 Reply)
Discussion started by: jetoutant
1 Replies
Net::XMPP::Client(3)					User Contributed Perl Documentation				      Net::XMPP::Client(3)

NAME
Net::XMPP::Client - XMPP Client Module SYNOPSIS
Net::XMPP::Client is a module that provides a developer easy access to the Extensible Messaging and Presence Protocol (XMPP). DESCRIPTION
Client.pm uses Protocol.pm to provide enough high level APIs and automation of the low level APIs that writing an XMPP Client in Perl is trivial. For those that wish to work with the low level you can do that too, but those functions are covered in the documentation for each module. Net::XMPP::Client provides functions to connect to an XMPP server, login, send and receive messages, set personal information, create a new user account, manage the roster, and disconnect. You can use all or none of the functions, there is no requirement. For more information on how the details for how Net::XMPP is written please see the help for Net::XMPP itself. For a full list of high level functions available please see Net::XMPP::Protocol. Basic Functions use Net::XMPP; $Con = new Net::XMPP::Client(); $Con->SetCallbacks(...); $Con->Execute(hostname=>"jabber.org", username=>"bob", password=>"XXXX", resource=>"Work' ); # # For the list of available functions see Net::XMPP::Protocol. # $Con->Disconnect(); METHODS
Basic Functions new(debuglevel=>0|1|2, - creates the Client object. debugfile debugfile=>string, should be set to the path for the debug debugtime=>0|1) log to be written. If set to "stdout" then the debug will go there. debuglevel controls the amount of debug. For more information about the valid setting for debuglevel, debugfile, and debugtime see Net::XMPP::Debug. Connect(hostname=>string, - opens a connection to the server port=>integer, listed in the hostname (default timeout=>int localhost), on the port (default connectiontype=>string, 5222) listed, using the tls=>0|1) connectiontype listed (default tcpip). The two connection types available are: tcpip standard TCP socket http TCP socket, but with the headers needed to talk through a web proxy If you specify tls, then it TLS will be used if it is available as a feature. Execute(hostname=>string, - Generic inner loop to handle port=>int, connecting to the server, calling tls=>0|1, Process, and reconnecting if the username=>string, connection is lost. There are password=>string, five callbacks available that are resource=>string, called at various places: register=>0|1, onconnect - when the client has connectiontype=>string, made a connection. connecttimeout=>string, onauth - when the connection is connectattempts=>int, made and user has been connectsleep=>int, authed. Essentially, processtimeout=>int) this is when you can start doing things as a Client. Like send presence, get your roster, etc... onprocess - this is the most inner loop and so gets called the most. Be very very careful what you put here since it can *DRASTICALLY* affect performance. ondisconnect - when the client disconnects from the server. onexit - when the function gives up trying to connect and exits. The arguments are passed straight on to the Connect function, except for connectattempts and connectsleep. connectattempts is the number of times that the Component should try to connect before giving up. -1 means try forever. The default is -1. connectsleep is the number of seconds to sleep between each connection attempt. If you specify register=>1, then the Client will attempt to register the sepecified account for you, if it does not exist. Process(integer) - takes the timeout period as an argument. If no timeout is listed then the function blocks until a packet is received. Otherwise it waits that number of seconds and then exits so your program can continue doing useful things. NOTE: This is important for GUIs. You need to leave time to process GUI commands even if you are waiting for packets. The following are the possible return values, and what they mean: 1 - Status ok, data received. 0 - Status ok, no data received. undef - Status not ok, stop processing. IMPORTANT: You need to check the output of every Process. If you get an undef then the connection died and you should behave accordingly. Disconnect() - closes the connection to the server. Connected() - returns 1 if the Transport is connected to the server, and 0 if not. AUTHOR
Ryan Eatmon COPYRIGHT
This module is free software, you can redistribute it and/or modify it under the LGPL. perl v5.12.1 2010-07-05 Net::XMPP::Client(3)
All times are GMT -4. The time now is 06:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy