Changeset 222027809f476c8187ccf88ac8b565d3787094c4

Show
Ignore:
Timestamp:
05/24/09 19:12:04 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1243192324 +0000
git-parent:

[69a11e3974721ffdfdcb4fba3c1114c8a2d7ec43]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1243192324 +0000
Message:

make iep uses dedicated logging stream for more flexibility. Fix the numeric event representaiton in Java. Demonstrates we need an object-based event for Text stuff too... as the other doesn't handle null right.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/java/com/omniti/reconnoiter/AMQListener.java

    r0f51614 r2220278  
    7979 
    8080              EPStatement statement = epService.getEPAdministrator().createEPL(sq.getExpression()); 
    81               AMQOutput o = new AMQOutput(epService, statement, sq.getName()); 
     81              AMQOutput o = new AMQOutput(epService, sq); 
    8282 
    8383              statement.addListener(o); 
  • src/java/com/omniti/reconnoiter/AMQOutput.java

    r546c63f r2220278  
    1010 
    1111import com.omniti.reconnoiter.AMQBrokerSingleton; 
     12import com.omniti.reconnoiter.event.StratconQuery; 
    1213import java.lang.System; 
    1314import org.apache.activemq.ActiveMQConnectionFactory; 
     
    3334    private Destination destination; 
    3435    private MessageProducer producer; 
     36    private StratconQuery sq; 
    3537 
    36     public AMQOutput(EPServiceProvider epService, EPStatement statement, String name) { 
     38    public AMQOutput(EPServiceProvider epService, StratconQuery sq) { 
    3739      try { 
    3840        // we just need it started up 
    3941        AMQBrokerSingleton.getBroker(); 
    4042        this.epService = epService; 
    41         this.statement = statement; 
     43        this.sq = sq; 
     44        this.statement = sq.getStatement(); 
    4245 
    4346        connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); 
     
    4548        connection.start(); 
    4649        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
    47         destination = session.createTopic("noit.alerts." + name); 
     50        destination = session.createTopic("noit.alerts." + sq.getName()); 
    4851 
    4952        producer = session.createProducer(destination); 
     
    5457    } 
    5558    public void update(EventBean[] newEvents, EventBean[] oldEvents) { 
     59      System.err.println("AMQOutput -> dispatch"); 
    5660      for(int i = 0; i < newEvents.length; i++) { 
    5761        EventBean event = newEvents[i]; 
    58    
     62 
    5963        JSONEventRenderer jsonRenderer = epService.getEPRuntime(). 
    6064                                                   getEventRenderer(). 
    61                                                    getJSONRenderer(statement.getEventType()); 
    62         String output = jsonRenderer.render("MyEvent", event); 
     65                                                   getJSONRenderer(sq.getStatement().getEventType()); 
     66        String output = jsonRenderer.render(sq.getName(), event); 
    6367        try { 
    6468          TextMessage message = session.createTextMessage(output); 
  • src/java/com/omniti/reconnoiter/StratconMessage.java

    r0f51614 r2220278  
    6666    catch(Exception e) { 
    6767      System.err.println("makeMessage: " + e); 
     68      e.printStackTrace(); 
    6869    } 
    6970    return null; 
  • src/java/com/omniti/reconnoiter/event/NoitMetricNumeric.java

    r0f51614 r2220278  
    2020    private String uuid; 
    2121    private String name; 
    22     private double value; 
    23     private String remote
     22    private Double value; 
     23    private String noit
    2424 
    2525    protected String get_string(Element e, String tag) throws NoitMetricNumericException { 
     
    5353      name = get_string(e,"name"); 
    5454      value = get_double(e, "value"); 
    55       remote = get_string(e,"remote"); 
     55      noit = get_string(e,"remote"); 
    5656    } 
    5757 
    5858    public String getuuid() { return uuid; } 
    5959    public String getname() { return name; } 
    60     public double getvalue() { return value; } 
    61     public String getremote() { return remote; } 
     60    public Double getvalue() { return value; } 
     61    public String getnoit() { return noit; } 
    6262 
    6363    private class NoitMetricNumericException extends Exception { 
  • src/java/com/omniti/reconnoiter/event/StratconQuery.java

    r546c63f r2220278  
    4848    return uuid; 
    4949  } 
     50  public EPStatement getStatement() { 
     51    return statement; 
     52  } 
    5053  public String getExpression() { 
    5154    return expression; 
  • src/java/run-iep.sh.in

    r0f51614 r2220278  
    22 
    33JAVA=@JAVA@ 
     4JPARAMS="-Xms32m -Xmx512m" 
    45JARS="reconnoiter.jar activemq-all-5.2.0.jar antlr-runtime-3.1.1.jar \ 
    56        esper-3.0.0.jar log4j-1.2.15.jar \ 
     
    2627        fi 
    2728done 
    28 exec $JAVA -cp $CP com.omniti.reconnoiter.IEPEngine 
     29exec $JAVA $JPARAMS -cp $CP com.omniti.reconnoiter.IEPEngine 
  • src/stratcon.conf.in

    r9332cda r2220278  
    77      <log name="error"/> 
    88      <log name="debug"/> 
     9      <log name="error/iep"/> 
    910      <log name="error/eventer" disabled="true"/> 
    1011      <log name="debug/eventer" disabled="true"/> 
  • src/stratcon_iep.c

    r8fd52de r2220278  
    5959 
    6060eventer_jobq_t iep_jobq; 
     61static noit_log_stream_t noit_iep = NULL; 
    6162 
    6263struct iep_thread_driver { 
     
    140141           ADDCHILD("name", parts[5]); 
    141142         }); 
    142 noitL(noit_error,"Submitting check %s\n", parts[2]); 
    143143  return doc; 
    144144} 
     
    241241                                "self::node()/@id", 
    242242                                id, sizeof(id))) { 
    243       noitL(noit_error, "No uuid specified in query\n"); 
     243      noitL(noit_iep, "No uuid specified in query\n"); 
    244244      continue; 
    245245    } 
     
    247247                                "ancestor-or-self::node()/@topic", 
    248248                                topic, sizeof(topic))) { 
    249       noitL(noit_error, "No topic specified in query\n"); 
     249      noitL(noit_iep, "No topic specified in query\n"); 
    250250      continue; 
    251251    } 
    252252    if(!noit_conf_get_string(query_configs[i], "self::node()", 
    253253                             &query)) { 
    254       noitL(noit_error, "No contents specified in query\n"); 
     254      noitL(noit_iep, "No contents specified in query\n"); 
    255255      continue; 
    256256    } 
     
    336336        return NULL; 
    337337      } 
    338       noitL(noit_error, "Response: %s, %s\n", frame->command, frame->body); 
    339338     } 
    340339#endif 
     
    427426  } 
    428427  else { 
    429     noitL(noit_error, "no iep handler for: '%s'\n", job->line); 
     428    noitL(noit_iep, "no iep handler for: '%s'\n", job->line); 
    430429  } 
    431430  return 0; 
     
    550549    assert(len < sizeof(buff)); 
    551550    buff[len] = '\0'; 
    552     noitL(noit_error, "IEP: %s", buff); 
     551    noitL(noit_iep, "%s", buff); 
    553552  } 
    554553} 
     
    642641  } 
    643642 
     643  noit_iep = noit_log_stream_find("error/iep"); 
     644  if(!noit_iep) noit_iep = noit_error; 
     645 
    644646  start_iep_daemon(); 
    645647