nv-l

RE: [nv-l] Getting trap time for scripts

2003-01-07 09:48:11
Subject: RE: [nv-l] Getting trap time for scripts
From: James Shanks <jshanks AT us.ibm DOT com>
To: nv-l AT lists.tivoli DOT com
Date: Tue, 7 Jan 2003 09:48:11 -0500
You said, "Sometimes it differs up to 10-20 minutes although my script's 
running time
is only 1-2 seconds."   Then the obvious conclusion is that you are 
running this script many times, over and over again, and that the 
mechanism for doing that is backed up.

trapd gets a trap and passes it to all connected applications, then he 
logs the trap.  So the time you see in trapd.log is essentially the time 
it was passed to all the other daemons, particularly ovactiond, the guy 
who runs your scripts when you specify them as commands for automatic 
action in trapd.conf. The point of this is that trapd on UNIX is not 
multi-threaded, so he hands off scripts to someone else.  But ovactiond is 
not multi-threaded either. So he will execute your scripts one at a time 
in serial fashion, unless you tell him differently.  My guess for your 
time issue is that you are getting a lot of traps in, kicking off scripts, 
and ovactiond is behind in executing them.  You must therefore make 
certain that ovactiond is running with a maxWait value of zero.  Then he 
will launch the scripts in parallel rather than in series.  See the man 
page on ovactiond.  You set this option using serversetup.  The possible 
difficulty here is that if your script is writing to a file or something 
then you may see entries in it that are out of order or there may be file 
contention that still slows things down.

Also, it never hurts to specify that you script should run in the 
background when it is launched.
You should be adding "&" as the last parameter when you specify it.

James Shanks
Level 3 Support  for Tivoli NetView for UNIX and NT
Tivoli Software / IBM Software Group




Serkan Dölen <Serkan.Dolen AT isbank.com DOT tr>
01/07/2003 04:05 AM

 
        To:     "'Allison, Jason (JALLISON)'" <JALLISON AT arinc DOT com>, nv-l 
AT lists.tivoli DOT com
        cc: 
        Subject:        RE: [nv-l] Getting trap time for scripts



thanks,
Now, I use date variable in my scripts (3rd option in Jason's reply).
My problem is, the time delay between the date in trapd.log and the date
produced by my script.
Sometimes it differs up to 10-20 minutes although my script's running time
is only 1-2 seconds.
With this script, I update the status of our Ien nodes on a web page, and
action must be taken in 1-2 minutes if they are down.

Are there any suggestions to reduce the difference or what can cause this
delay?

Regards.

Serkan Dolen
Software Specialist
T. Isbank

-----Original Message-----
From: Allison, Jason (JALLISON) [mailto:JALLISON AT arinc DOT com]
Sent: Monday, December 30, 2002 6:04 PM
To: 'nv-l'
Subject: RE: [nv-l] Getting trap time for scripts


If you are running actions from a trap receipt, try inlining the date
command in your script.  For example, if your script is called 
'my_script':

my_script `date` (other variables)

That may/may not work, haven't tried.  Your other option would be to write 
a
driver script for your other script/actions.  This will work:

--
#!/bin/sh

my_script `date` $@
--

The 3rd option (the one that I use):  // Exert from an app

      readPdu = OVsnmpRecv(trapSession);

      if (readPdu != NULL) {

        // Determine current date
        current_time = time(NULL);
        current_local_time = localtime(&current_time);
        status = strftime(current_time_string,
                          MAX_TIME_FORMAT_STRING_LENGTH,
                          DATE_TIME_FORMAT_STRING,
                          current_local_time);



Best of luck,

Jason Allison
Principal Engineer
ARINC Incorporated
Office:  (410) 266-2006
FAX:  (410) 573-3026


-----Original Message-----
From: Serkan Dölen [mailto:Serkan.Dolen AT isbank.com DOT tr]
Sent: Monday, December 30, 2002 10:43 AM
To: nv-l AT lists.tivoli DOT com
Subject: RE: [nv-l] Getting trap time for scripts


Any of them is fine.

-----Original Message-----
From: Allison, Jason (JALLISON) [mailto:JALLISON AT arinc DOT com]
Sent: Monday, December 30, 2002 5:34 PM
To: 'nv-l'
Subject: RE: [nv-l] Getting trap time for scripts


Are you looking for when the trap is sent from the remote asset or 
received
on the NMS?

Jason Allison
Principal Engineer
ARINC Incorporated
Office:  (410) 266-2006
FAX:  (410) 573-3026


-----Original Message-----
From: James Shanks [mailto:jshanks AT us.ibm DOT com]
Sent: Monday, December 30, 2002 8:34 AM
To: nv-l AT lists.tivoli DOT com
Subject: Re: [nv-l] Getting trap time for scripts


There is no trap time in trapd.conf.  Did you mean trapd.log?  That 
timestamp is trapd's when he logs the trap.  It is not available anywhere 
as a variable. 
Since he logs the traps only after he has sent the trap to all connected 
applications, it should be within the same second as what you would get if 

you use the date command in your script. 

James Shanks
Level 3 Support  for Tivoli NetView for UNIX and NT
Tivoli Software / IBM Software Group




Serkan Dölen <Serkan.Dolen AT isbank.com DOT tr>
12/30/2002 05:57 AM

 
        To:     nv-l AT lists.tivoli DOT com
        cc: 
        Subject:        [nv-l] Getting trap time for scripts



Hi everybody,
I used mib2trap for trap customization. Everything is OK now. (List 
archives
helped me a lot for the problems I faced)
I use automatic actions for specific traps. I just want to know how do I
pass the trap time to the custom scripts I wrote? (The time in trapd.conf 
I
mean)

Serkan Dolen
Software Specialist 
T. Isbank
 

---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)





---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)

---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)

---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)

---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)

---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe AT lists.tivoli DOT com
For additional commands, e-mail: nv-l-help AT lists.tivoli DOT com

*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)





<Prev in Thread] Current Thread [Next in Thread>