Spy2Servers

Easy to establish your own system-monitor platform



Project

Download Spy2Servers

User Guide

Developer Guide

Spring-integration support

Document(Chinese)

Api Docs

More information

Spring Integration Support

Spring-Integration is a very terrific project which sponsors by SpringFramework. The detail info please visits here.
Spy2Servers now could well support to it.

Screenshots:

here we will give you a very simple example to show how spy2servers support spring-integration.

The following prerequisites are required for this tutorial:

  • Spy2Servers-1.2.x(include the third-party libraries)
  • Spring-Integration-1.2.0
  • JDK 1.5 or greater
modify the conf/spy2servers.xml file as follow steps.

1. add our spring-integration support component. here we could found that all the message route to "spring-integrate-channel" component will trigger to spring integration channel "inputChannel"

    <spring-integerate-channel name="spring-integrate-channel" 
                   integeration-channel="inputChannel" />

2. now we define the spring integration channel "inputChannel".


<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.xmatthew.org/spy2servers/schema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:integration="http://www.springframework.org/schema/integration"
    xmlns:stream="http://www.springframework.org/schema/integration/stream"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.xmatthew.org/spy2servers/schema
        http://www.xmatthew.org/spy2servers/schema/spy2servers-1.0.xsd
     http://www.springframework.org/schema/integration
     http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
     http://www.springframework.org/schema/integration/stream
  http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd

        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd">

  <integration:channel id="inputChannel"/>

  <!-- here we just test if the component works -->
  <stream:stdout-channel-adapter id="stdoutAdapterWithDefaultCharset" channel="inputChannel"/>

3. configure the alert rule.

    <core-component> 
        <simple-alertRule> 
            <channel> 
                <from value="mySpyComponent"/>
                <to value="myAlertComponent"/>
                <to value="spring-integrate-channel"/>
            </channel>
        </simple-alertRule>
    </core-component>

4. parse monitor Message
  Message class

public class Message {

    public static final int LV_ERROR = 1;

public static final int LV_WARN = 2;

public static final int LV_FATAL = 3;

public static final int LV_INFO = 4;

private String id;

private String body;

private int level;

private Map properties;

private Date createDate;

private String description;

private String type; }
5. now we could run spy2servers to see what will happen. 
under windows:
   %spy2servers.home%/conf/start.bat
under linux:
   ${spy2servers.home}/conf/start.sh 6.(Optional)For more knowledge of how to integrate with Spring integration. here we are going to implement a channel Handler and to see how to deal with the Message. 6a. Define a Message handler class AlertMessageHandler as follows: public class AlertMessageHandler { public void watchMessage(Message msg) { System.out.print("AlertMessageHandler say:"); System.out.println(msg); } } 6b. inject to the spring context container. the receive the message from "inputchannel" channel. <integration:service-activator input-channel="inputChannel" ref="alertMessageHandler" method="watchMessage"/>
<beans:bean id="alertMessageHandler" class= "org.xmatthew.spy2servers.adapter.integration.AlertMessageHandler"> </beans:bean>
6c. run the spy2servers the result probably print out as bellow. it works. AlertMessageHandler say:org.xmatthew.spy2servers.core.Message@1e2afb2[i... Author: Matthew Xie Blog site: 孤独键盘手 Email: ant_miracle@163.com

News

01/05/2009

Spy2Server v1.2.0 support to spring-integration. user guide and developer guide update

01/03/2009

Spy2Server v1.1.0 document update. a ms word document file has include in the project.

05/05/2008

Spy2Server v.1.1.0 has been released.

09/04/2008

First ever release of Spy2Server ! More information about Spy2Server v.1.0.0 can be found on web site