[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference csc32::consolemanager

Title:POLYCENTER Console Manager
Notice:Kits, Scans, Docs on CSC32:: as PCM$KITS:,PCM$DOCS:, PCM$SCANS:
Moderator:CSC32::BUTTERWORTH
Created:Thu Aug 06 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1541
Total number of notes:6564

940.0. "API-problem. I don't get the whole context.?" by 51336::BERGGREN (Nils Berggren,DC Sweden 876-8287) Thu Aug 24 1995 12:15

this is the last one..... (for the time being :-)


environment:
-------------
    VAX-VMS V6.1
    PCM V1.6-110




     I don't always get the whole context from the event in the action-routine.

     In the event, I've defined event context count=8 and context start=1.
     The event triggers on the output from a 'SHOW SYSTEM' command (which 
     is done by printing a file, on the console, containing the output 
     from a 'SHOW SYS';  this way the context will always be exactly 
     the same.)

     The action routine dumps out on a file all event-data and the context.

     Doing some 'SHOW SYSTEM' and comparing the files created, the files 
     differ from one and other.  All the context are not always present, and
     the CMEventContext returns different numbers.


     Am I doing something wrong?

	regards,
	Nils


     this is the code I use (stripped...):
     -------------------------------------------
     		:
		:
	   /*
	   ** get all event-parameters.
	   */
	   event_name      = CMEventName ( event );
	   event_class     = CMEventClass ( event );
	   event_info      = CMEventInfo ( event );
	   event_text      = CMEventText ( event );
	   event_context   = CMEventContext ( event );
	   event_time      = CMEventTime ( event );
	   event_type      = CMEventType ( event );
	   event_logtime   = CMEventLogtime ( event );
	   event_count     = CMEventCount ( event );
	   event_priority  = CMEventPriority ( event );
	   event_source    = CMEventSource ( event );
	   event_start     = CMEventStart ( event );
	   event_subsystem = CMEventSubSystem ( event );
	   event_host      = CMEventHost ( event );
	   event_system    = CMEventSystem ( event );
	   event_userdata  = CMEventUserdata ( event );
	   	:
		: /* here I convert event_time into ascii_time (printable) */
	   /*
	   ** write all event-data into dat-file
	   */
	   fprintf(logfile, "Event received at %s.\n",  current_ascii_time);
	   fprintf(logfile, "\t Name:      %s\n",  event_name);
	   fprintf(logfile, "\t Class:     %s\n",  event_class);
	   fprintf(logfile, "\t Text:      %s\n",  event_text);
	   fprintf(logfile, "\t Context:   %d\n",  event_context);
	   fprintf(logfile, "\t Time:      %s\n",  ascii_time);
	   fprintf(logfile, "\t Type:      %d\n",  event_type);
	   fprintf(logfile, "\t Count:     %d\n",  event_count);
	   fprintf(logfile, "\t Priority:  %d\n",  event_priority);
	   fprintf(logfile, "\t Source:    %s\n",  event_source);
	   fprintf(logfile, "\t Start:     %d\n",  event_start);
	   fprintf(logfile, "\t Subsystem: %s\n",  event_subsystem);
	   fprintf(logfile, "\t Host:      %s\n",  event_host);
	   fprintf(logfile, "\t System:    %s\n",  event_system);
	   fprintf(logfile, "\t Userdata:  %s\n",  event_userdata);
	   /*
	   ** write context into dat-file.
	   */
	   event_context = CMGetEventContext(event);
	
	   fprintf(logfile,"\t Context [%d lines]:\n", event_count);
	
	   for (i=0; i<event_count; i++) {
	      context_line = CMEventContextLine( event, i);
	      context_line_len = CMEventContextLineLength( event, i);
	      if (context_line) {
	         fprintf(logfile, "%s\n", context_line);
	      }
	      else {
	         fprintf(logfile, "_NO_EVENT_CONTEXT_TEXT_\n");
	      }
	   }
	       
	                :
	                :
	    

	    

     Here are two files:  
     
     File 1.
......................................................................
Event received at Thu Aug 24 16:09:32 1995.
	 Name:      showsys
	 Class:     test
	 Text:      Pid    Process Name    State  Pri*^
	 Context:   4
	 Time:      Thu Aug 24 1995 16:09:32.
	 Type:      1
	 Count:     8
	 Priority:  6
	 Source:    Console
	 Start:     1
	 Subsystem: test
	 Host:      Struts
	 System:    Struts
	 Userdata:  U ALL
	 Context [8 lines]:
_NO_EVENT_CONTEXT_TEXT_

VAX/VMS V5.5-2  on node STRUTS  24-AUG-1995 14:26:03.91   Uptime  2 00:34:28
  Pid    Process Name    State  Pri      I/O       CPU       Page flts Ph.Mem
00000041 SWAPPE
_NO_EVENT_CONTEXT_TEXT_
_NO_EVENT_CONTEXT_TEXT_
_NO_EVENT_CONTEXT_TEXT_
_NO_EVENT_CONTEXT_TEXT_
......................................................................

     File 2.
......................................................................
Event received at Thu Aug 24 16:09:35 1995.
	 Name:      showsys
	 Class:     test
	 Text:      Pid    Process Name    State  Pri*^
	 Context:   5
	 Time:      Thu Aug 24 1995 16:09:35.
	 Type:      1
	 Count:     8
	 Priority:  6
	 Source:    Console
	 Start:     1
	 Subsystem: test
	 Host:      Struts
	 System:    Struts
	 Userdata:  U ALL
	 Context [8 lines]:
_NO_EVENT_CONTEXT_TEXT_

VAX/VMS V5.5-2  on node STRUTS  24-AUG-1995 14:26:03.91   Uptime  2 00:34:28
  Pid    Process Name    State  Pri      I/O       CPU       Page flts Ph.Mem
00000041 SWAPPER         HIB     16        0   0 00:00:05.76         0      0   

00000044 IPCACP          HIB     10        7   0 00:00:00.61       124     68   

00000046 ERRFMT          HIB      8     1490   0 00:00:20.54       158     68   

00000047 OPCOM           HIB    
_NO_EVENT_CONTEXT_TEXT_
......................................................................


The file I type on the console is:
......................................................................
VAX/VMS V5.5-2  on node STRUTS  24-AUG-1995 14:26:03.91   Uptime  2 00:34:28
  Pid    Process Name    State  Pri      I/O       CPU       Page flts Ph.Mem
00000041 SWAPPER         HIB     16        0   0 00:00:05.76         0      0
00000044 IPCACP          HIB     10        7   0 00:00:00.61       124     68
00000046 ERRFMT          HIB      8     1490   0 00:00:20.54       158     68
00000047 OPCOM           HIB      8      248   0 00:00:03.11       509    180
00000048 AUDIT_SERVER    HIB     10       66   0 00:00:04.40      1943    287
00000049 JOB_CONTROL     HIB     10      171   0 00:00:02.39       498     77
0000004A QUEUE_MANAGER   HIB      8      180   0 00:00:31.83      1107    109
0000004B TP_SERVER       HIB     10    11652   0 00:07:57.41      1284    123
0000004C SYMBIONT_1      HIBO     4       --  swapped  out  --            263
0000004D SYMBIONT_2      HIBO     4       --  swapped  out  --            268
0000004E NETACP          HIB     10    18013   0 00:03:29.19      1407    153
0000004F EVL             HIB      6     1034   0 00:00:25.31     54405     45  N
00000050 REMACP          HIB      8       13   0 00:00:00.19        73     45
......................................................................
T.RTitleUserPersonal
Name
DateLines
940.1Just a guessZENDIA::DBIGELOWInnovate, Integrate, EvaporateThu Aug 24 1995 12:5010
    Nils, 
    
       The only thought that comes to mind is that perhaps the entire event
    context has not been logged prior to sending the event notification to
    your program. Perhaps you have defined the context to be 10 lines and when
    you got this message there might have been only 1 or 2 lines on the
    context logged. Again, this is just a guess on my part.
    
    Dave
    
940.2CSC32::BUTTERWORTHGun Control is a steady hand.Thu Aug 24 1995 14:238
    And a very good guess as the event context may not always be available
    as the Daemon may not have actually flushed it to disk. In my code, I
    use a wait-loop when I retrieve the event text and if I don't get all
    the context. So check to see if al the context is present and if not
    call the get context routine again.
    
    Regs,
      Dan