This commit is contained in:
crusader 2017-12-13 15:39:34 +09:00
parent dcce692208
commit 0106a7cd30
115 changed files with 4880 additions and 542 deletions

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: ch.qos.logback:logback-classic:1.1.11">
<library name="Maven: ch.qos.logback:logback-classic:1.2.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: ch.qos.logback:logback-core:1.1.11">
<library name="Maven: ch.qos.logback:logback-core:1.2.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.hynnet:jacob:1.18">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/hynnet/jacob/1.18/jacob-1.18.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/hynnet/jacob/1.18/jacob-1.18-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/hynnet/jacob/1.18/jacob-1.18-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.jayway.jsonpath:json-path:2.2.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/microsoft/sqlserver/mssql-jdbc/6.2.2.jre8/mssql-jdbc-6.2.2.jre8.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/microsoft/sqlserver/mssql-jdbc/6.2.2.jre8/mssql-jdbc-6.2.2.jre8-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/microsoft/sqlserver/mssql-jdbc/6.2.2.jre8/mssql-jdbc-6.2.2.jre8-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: log4j:log4j:1.2.14">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.14/log4j-1.2.14-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: mysql:mysql-connector-java:6.0.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/6.0.6/mysql-connector-java-6.0.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/6.0.6/mysql-connector-java-6.0.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/6.0.6/mysql-connector-java-6.0.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: net.minidev:accessors-smart:1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/accessors-smart/1.1/accessors-smart-1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/accessors-smart/1.1/accessors-smart-1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/accessors-smart/1.1/accessors-smart-1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: net.minidev:json-smart:2.2.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/json-smart/2.2.1/json-smart-2.2.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/json-smart/2.2.1/json-smart-2.2.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/minidev/json-smart/2.2.1/json-smart-2.2.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.commons:commons-pool2:2.4.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.assertj:assertj-core:2.6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/assertj/assertj-core/2.6.0/assertj-core-2.6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/assertj/assertj-core/2.6.0/assertj-core-2.6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/assertj/assertj-core/2.6.0/assertj-core-2.6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-library:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.mockito:mockito-core:1.10.19">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.mongodb:mongo-java-driver:3.6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/mongodb/mongo-java-driver/3.6.0/mongo-java-driver-3.6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/mongodb/mongo-java-driver/3.6.0/mongo-java-driver-3.6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/mongodb/mongo-java-driver/3.6.0/mongo-java-driver-3.6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.objenesis:objenesis:2.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.1/objenesis-2.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.1/objenesis-2.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.1/objenesis-2.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.ow2.asm:asm:5.0.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/5.0.3/asm-5.0.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/5.0.3/asm-5.0.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.postgresql:postgresql:42.1.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.1.4/postgresql-42.1.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.1.4/postgresql-42.1.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/postgresql/postgresql/42.1.4/postgresql-42.1.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.skyscreamer:jsonassert:1.4.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/skyscreamer/jsonassert/1.4.0/jsonassert-1.4.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/skyscreamer/jsonassert/1.4.0/jsonassert-1.4.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/skyscreamer/jsonassert/1.4.0/jsonassert-1.4.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.slf4j:jcl-over-slf4j:1.7.25">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.slf4j:jul-to-slf4j:1.7.25">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.slf4j:log4j-over-slf4j:1.7.25">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.snmp4j:snmp4j:2.5.8">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/2.5.8/snmp4j-2.5.8.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/2.5.8/snmp4j-2.5.8-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/snmp4j/snmp4j/2.5.8/snmp4j-2.5.8-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/1.5.9.RELEASE/spring-boot-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/1.5.9.RELEASE/spring-boot-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/1.5.9.RELEASE/spring-boot-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-autoconfigure/1.5.9.RELEASE/spring-boot-autoconfigure-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-autoconfigure/1.5.9.RELEASE/spring-boot-autoconfigure-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-autoconfigure/1.5.9.RELEASE/spring-boot-autoconfigure-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter/1.5.9.RELEASE/spring-boot-starter-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter/1.5.9.RELEASE/spring-boot-starter-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter/1.5.9.RELEASE/spring-boot-starter-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-logging/1.5.9.RELEASE/spring-boot-starter-logging-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-logging/1.5.9.RELEASE/spring-boot-starter-logging-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-logging/1.5.9.RELEASE/spring-boot-starter-logging-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter-test:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-test/1.5.9.RELEASE/spring-boot-starter-test-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-test/1.5.9.RELEASE/spring-boot-starter-test-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-test/1.5.9.RELEASE/spring-boot-starter-test-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-test:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test/1.5.9.RELEASE/spring-boot-test-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test/1.5.9.RELEASE/spring-boot-test-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test/1.5.9.RELEASE/spring-boot-test-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.9.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test-autoconfigure/1.5.9.RELEASE/spring-boot-test-autoconfigure-1.5.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test-autoconfigure/1.5.9.RELEASE/spring-boot-test-autoconfigure-1.5.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-test-autoconfigure/1.5.9.RELEASE/spring-boot-test-autoconfigure-1.5.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-aop:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.3.13.RELEASE/spring-aop-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.3.13.RELEASE/spring-aop-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.3.13.RELEASE/spring-aop-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-beans:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.3.13.RELEASE/spring-beans-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.3.13.RELEASE/spring-beans-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.3.13.RELEASE/spring-beans-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.3.13.RELEASE/spring-context-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.3.13.RELEASE/spring-context-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.3.13.RELEASE/spring-context-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-core:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.3.13.RELEASE/spring-core-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.3.13.RELEASE/spring-core-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.3.13.RELEASE/spring-core-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-expression:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.3.13.RELEASE/spring-expression-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.3.13.RELEASE/spring-expression-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.3.13.RELEASE/spring-expression-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-test:4.3.13.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/4.3.13.RELEASE/spring-test-4.3.13.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/4.3.13.RELEASE/spring-test-4.3.13.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/4.3.13.RELEASE/spring-test-4.3.13.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.yaml:snakeyaml:1.17">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.17/snakeyaml-1.17-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.17/snakeyaml-1.17-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: redis.clients:jedis:2.9.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/2.9.0/jedis-2.9.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/2.9.0/jedis-2.9.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/redis/clients/jedis/2.9.0/jedis-2.9.0-sources.jar!/" />
</SOURCES>
</library>
</component>

BIN
lib/jacob-1.18-x64.dll Normal file

Binary file not shown.

BIN
lib/jacob-1.18-x86.dll Normal file

Binary file not shown.

View File

@ -16,37 +16,19 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.13.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.13.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.13.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.13.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.13.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:1.5.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:1.5.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.9.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:6.0.6" level="project" />
<orderEntry type="library" name="Maven: org.postgresql:postgresql:42.1.4" level="project" />
<orderEntry type="library" name="Maven: com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8" level="project" />
<orderEntry type="library" name="Maven: com.hynnet:jacob:1.18" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.6.0" level="project" />
<orderEntry type="library" name="Maven: org.snmp4j:snmp4j:2.5.8" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:2.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.3.13.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
</component>
</module>

63
pom.xml
View File

@ -5,9 +5,8 @@
<parent>
<groupId>com.loafle</groupId>
<artifactId>maven_parent_spring_boot</artifactId>
<version>1.5.9-RELEASE</version>
<relativePath/>
<artifactId>maven_parent_jar</artifactId>
<version>1.0.0-RELEASE</version>
</parent>
<groupId>com.loafle.overflow</groupId>
@ -21,6 +20,18 @@
<properties>
<netty.version>4.1.17.Final</netty.version>
<jackson.version>2.9.2</jackson.version>
<mysql-connector-java.version>6.0.6</mysql-connector-java.version>
<postgresql.version>42.1.4</postgresql.version>
<mssql-jdbc.version>6.2.2.jre8</mssql-jdbc.version>
<jacob.version>1.18</jacob.version>
<jedis.version>2.9.0</jedis.version>
<mongo-java-driver.version>3.6.0</mongo-java-driver.version>
<snmp4j.version>2.5.8</snmp4j.version>
</properties>
<dependencies>
@ -40,6 +51,52 @@
<version>${jackson.version}</version>
</dependency>
<!-- SQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>${mssql-jdbc.version}</version>
</dependency>
<!-- WMI -->
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jacob</artifactId>
<version>${jacob.version}</version>
</dependency>
<!-- Redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
</dependency>
<!-- MongoDB -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>${mongo-java-driver.version}</version>
</dependency>
<!-- SNMP -->
<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
<version>${snmp4j.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,25 +0,0 @@
package com.loafle.overflow.probe.container;
import com.loafle.overflow.probe.container.server.ContainerServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application implements CommandLineRunner {
@Autowired
private ContainerServer containerServer;
@Override
public void run(String... strings) throws Exception {
containerServer.start();
}
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}

View File

@ -0,0 +1,12 @@
package com.loafle.overflow.probe.container;
import com.loafle.overflow.probe.container.server.ContainerServer;
public class Container {
public static void main(String[] args) throws Exception {
ContainerServer server = new ContainerServer();
server.start();
}
}

View File

@ -0,0 +1,60 @@
package com.loafle.overflow.probe.container.crawler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class Crawler {
protected ObjectMapper objectMapper;
private Map<String,Config> configs;
private String configPath;
protected Crawler() {
objectMapper = new ObjectMapper();
}
public Config getConfig(String id) throws Exception {
return configs.get(id);
}
public void putConfig(String id, Config config) throws Exception {
if (configs == null) {
configs = new HashMap<>();
}
configs.put(id, config);
}
public boolean add(Config config) throws Exception {
this.putConfig(config.getId(), config);
return true;
}
public List<ResultSet> get(String id) throws Exception {
List<ResultSet> rsList = (List<ResultSet>)getInternal(getConfig(id));
return rsList;
}
public boolean init(Config config) throws Exception {
add(config);
return true;
}
public boolean remove(String id) throws Exception {
this.configs.remove(id);
return true;
}
public abstract String name();
public abstract List<ResultSet> getInternal(Config c) throws Exception;
public Object getInternalMeta(Config c) throws Exception {
return null;
}
}

View File

@ -0,0 +1,53 @@
package com.loafle.overflow.probe.container.crawler.config;
import java.util.List;
public class Config {
private String id;
private Target target;
private Schedule schedule;
private Crawler crawler;
private List<Item> items;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Target getTarget() {
return target;
}
public void setTarget(Target target) {
this.target = target;
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
public Crawler getCrawler() {
return crawler;
}
public void setCrawler(Crawler crawler) {
this.crawler = crawler;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
}

View File

@ -0,0 +1,41 @@
package com.loafle.overflow.probe.container.crawler.config;
public class Connection {
private String ip;
private String port;
private String portType;
private boolean ssl;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getPortType() {
return portType;
}
public void setPortType(String portType) {
this.portType = portType;
}
public boolean isSsl() {
return ssl;
}
public void setSsl(boolean ssl) {
this.ssl = ssl;
}
}

View File

@ -0,0 +1,22 @@
package com.loafle.overflow.probe.container.crawler.config;
public class Crawler {
private String name;
private String container;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContainer() {
return container;
}
public void setContainer(String container) {
this.container = container;
}
}

View File

@ -0,0 +1,35 @@
package com.loafle.overflow.probe.container.crawler.config;
import java.util.List;
public class Item {
private List<Keys> keys;
private QueryInfo queryInfo;
private MappingInfo mappingInfo;
public List<Keys> getKeys() {
return keys;
}
public void setKeys(List<Keys> keys) {
this.keys = keys;
}
public QueryInfo getQueryInfo() {
return queryInfo;
}
public void setQueryInfo(QueryInfo queryInfo) {
this.queryInfo = queryInfo;
}
public MappingInfo getMappingInfo() {
return mappingInfo;
}
public void setMappingInfo(MappingInfo mappingInfo) {
this.mappingInfo = mappingInfo;
}
}

View File

@ -0,0 +1,24 @@
package com.loafle.overflow.probe.container.crawler.config;
public class Keys {
private String metric;
private String key;
public String getMetric() {
return metric;
}
public void setMetric(String metric) {
this.metric = metric;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}

View File

@ -0,0 +1,44 @@
package com.loafle.overflow.probe.container.crawler.config;
import java.util.List;
public class MappingInfo {
private String parseDirection;
private List<String> arrayColumns;
private List<String> keyColumns;
private String valueColumn;
public String getParseDirection() {
return parseDirection;
}
public void setParseDirection(String parseDirection) {
this.parseDirection = parseDirection;
}
public List<String> getArrayColumns() {
return arrayColumns;
}
public void setArrayColumns(List<String> arrayColumns) {
this.arrayColumns = arrayColumns;
}
public List<String> getKeyColumns() {
return keyColumns;
}
public void setKeyColumns(List<String> keyColumns) {
this.keyColumns = keyColumns;
}
public String getValueColumn() {
return valueColumn;
}
public void setValueColumn(String valueColumn) {
this.valueColumn = valueColumn;
}
}

View File

@ -0,0 +1,25 @@
package com.loafle.overflow.probe.container.crawler.config;
import java.util.Map;
public class QueryInfo {
private String query;
private Map<String,Object> extend;
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public Map<String, Object> getExtend() {
return extend;
}
public void setExtend(Map<String, Object> extend) {
this.extend = extend;
}
}

View File

@ -0,0 +1,14 @@
package com.loafle.overflow.probe.container.crawler.config;
public class Schedule {
private String interval;
public String getInterval() {
return interval;
}
public void setInterval(String interval) {
this.interval = interval;
}
}

View File

@ -0,0 +1,25 @@
package com.loafle.overflow.probe.container.crawler.config;
import java.util.Map;
public class Target {
private Map<String, Object> auth;
private Connection connection;
public Map<String, Object> getAuth() {
return auth;
}
public void setAuth(Map<String, Object> auth) {
this.auth = auth;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
}

View File

@ -0,0 +1,78 @@
package com.loafle.overflow.probe.container.crawler.impl.database;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import com.loafle.overflow.probe.container.crawler.result.ResultSetRow;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public abstract class DatabaseCrawler extends Crawler {
public DatabaseCrawler() {
}
@Override
public List<ResultSet> getInternal(Config config) throws Exception {
return getMetrics(config);
}
private List<ResultSet> getMetrics(Config config) throws Exception {
Connection conn = null;
Statement stmt = null;
java.sql.ResultSet rs = null;
String url = (String)config.getTarget().getAuth().get("url");
String id = (String)config.getTarget().getAuth().get("id");
String pw = (String)config.getTarget().getAuth().get("pw");
loadDriverClass();
List<ResultSet> resultSets = new ArrayList<>();
try {
conn = java.sql.DriverManager.getConnection(url, id, pw);
stmt = conn.createStatement();
for (Item item : config.getItems()) {
ResultSet resultSet = ResultSetRow.newInstance(item);
Map<String,Integer> meta = resultSet.getMeta();
rs = stmt.executeQuery((String)item.getQueryInfo().getQuery());
while(rs.next()) {
List<String> row = new ArrayList<>(Arrays.asList(new String[meta.size()]));
for (Map.Entry<String, Integer> info : meta.entrySet()) {
String data = rs.getString(info.getKey());
data = data.trim();
row.set(info.getValue().intValue(),data);
}
resultSet.addRow(row);
}
resultSets.add(resultSet);
rs.close();
}
return resultSets;
} catch (Exception e) {
throw e;
} finally {
if (conn != null) {try {conn.close();} catch (SQLException e) {e.printStackTrace();}}
if (rs != null) {try {rs.close();} catch (SQLException e) {e.printStackTrace();}}
if (stmt != null) {try {stmt.close();} catch (SQLException e) {e.printStackTrace();}}
}
}
protected abstract void loadDriverClass() throws ClassNotFoundException;
}

View File

@ -0,0 +1,11 @@
package com.loafle.overflow.probe.container.crawler.impl.database;
public class DatabaseMetaInfo {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,13 @@
package com.loafle.overflow.probe.container.crawler.impl.database.mysql;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawler;
public class MySQLCrawler extends DatabaseCrawler {
public String name() {
return "MYSQL_CRAWLER";
}
protected void loadDriverClass() throws ClassNotFoundException {
Class.forName("com.mysql.cj.jdbc.Driver");
}
}

View File

@ -0,0 +1,14 @@
package com.loafle.overflow.probe.container.crawler.impl.database.oracle;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawler;
public class OracleCrawler extends DatabaseCrawler {
public String name() {
return "ORACLE_CRAWLER";
}
@Override
protected void loadDriverClass() throws ClassNotFoundException {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
}

View File

@ -0,0 +1,13 @@
package com.loafle.overflow.probe.container.crawler.impl.database.postgresql;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawler;
public class PostgreSQLCrawler extends DatabaseCrawler {
public String name() {
return "POSTGRESQL_CRAWLER";
}
protected void loadDriverClass() throws ClassNotFoundException {
Class.forName("org.postgresql.Driver");
}
}

View File

@ -0,0 +1,13 @@
package com.loafle.overflow.probe.container.crawler.impl.database.sqlserver;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawler;
public class SQLServerCrawler extends DatabaseCrawler {
public String name() {
return "SQLSERVER_CRAWLER";
}
protected void loadDriverClass() throws ClassNotFoundException {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
}

View File

@ -0,0 +1,190 @@
package com.loafle.overflow.probe.container.crawler.impl.jmx;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import javax.management.*;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.rmi.RMIConnectorServer;
import javax.naming.Context;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class JMXCrawler extends Crawler {
private static final Logger logger = Logger.getLogger(JMXCrawler.class.getName());
private String jmxUrl;
private String username;
private String password;
private boolean ssl;
public JMXCrawler() {}
public String name() {
return "JMX_CRAWLER";
}
private List<String> parse(Map<String, String> dataMap, Map<String, Integer> meta) {
List<String> row = new ArrayList<>(Arrays.asList(new String[meta.size()]));
for (Map.Entry<String, Integer> info : meta.entrySet()) {
String data = dataMap.get(info.getKey());
data = data.trim();
row.set(info.getValue().intValue(),data);
}
return row;
}
private Map<String, String> parseAttribute(MBeanServerConnection beanCon, ObjectName mbeanName) throws IntrospectionException, ReflectionException, InstanceNotFoundException, IOException, AttributeNotFoundException, MBeanException {
Map<String, String> returnMap = new HashMap<>();
MBeanInfo info = beanCon.getMBeanInfo(mbeanName);
for (MBeanAttributeInfo attr : info.getAttributes()) {
if (!attr.isReadable()) {
logCrawler(mbeanName, attr, "not readable");
continue;
}
// System.out.println("========================================================================");
// System.out.println("PropertyListString"+mbeanName.getCanonicalKeyPropertyListString());
// System.out.println("canonicaName="+mbeanName.getCanonicalName());
// System.out.println(mbeanName.getDomain());
// System.out.println(mbeanName.getKeyPropertyListString().compareTo("http"));
// System.out.println("========================================================================");
Object att = null;
try {
att = beanCon.getAttribute(mbeanName, attr.getName());
}catch (Exception e) {
logCrawler(mbeanName, attr, "fail: " + e);
continue;
}
if (att != null)
returnMap.put(attr.getName(), att.toString());
}
return returnMap;
}
@Override
public List<ResultSet> getInternal(Config config) throws Exception {
String hostIp = config.getTarget().getConnection().getIp();
String port = config.getTarget().getConnection().getPort();
this.jmxUrl = "service:jmx:rmi:///jndi/rmi://" + hostIp + ":" +port + "/jmxrmi";
this.username = (String) config.getTarget().getAuth().get("id");
this.password = (String) config.getTarget().getAuth().get("pw");
// connection
MBeanServerConnection beanCon;
JMXConnector jmxconn = null;
try {
Map<String, Object> environment = getAuthority();
jmxconn = JMXConnectorFactory.connect(new JMXServiceURL(this.jmxUrl), environment);
beanCon = jmxconn.getMBeanServerConnection();
List<ResultSet> resultSetList = new ArrayList<>();
List<ObjectName> objectNames = new LinkedList<ObjectName>();
objectNames.add(null);
ObjectName on = null;
for (Item item : config.getItems()) {
ResultSet resultSet = ResultSet.newInstance(item);
// get object
String query = item.getQueryInfo().getQuery();
on = new ObjectName(query);
Set<ObjectInstance> names = beanCon.queryMBeans(on, null);
List<Map<String,Object>> keys = (List<Map<String,Object>>) item.getQueryInfo().getExtend().get("aliases");
for (ObjectInstance name : names) {
Map<String, String> attrs = parseAttribute(beanCon,name.getObjectName());
if (keys != null) {
for ( Map<String,Object> keyMap : keys ) {
String key = (String) keyMap.get("key");
int index = (int) keyMap.get("index");
String objectName = parseObjectName(name.toString(),key);
String alias = item.getMappingInfo().getArrayColumns().get(index);
attrs.put(alias,objectName);
}
}
resultSet.addRow(parse(attrs, resultSet.getMeta()));
}
resultSetList.add(resultSet);
}
return resultSetList;
} catch(Exception e) {
e.printStackTrace();
throw e;
} finally {
if (jmxconn != null) {
jmxconn.close();
}
}
}
private String parseObjectName(String s, String key) {
int start = s.indexOf("[");
int end = s.lastIndexOf("]");
s = s.substring(start+1,end);
String [] slices = s.split(",");
String returnData = "";
for (String item : slices) {
String [] itemSplit = item.split("=");
if (itemSplit == null || itemSplit.length != 2) {continue;}
if (itemSplit[0].equals(key)) {
returnData = itemSplit[1];
}
}
return returnData;
}
private Map<String, Object> getAuthority() {
Map<String, Object> environment = new HashMap<String, Object>();
if (this.username != null && this.username.length() != 0 && this.password != null && this.password.length() != 0) {
String[] credent = new String[] {this.username, this.password};
environment.put(JMXConnector.CREDENTIALS, credent);
}
if (this.ssl) {
environment.put(Context.SECURITY_PROTOCOL, "ssl");
SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
}
return environment;
}
private static void logCrawler(String name, String msg) {
logger.log(Level.FINE, "crawler : '" + name + "': " + msg);
}
private static void logCrawler(ObjectName mbeanName, MBeanAttributeInfo attr, String msg) {
logCrawler(mbeanName + "'_'" + attr.getName(), msg);
}
}

View File

@ -0,0 +1,88 @@
package com.loafle.overflow.probe.container.crawler.impl.mongodb;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class MongoDBCrawler extends Crawler {
public String name() {
return "MONGODB_CRAWLER";
}
public List<ResultSet> collectMetric(Config c) throws Exception {
MongoClient mongoClient = null;
// Map<String, Object> returnMap = new HashMap<String, Object>();
String dataBaseName = null;
String statusCommand = null;
String targetIP = c.getTarget().getConnection().getIp();
short targetPort = Short.parseShort(c.getTarget().getConnection().getPort());
List<ResultSet> ofResultSets = null;
try {
mongoClient = new MongoClient(new ServerAddress(targetIP, targetPort),
MongoClientOptions.builder()
.serverSelectionTimeout(1000)
.connectTimeout(1000)
.socketTimeout(1000).build()
);
ofResultSets = new ArrayList<>();
ResultSet ofResultSet = null;
List<Item> items = c.getItems();
List<String> row = null;
for (Item item : items) {
ofResultSet = ResultSet.newInstance(item);
Map<String,Integer> metaMap = ofResultSet.getMeta();
row = new ArrayList<>(Arrays.asList(new String[metaMap.size()]));
dataBaseName = (String)item.getQueryInfo().getExtend().get("dataBaseName");
statusCommand = (String)item.getQueryInfo().getExtend().get("statusCommand");
MongoDatabase database = mongoClient.getDatabase(dataBaseName);
Document serverStatus = database.runCommand(new Document(statusCommand, 1));
Map<String, String> re = (Map<String, String>)serverStatus.get(item.getQueryInfo().getQuery());
for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
row.set(info.getValue().intValue(), String.valueOf(re.get(info.getKey())));
}
ofResultSet.addRow(row);
ofResultSets.add(ofResultSet);
}
}catch (Exception e) {
throw e;
}finally {
if (mongoClient != null) {
mongoClient.close();
}
}
return ofResultSets;
}
@Override
public List<ResultSet> getInternal(Config config) throws Exception {
return this.collectMetric(config);
}
}

View File

@ -0,0 +1,110 @@
package com.loafle.overflow.probe.container.crawler.impl.redis;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import redis.clients.jedis.Jedis;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class RedisCralwer extends Crawler {
private static final Logger LOGGER = Logger.getLogger(RedisCralwer.class.getName());
public RedisCralwer() {
}
public String name() {
return "REDIS_CRAWLER";
}
@Override
public List<ResultSet> getInternal(Config c) throws Exception {
LOGGER.log(Level.INFO ,"getInternal call");
return collectMetric(c);
}
protected List<ResultSet> collectMetric(Config c) {
String targetIP = c.getTarget().getConnection().getIp();
int targetPort = Integer.valueOf(c.getTarget().getConnection().getPort());
String authpw = (String)c.getTarget().getAuth().get("authpw");
Jedis jedis = null;
List<Item> items = c.getItems();
try {
jedis = new Jedis(targetIP, targetPort,false);
if (authpw != null && !authpw.equals("")) {
String code = jedis.auth(authpw);
if (!code.equals("")) {
// set error auth
}
}
List<ResultSet> resultSetList = new ArrayList<>();
for (Item item : items) {
ResultSet resultSet = ResultSet.newInstance(item);
String queryString = (String) item.getQueryInfo().getQuery();
String info = jedis.info(queryString);
Map<String, String> resultMap = (Map<String, String>) parseToMap(info).get(queryString);
resultSet.addRow(parse(resultMap,resultSet.getMeta()));
resultSetList.add(resultSet);
}
return resultSetList;
} catch (Exception e) {
throw e;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
private List<String> parse(Map<String, String> dataMap, Map<String, Integer> meta) {
List<String> row = new ArrayList<>(Arrays.asList(new String[meta.size()]));
for (Map.Entry<String, Integer> info : meta.entrySet()) {
String data = dataMap.get(info.getKey());
data = data.trim();
row.set(info.getValue().intValue(),data);
}
return row;
}
public Map<String, Object> parseToMap(String source) {
String[] categorys = source.split("\r\n\r\n");
Map<String, Object> result = new HashMap<String, Object>();
for (String category : categorys) {
if (category.length() == 0) {continue;}
Map<String, String> sm = new HashMap<String,String>();
String[] lines = category.split("\r\n");
int idx = 0;
for (String line : lines) {
if (idx == 0) {idx++;continue;}
if (line.length() == 0) {continue;}
String[] items = line.split(":");
if (items.length != 0 && items.length > 1) {
sm.put(items[0], items[1]);
}
}
String[] ca = lines[0].split(" ");
result.put(ca[1], sm);
}
return result;
}
}

View File

@ -0,0 +1,309 @@
package com.loafle.overflow.probe.container.crawler.impl.snmp;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Connection;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.impl.snmp.version.SNMPv2c;
import com.loafle.overflow.probe.container.crawler.impl.snmp.version.SNMPv3;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.smi.Address;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class SNMPCrawler extends Crawler {
public String name() {
return "SNMP_CRAWLER";
}
@Override
public List<ResultSet> getInternal(Config config) {
// String targetVer = (String)config.getTarget().getAuth().get("version");
// switch (targetVer) {
// case "v2c":
// retObj = getByV2c(config);
// break;
// case "v3":
// retObj = getByV3(config);
// break;
// default:
// new Exception("Unknown SNMP protocol : " + targetVer).printStackTrace();
// }
return getSNMP(config);
}
private List<ResultSet> getSNMP(Config config) {
Snmp snmp = null;
TransportMapping<? extends Address> transport = null;
List<ResultSet> rslist = null;
try {
transport = new DefaultUdpTransportMapping();
snmp = new Snmp(transport);
transport.listen();
rslist = new ArrayList<>();
List<Item> items = config.getItems();
String[] oids = null;
Map<String, String> snmpResultMap = null;
for (Item item : items) {
oids = new String[item.getKeys().size()];
for (int i=0; i<item.getKeys().size();i++) {
oids[i] = item.getKeys().get(i).getKey();
}
snmpResultMap = getSNMPV(snmp, config, oids);
rslist.add(convertResultSet(snmpResultMap, item));
}
return rslist;
} catch (Exception e) {
e.printStackTrace();
} finally {
if (snmp != null) {
try {
snmp.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (transport != null) {
try {
transport.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return rslist;
}
private Map<String, String> getSNMPV(Snmp snmp, Config config, String[] oids) throws Exception {
String targetVer = (String)config.getTarget().getAuth().get("version");
switch (targetVer) {
case "v2c":
return getV2c(snmp, config, oids);
case "v3":
return getV3(snmp, config, oids);
default:
new Exception("Unknown SNMP protocol : " + targetVer).printStackTrace();
}
return null;
}
private Map<String, String> getV2c(Snmp snmp, Config config, String[] oids) throws Exception {
SNMPv2c snmpV2 = new SNMPv2c(snmp);
Map<String, Object> authInfo = config.getTarget().getAuth();
Connection connInfo = config.getTarget().getConnection();
String ip = connInfo.getIp();
String port = connInfo.getPort();
String community = (String)authInfo.get("community");
return snmpV2.get(ip, port, community, oids);
}
private Map<String, String> getV3(Snmp snmp, Config config, String[] oids) throws Exception {
SNMPv3 snmpV3 = new SNMPv3(snmp);
Map<String, Object> authInfo = config.getTarget().getAuth();
Connection connInfo = config.getTarget().getConnection();
String ip = connInfo.getIp();
String port = connInfo.getPort();
// String method = config.get;
String user = (String)authInfo.get("user");
String authType = (String)authInfo.get("authType");
String authPass = (String)authInfo.get("authPass");
String privType = (String)authInfo.get("privType");
String privPass = (String)authInfo.get("privPass");
return snmpV3.get(ip, port, user, authType, authPass, privType, privPass, oids);
}
protected ResultSet convertResultSet(Map<String, String> map, Item item) {
ResultSet rs = ResultSet.newInstance(item);
List<String> row = new ArrayList<>(Arrays.asList(new String[map.size()]));
Map<String, Integer> metaMap = rs.getMeta();
for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
row.set(info.getValue().intValue(), map.get(info.getKey()));
}
rs.addRow(row);
return rs;
}
//
// private List<ResultSet> getByV2c(Config config) {
// Snmp snmp = null;
// TransportMapping<? extends Address> transport = null;
//
// List<ResultSet> rslist = null;
//
// try {
// transport = new DefaultUdpTransportMapping();
// snmp = new Snmp(transport);
// transport.listen();
// SNMPv2c snmpV2 = new SNMPv2c(snmp);
//
// rslist = new ArrayList<>();
//
// Map<String, Object> authInfo = config.getTarget().getAuth();
// Connection connInfo = config.getTarget().getConnection();
//
// String ip = connInfo.getIp();
// String port = connInfo.getPort();
// String community = (String)authInfo.get("community");
//
// List<Item> items = config.getItems();
// String[] oids = null;
// for (Item item : items) {
// oids = new String[item.getKeys().size()];
//// List<Query> queries = item.getQueries();
// for (int i=0; i<item.getKeys().size();i++) {
// oids[i] = item.getKeys().get(i).getKey();
// }
//
// rslist.add(convertResultSet(snmpV2.get(ip, port, community, oids), item));
//
// }
// return rslist;
// /*
// switch (method) {
// case "validate":
// return snmpV2.validate(ip, port, community);
// case "get":
// return snmpV2.get(ip, port, community, oids);
// case "walk":
// return snmpV2.walk(ip, port, community, oids[0]);
// default:
// new Exception("Unknown SNMP command : " + method).printStackTrace();
// }
// */
//
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (snmp != null) {
// try {
// snmp.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (transport != null) {
// try {
// transport.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return null;
// }
//
// private Object getByV3(Config config) {
// Snmp snmp = null;
// TransportMapping<? extends Address> transport = null;
//
// List<ResultSet> rslist = null;
//
// try {
// transport = new DefaultUdpTransportMapping();
// snmp = new Snmp(transport);
// transport.listen();
// SNMPv3 snmpV3 = new SNMPv3(snmp);
//
// rslist = new ArrayList<>();
//
// Map<String, Object> authInfo = config.getTarget().getAuth();
// Connection connInfo = config.getTarget().getConnection();
//
// String ip = connInfo.getIp();
// String port = connInfo.getPort();
//// String method = config.get;
//
// String user = (String)authInfo.get("user");
// String authType = (String)authInfo.get("authType");
// String authPass = (String)authInfo.get("authPass");
// String privType = (String)authInfo.get("privType");
// String privPass = (String)authInfo.get("privPass");
//
// List<Item> items = config.getItems();
// String[] oids = null;
// for (Item item : items) {
// oids = new String[item.getKeys().size()];
//// List<Query> queries = item.getQueries();
// for (int i=0; i<item.getKeys().size();i++) {
// oids[i] = item.getKeys().get(i).getKey();
// }
//
//// rslist.add(convertResultSet(snmpV2.get(ip, port, community, oids), item));
// rslist.add(convertResultSet(snmpV3.get(ip, port, user, authType, authPass, privType, privPass, oids), item));
// }
//
// return rslist;
//
// /*
// switch (method) {
// case "validate":
// return snmpV3.validate(ip, port, user, authType, authPass, privType, privPass);
// case "get":
// return snmpV3.get(ip, port, user, authType, authPass, privType, privPass, oids);
// case "walk":
// return snmpV3.walk(ip, port, user, authType, authPass, privType, privPass, oids[0]);
// default:
// new Exception("Unknown SNMP command : " + method).printStackTrace();
// }
// */
//
// } catch (Exception e) {
// new Exception("An Exception happend : " + e.getMessage()).printStackTrace();
// } finally {
// if (snmp != null) {
// try {
// snmp.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (transport != null) {
// try {
// transport.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return null;
// }
}

View File

@ -0,0 +1,82 @@
package com.loafle.overflow.probe.container.crawler.impl.snmp.version;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.Target;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.util.TreeEvent;
import org.snmp4j.util.TreeUtils;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Created by insanity on 17. 4. 10.
*/
public abstract class SNMP {
protected Map<String, String> get(Snmp snmp, PDU pdu, Target target) throws Exception {
ResponseEvent response = snmp.get(pdu, target);
if (response == null) {
throw new Exception("Error: No response from SNMP Agent.");
}
PDU responsePDU = response.getResponse();
if (responsePDU == null) {
throw new Exception("Error: Response PDU is null");
}
int errorStatus = responsePDU.getErrorStatus();
int errorIndex = responsePDU.getErrorIndex();
String errorStatusText = responsePDU.getErrorStatusText();
if (errorStatus != PDU.noError) {
throw new Exception("Error: " + errorIndex + " " + errorStatusText);
}
Map<String, String> result = new LinkedHashMap<String, String>();
for (VariableBinding varBinding : responsePDU.getVariableBindings()) {
if (varBinding == null) {
continue;
}
result.put(varBinding.getOid().toString(), varBinding.getVariable().toString());
}
return result;
}
protected Map<String, String> walk(String oidStr, Target target, TreeUtils treeUtils) throws Exception {
OID oid = new OID(oidStr);
List<TreeEvent> events = treeUtils.getSubtree(target, oid);
if(events == null || events.size() == 0){
throw new Exception("No data.");
}
Map<String, String> result = new LinkedHashMap<String, String>();
for (TreeEvent event : events) {
if(event == null) {
continue;
}
if (event.isError()) {
System.err.println(event.getErrorMessage());
continue;
}
VariableBinding[] varBindings = event.getVariableBindings();
for (VariableBinding varBinding : varBindings) {
if (varBinding == null) {
continue;
}
result.put(varBinding.getOid().toString(), varBinding.getVariable().toString());
}
}
return result;
}
}

View File

@ -0,0 +1,63 @@
package com.loafle.overflow.probe.container.crawler.impl.snmp.version;
import org.snmp4j.CommunityTarget;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.*;
import org.snmp4j.util.DefaultPDUFactory;
import org.snmp4j.util.TreeUtils;
import java.util.Map;
public class SNMPv2c extends SNMP {
private Snmp snmp = null;
public SNMPv2c(Snmp snmp) {
this.snmp = snmp;
}
private CommunityTarget getTarget(String addr, String port, String community) {
UdpAddress address = new UdpAddress(addr + "/" + port);
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString(community));
target.setAddress(address);
target.setRetries(2);
target.setTimeout(5000);
target.setVersion(SnmpConstants.version2c);
return target;
}
public Boolean validate(String addr, String port, String community) throws Exception {
String testOid = "1.3.6.1.2.1.1.3.0";
Map<String, String> result = this.get(addr, port, community, new String[]{testOid});
if (result.get(testOid) != null) return true;
return false;
}
public Map<String, String> walk(String addr, String port, String community, String oidStr) throws Exception {
TreeUtils treeUtils = new TreeUtils(this.snmp, new DefaultPDUFactory());
CommunityTarget target = getTarget(addr, port, community);
return super.walk(oidStr, target, treeUtils);
}
public Map<String, String> get(String addr, String port, String community, String[] oids) throws Exception {
CommunityTarget target = getTarget(addr, port, community);
PDU pdu = new PDU();
for (String oid : oids) {
pdu.add(new VariableBinding(new OID(oid)));
}
pdu.setType(PDU.GET);
pdu.setRequestID(new Integer32(1));
return super.get(this.snmp, pdu, target);
}
}

View File

@ -0,0 +1,148 @@
package com.loafle.overflow.probe.container.crawler.impl.snmp.version;
import org.snmp4j.*;
import org.snmp4j.mp.MPv3;
import org.snmp4j.mp.MessageProcessingModel;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.security.*;
import org.snmp4j.smi.*;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.util.PDUFactory;
import org.snmp4j.util.TreeUtils;
import java.util.Map;
/**
* Created by insanity on 17. 4. 10.
*/
public class SNMPv3 extends SNMP {
private Snmp snmp = null;
public SNMPv3(Snmp snmp) {
this.snmp = snmp;
}
public Boolean validate(String addr, String port, String user, String authType, String authPass, String privType, String privPass) throws Exception {
String testOid = "1.3.6.1.2.1.1.3.0";
Map<String, String> result = this.get(addr, port, user, authType, authPass, privType, privPass, new String[]{testOid});
if (result.get(testOid) != null) return true;
return false;
}
public Map<String, String> walk(String addr, String port, String user, String authType, String authPass, String privType, String privPass, String oidStr)
throws Exception {
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(usm);
UsmUser usmUser = getUser(user, authType, authPass, privType, privPass);
this.snmp.getUSM().addUser(new OctetString(user), usmUser);
TreeUtils treeUtils = new TreeUtils(this.snmp, new PDUFactory() {
public PDU createPDU(Target target) {
ScopedPDU sp = new ScopedPDU();
sp.setRequestID(new Integer32(1));
return sp;
}
public PDU createPDU(MessageProcessingModel messageProcessingModel) {
return new ScopedPDU();
}
});
Target target = getTarget(addr, port, usmUser);
return super.walk(oidStr, target, treeUtils);
}
public Map<String, String> get(String addr, String port, String user, String authType, String authPass, String privType, String privPass, String[] oids)
throws Exception {
TransportMapping<? extends Address> transport = new DefaultUdpTransportMapping();
Snmp snmp = new Snmp(transport);
transport.listen();
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(usm);
UsmUser usmUser = getUser(user, authType, authPass, privType, privPass);
this.snmp.getUSM().addUser(new OctetString(user), usmUser);
PDU pdu = new ScopedPDU();
for (String oid : oids) {
pdu.addOID(new VariableBinding(new OID(oid)));
}
pdu.setType(PDU.GET);
pdu.setRequestID(new Integer32(1));
Target target = getTarget(addr, port, usmUser);
return super.get(snmp, pdu, target);
}
private UserTarget getTarget(String addr, String port, UsmUser user) {
UdpAddress address = new UdpAddress(addr + "/" + port);
UserTarget target = new UserTarget();
target.setAddress(address);
target.setRetries(2);
target.setTimeout(5000);
target.setVersion(SnmpConstants.version3);
target.setSecurityModel(user.getSecurityModel());
int secLv;
OID autyType = user.getAuthenticationProtocol();
OID privType = user.getPrivacyProtocol();
if (autyType != null && privType != null) {
secLv = SecurityLevel.AUTH_PRIV;
}else if (autyType != null && privType == null) {
secLv = SecurityLevel.AUTH_NOPRIV;
}else {
secLv = SecurityLevel.NOAUTH_NOPRIV;
}
target.setSecurityLevel(secLv);
target.setSecurityName(new OctetString(user.getSecurityName()));
return target;
}
private UsmUser getUser(String user, String authType, String authPass, String privType, String privPass) {
OctetString octetUser = new OctetString(user);
OctetString octetAuthPass = authPass.equals("") ? null : new OctetString(authPass);
OctetString octetPrivPass = privPass.equals("") ? null : new OctetString(privPass);
UsmUser usmUser = new UsmUser(octetUser, getAuthOID(authType), octetAuthPass, getPrivOID(privType), octetPrivPass);
return usmUser;
}
private OID getAuthOID(String authType) {
OID authOID = null;
switch(authType) {
case "":
authOID = null;
break;
case "MD5":
authOID = AuthMD5.ID;
break;
case "SHA":
authOID = AuthSHA.ID;
break;
}
return authOID;
}
private OID getPrivOID(String privType) {
OID privOID = null;
switch(privType) {
case "":
privOID = null;
break;
case "DES":
privOID = PrivDES.ID;
break;
case "AES":
privOID = PrivAES128.ID;
break;
}
return privOID;
}
}

View File

@ -0,0 +1,74 @@
package com.loafle.overflow.probe.container.crawler.impl.wmi;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class WMICrawler extends Crawler {
public String name() {
return "WMI_CRAWLER";
}
@Override
public List<ResultSet> getInternal(Config config) throws Exception {
return WMICrawlerOS.getInstance().process(config);
}
@Override
public Object getInternalMeta(Config c) throws Exception {
List<Config> metaConfigList = loadMetaConfig();
List<ResultSet> retlist = new ArrayList<>();
WMICrawlerOS os = WMICrawlerOS.getInstance();
ResultSet ofResultSet = null;
for(Config metaConfig : metaConfigList) {
for(int indexI = 0; indexI < metaConfig.getItems().size(); ++indexI) {
ofResultSet = os.processWMI(c, metaConfig.getItems().get(indexI));
if(ofResultSet != null) {
retlist.add(ofResultSet);
}
}
}
return null;
}
private List<Config> loadMetaConfig() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource("config/meta");
if(url == null) {
return null;
}
String path = url.getFile();
File pathFile = new File(path);
System.out.println(path);
String[] metaFiles = pathFile.list();
List<Config> retList = new ArrayList<>();
Config metaConfig = null;
for(String fi : metaFiles) {
if(fi.indexOf("meta_") > -1) {
metaConfig = objectMapper.readValue(new File(path+"/"+fi), Config.class);
if(metaConfig != null) {
retList.add(metaConfig);
}
}
}
return retList;
}
}

View File

@ -0,0 +1,153 @@
package com.loafle.overflow.probe.container.crawler.impl.wmi;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.util.*;
public class WMICrawlerLinux extends WMICrawlerOS {
private final String DELIMITER = "||";
private final String DELIMITER_SPLIT = "\\|\\|";
public ResultSet processWMI(Config config, Item item) throws Exception {
List<String> argList = createCommand(config, item);
String result = execute(argList.toArray(new String[argList.size()]));
ResultSet ofResultSet = parseResult(result, item);
return ofResultSet;
}
public List<String> createCommand(Config config, Item item) throws Exception {
String id = (String)config.getTarget().getAuth().get("id");
String pw = (String)config.getTarget().getAuth().get("pw");
String nameSpace = (String)item.getQueryInfo().getExtend().get("nameSpace");
String ip = config.getTarget().getConnection().getIp();
String query = item.getQueryInfo().getQuery();
String wmicPath = (String)item.getQueryInfo().getExtend().get("wmicPath");
//FIXME:: where is wmic ??
List<String> argList = new ArrayList<String>();
argList.add(wmicPath);
argList.add("-U");
argList.add(id + "%" + pw);
argList.add("//" + ip);
argList.add(query);
argList.add("--namespace=" + nameSpace);
argList.add("--delimiter=" + DELIMITER);
return argList;
}
public String execute(String... args) throws Exception {
System.out.println("");
ProcessBuilder builder = new ProcessBuilder(args);
Process process = builder.start();
byte[] msg = new byte[1024];
StringBuffer buf = new StringBuffer();
while(process.getInputStream().read(msg) > 0) {
buf.append(new String(msg));
Arrays.fill(msg, (byte)0);
}
return buf.toString();
}
public ResultSet parseResult(String result, Item item) throws Exception {
if(result == null || result.length() <= 0) {
return null;
}
result = result.trim();
String errStr = checkError(result);
if(errStr.length() > 0) {
throw new Exception(errStr);
}
String[] lines = result.split("\\n");
String line = "";
ResultSet ofResultSet = ResultSet.newInstance(item);
Map<String, Integer> metaMap = ofResultSet.getMeta();
List<String> columns = null;
Map<String, String> tempMap = new HashMap<String, String>();
List<String> row = null;
for (int indexI = 0 ; indexI < lines.length; ++indexI) {
tempMap.clear();
line = lines[indexI].trim();
if (line.length() <= 0) continue;
if(indexI == 0) {
int idx = line.indexOf("CLASS:");
if (idx >= 0 ) {
continue;
}
}
if (columns == null) {
String[] datas = line.split(DELIMITER_SPLIT);
columns = Arrays.asList(datas);
continue;
}
row = new ArrayList<>(Arrays.asList(new String[metaMap.size()]));
String[] datas = line.split(DELIMITER_SPLIT);
for(int indexJ = 0; indexJ < columns.size(); ++indexJ) {
tempMap.put(columns.get(indexJ), datas[indexJ]);
}
int tempSize = tempMap.size();
int metaSize = metaMap.size();
int resultSize = tempSize - metaSize;
int currentIdx = 0;
for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
currentIdx = info.getValue().intValue();
if(currentIdx >= metaSize) {
currentIdx -= resultSize;
}
row.set(currentIdx, tempMap.get(info.getKey()));
}
ofResultSet.addRow(row);
}
return ofResultSet;
}
public String checkError(String result) {
int errIdx = result.indexOf("ERROR:");
String retErrStr = "";
if(errIdx >= 0) {
int enterIdx = result.indexOf("\\n", errIdx);
if(enterIdx < 0) enterIdx = result.length();
String errStr = result.substring(errIdx + "ERROR:".length(), enterIdx);
// Map<String,String> map = new HashMap<>();
// map.put("ERROR", errStr);
// resultMapList.add(map);
// return resultMapList;
retErrStr = errStr;
}
return retErrStr;
}
}

View File

@ -0,0 +1,47 @@
package com.loafle.overflow.probe.container.crawler.impl.wmi;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.util.ArrayList;
import java.util.List;
public abstract class WMICrawlerOS {
private static WMICrawlerOS wmiCrawlerOS = null;
public static WMICrawlerOS getInstance() {
if(WMICrawlerOS.wmiCrawlerOS == null) {
String os = System.getProperty("os.name").toLowerCase();
if(os.indexOf("linux") >= 0) {
WMICrawlerOS.wmiCrawlerOS = new WMICrawlerLinux();
} else if(os.indexOf("") >= 0) {
WMICrawlerOS.wmiCrawlerOS = new WMICrawlerWindows();
}
}
return WMICrawlerOS.wmiCrawlerOS;
}
public List<ResultSet> process(Config config) throws Exception {
List<ResultSet> retlist = new ArrayList<>();
ResultSet ofResultSet = null;
for(int cIndexI = 0 ; cIndexI < config.getItems().size() ; ++cIndexI) {
ofResultSet = processWMI(config, config.getItems().get(cIndexI));
retlist.add(ofResultSet);
}
return retlist;
}
public abstract ResultSet processWMI(Config config, Item item) throws Exception ;
}

View File

@ -0,0 +1,254 @@
package com.loafle.overflow.probe.container.crawler.impl.wmi;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.EnumVariant;
import com.jacob.com.Variant;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class WMICrawlerWindows extends WMICrawlerOS {
public ResultSet processWMI(Config config, Item item) throws Exception {
String query = "";
ActiveXComponent wmiconnect = null;
ResultSet ofResultSet = null;
query = item.getQueryInfo().getQuery();
wmiconnect = connectServer(config, item);
Variant vQuery = new Variant(query);
Variant vCollection = wmiconnect.invoke("ExecQuery", vQuery);
wmiconnect.safeRelease();
vQuery.safeRelease();
Dispatch dConnection = vCollection.toDispatch();
vCollection.safeRelease();
// int count = getCount(dConnection);
EnumVariant enumVariant = new EnumVariant(dConnection);
dConnection.safeRelease();
ofResultSet = getResultSet(enumVariant, item);
enumVariant.safeRelease();
return ofResultSet;
}
protected ResultSet getResultSet(EnumVariant enumVariant, Item citem) {
ResultSet ofResultSet = ResultSet.newInstance(citem);
Variant vItem = null;
Dispatch item = null;
Variant vValue = null;
String value = null;
List<String> row = null;
Map<String,Integer> metaMap = ofResultSet.getMeta();
while (enumVariant.hasMoreElements()) {
row = new ArrayList<>(Arrays.asList(new String[metaMap.size()]));
vItem = enumVariant.nextElement();
item = vItem.toDispatch();
for (Map.Entry<String, Integer> info : metaMap.entrySet()) {
vValue = Dispatch.call(item, info.getKey());
value = vValue.toString();
vValue.safeRelease();
row.set(info.getValue().intValue(), value);
}
vItem.safeRelease();
item.safeRelease();
ofResultSet.addRow(row);
}
return ofResultSet;
}
//
// protected void getMultiValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
//
// Variant vItem = null;
// Dispatch item = null;
//
//
// int keyIdx = 0;
// while (enumVariant.hasMoreElements()) {
//
// vItem = enumVariant.nextElement();
// item = vItem.toDispatch();
//
//
// String name = null;
// String value = null;
// Variant vValue = null;
//
// for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
// name = cQuery.getKeys().get(indexI);
// vValue = Dispatch.call(item, name);
// value = vValue.toString();
// String keyStr = convertArrayKey(cItem.getMetrics().get(indexI),keyIdx );
// resultMap.put(keyStr, value);
// vValue.safeRelease();
// }
//
// vItem.safeRelease();
// item.safeRelease();
// ++idxMetric;
// ++keyIdx;
// }
//
// }
protected String convertArrayKey(String key, int index) {
int idx = key.indexOf("[");
String ret = "";
if(idx <= 0) {
idx = key.indexOf(".");
ret += key.substring(0, idx);
ret += "[";
ret += String.valueOf(index);
ret += "]";
ret += key.substring(idx +1);
}else {
ret += key.substring(0, idx +1);
ret += String.valueOf(index);
ret += key.substring(idx +1);
}
return ret;
}
// protected void getSingleValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
//
// Variant vItem = null;
// Dispatch item = null;
//
// while (enumVariant.hasMoreElements()) {
//
// vItem = enumVariant.nextElement();
// item = vItem.toDispatch();
//
// String name = null;
// String value = null;
// Variant vValue = null;
//
// for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
// name = cQuery.getKeys().get(indexI);
// vValue = Dispatch.call(item, name);
// value = vValue.toString();
// resultMap.put(cItem.getMetrics().get(idxMetric++), value);
// vValue.safeRelease();
// }
//
// vItem.safeRelease();
// item.safeRelease();
// }
//
// }
protected List<String> getColumns(Dispatch item) {
List<String> columns = new ArrayList<String>();
Variant propertyesa = Dispatch.call(item, "Properties_");
Dispatch disProperty = propertyesa.toDispatch();
Variant newEnum = Dispatch.call(disProperty, "_NewEnum");
propertyesa.safeRelease();
disProperty.safeRelease();
EnumVariant enumv = newEnum.toEnumVariant();
newEnum.safeRelease();
Variant vElem = null;
Dispatch disElem = null;
Variant vName = null;
while (enumv.hasMoreElements()) {
vElem = enumv.nextElement();
disElem = vElem.toDispatch();
vName = Dispatch.call(disElem, "Name");
String vs = vName.toString();
columns.add(vs);
disElem.safeRelease();
vElem.safeRelease();
vName.safeRelease();
}
enumv.safeRelease();
return columns;
}
protected int getCount(Dispatch d) {
Variant c = Dispatch.call(d, "Count");
int retInt = Integer.valueOf(c.toString());
c.safeRelease();
return retInt;
}
protected ActiveXComponent connectServer(Config config, Item item) {
String id = (String)config.getTarget().getAuth().get("id");
String pw = (String)config.getTarget().getAuth().get("pw");
String nameSpace = (String)item.getQueryInfo().getExtend().get("nameSpace");
// String query = (String)config.get.get("query");
String ip = config.getTarget().getConnection().getIp();
ActiveXComponent wmi = null;
wmi = new ActiveXComponent("WbemScripting.SWbemLocator");
Variant vIp = new Variant(ip);
Variant vNs = new Variant(nameSpace);
Variant vId = new Variant(id);
Variant vPw = new Variant(pw);
Variant conRet = wmi.invoke("ConnectServer", vIp, vNs, vId, vPw);
vIp.safeRelease();
vNs.safeRelease();
vId.safeRelease();
vPw.safeRelease();
Dispatch disConret = conRet.toDispatch();
ActiveXComponent wmiconnect = new ActiveXComponent(disConret);
disConret.safeRelease();
wmi.safeRelease();
conRet.safeRelease();
return wmiconnect;
}
}

View File

@ -0,0 +1,75 @@
package com.loafle.overflow.probe.container.crawler.result;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.config.MappingInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public abstract class ResultSet {
// properties
protected Item item;
protected List<List<String>> rows;
protected Map<String, Integer> meta = null;
public Map<String, Integer> getMeta() {
return meta;
}
public void setMeta(Map<String, Integer> meta) {
this.meta = meta;
}
public List<List<String>> getRows() {
return rows;
}
public void setRows(List<List<String>> rows) {
this.rows = rows;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
// methods
static public ResultSet newInstance(Item item) {
if (item.getMappingInfo() == null) {
item.setMappingInfo(new MappingInfo());
}
String type = (String) item.getMappingInfo().getParseDirection();
if (type != null && type.equals("row")) {
return new ResultSetRow(item);
} else {
return new ResultSetCol(item);
}
}
public ResultSet(Item item) {
this.item = item;
this.rows = new ArrayList<>();
this.setMeta();
}
public void addRow(List<String> row) {
rows.add(row);
}
public Map<String,String> getData() {
return parse();
}
// abstracts
public abstract void setMeta();
public abstract Map<String, String> parse();
}

View File

@ -0,0 +1,106 @@
package com.loafle.overflow.probe.container.crawler.result;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.config.Keys;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ResultSetCol extends ResultSet{
public ResultSetCol(Item item) {
super(item);
}
public void setMeta() {
List<Keys> meta = this.item.getKeys();
List<String> arrayColumns = this.item.getMappingInfo().getArrayColumns();
if(this.meta == null) {
this.meta = new HashMap<>();
}
for(int indexI = 0; indexI < meta.size(); ++indexI) {
this.meta.put(meta.get(indexI).getKey(), indexI);
}
if( arrayColumns != null) {
for( int indexI = 0 ; indexI < arrayColumns.size(); ++indexI) {
if(this.meta.containsKey(arrayColumns.get(indexI))) {
continue;
}
this.meta.put(arrayColumns.get(indexI), indexI+ meta.size());
}
}
}
public Map<String, String> parse() {
List<Keys> metrics = this.item.getKeys();
List<String> arrayColumns = this.item.getMappingInfo().getArrayColumns();
Map<String, String> resultMap = new HashMap<>();
List<String> row = null;
String metric = null;
List<String> arrayValue = new ArrayList<>();
int columnIdx = 0;
for(int indexI = 0; indexI < this.rows.size(); ++indexI) {
row = this.rows.get(indexI);
for (int indexJ= 0; indexJ < row.size(); ++indexJ) {
arrayValue.clear();
if(arrayColumns != null ) {
for(int indexL =0; indexL < arrayColumns.size(); ++indexL) {
columnIdx = this.meta.get(arrayColumns.get(indexL));
arrayValue.add(row.get(columnIdx));
}
}
for(int indexK = 0 ; indexK < metrics.size(); ++indexK) {
metric = metrics.get(indexK).getMetric();
metric = convertMetric(metric, arrayValue);
resultMap.put(metric, row.get(indexK));
}
}
}
return resultMap;
}
private String convertMetric(String metric, List<String> arrayValue) {
if(arrayValue == null || arrayValue.size() <= 0) {
return metric;
}
String convertChar = "$";
String convertStr = null;
for(int indexI = 0 ; indexI < arrayValue.size(); ++indexI) {
convertStr = convertChar + String.valueOf(indexI);
metric = metric.replace(convertStr, arrayValue.get(indexI));
}
return metric;
}
}

View File

@ -0,0 +1,104 @@
package com.loafle.overflow.probe.container.crawler.result;
import com.loafle.overflow.probe.container.crawler.config.Item;
import com.loafle.overflow.probe.container.crawler.config.Keys;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ResultSetRow extends ResultSet{
public ResultSetRow(Item item) {
super(item);
}
public void setMeta() {
List<String> meta = new ArrayList<>();
List<String> arrayColumns = (List<String>) this.item.getMappingInfo().getArrayColumns();
List<String> keyColumns = (List<String>) this.item.getMappingInfo().getKeyColumns();
String valueColumn = (String) this.item.getMappingInfo().getValueColumn();
if (arrayColumns != null) {
for (String c : arrayColumns) {
meta.add(c);
}
}
if (keyColumns != null) {
for (String c: keyColumns) {
meta.add(c);
}
}
if (valueColumn != null && !valueColumn.equals(""))
meta.add(valueColumn);
if(this.meta == null) {
this.meta = new HashMap<>();
}
for(int indexI = 0; indexI < meta.size(); ++indexI) {
this.meta.put(meta.get(indexI), indexI);
}
}
public Map<String, String> parse() {
Map<String, String> returnMap = new HashMap<>();
String valueColumn = (String) this.item.getMappingInfo().getValueColumn();
for (List<String> row : this.rows) {
String key = makeKey(row);
if(key == null) continue;
returnMap.put(key,row.get(this.meta.get(valueColumn)));
}
return returnMap;
}
private String makeKey(List<String> data) {
List<Keys> metrics = this.item.getKeys();
List<String> arrayColumns = (List<String>) this.item.getMappingInfo().getArrayColumns();
List<String> keyColumns = (List<String>) this.item.getMappingInfo().getKeyColumns();
List<Keys> keys = this.item.getKeys();
boolean find = false;
int findIndex = -1;
for (String keyColumn: keyColumns) {
String row = data.get(this.meta.get(keyColumn));
for (int i =0 ; i < keys.size() ; ++i) {
if (row.equals(keys.get(i).getKey())) {
findIndex = i;
find = true;
break;
}
}
if (find == true) {break;}
}
if(findIndex < 0) {
return null;
}
String metric = metrics.get(findIndex).getMetric();
if (arrayColumns != null) {
for (int i =0 ; i< arrayColumns.size() ; ++i) {
// replace
String k = "$" + i;
int dataIndex = this.meta.get(arrayColumns.get(i));
String replaceString = data.get(dataIndex);
metric = metric.replace(k,"'" + replaceString + "'");
}
}
return metric;
}
}

View File

@ -1,14 +1,9 @@
package com.loafle.overflow.probe.container.rpc.invoker.spring;
package com.loafle.overflow.probe.container.rpc.invoker.impl;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.rpc.invoker.Invoker;
import com.loafle.overflow.probe.container.util.Primitives;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.lang.reflect.Method;
@ -18,17 +13,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class SpringInvoker implements Invoker {
@Autowired
private ApplicationContext applicationContext;
@Autowired
public class SimpleInvoker implements Invoker {
private ObjectMapper objectMapper;
private Map<String, Object> services;
private Map<String, Cache> serviceCacheMap;
public SpringInvoker() {
public SimpleInvoker(ObjectMapper objectMapper, Map<String, Object> services) {
this.objectMapper = objectMapper;
this.services = services;
serviceCacheMap = new HashMap<>();
}
@ -36,15 +30,15 @@ public class SpringInvoker implements Invoker {
private ServiceCache serviceCache;
private Map<String, MethodCache> methodCacheMap;
private Cache(Object bean) {
private Cache(Object service) {
serviceCache = new ServiceCache();
serviceCache.bean = bean;
serviceCache.service = service;
methodCacheMap = new HashMap<>(10);
}
private Object getBean() {
return serviceCache.bean;
private Object getService() {
return serviceCache.service;
}
private MethodCache getMethodCache(String methodName) throws NoSuchMethodException {
@ -74,7 +68,7 @@ public class SpringInvoker implements Invoker {
}
private Method getMethod(String methodName) {
Class<?> clazz = AopUtils.getTargetClass(serviceCache.bean);
Class<?> clazz = serviceCache.service.getClass();
Method[] methods = clazz.getMethods();
Method targetMethod = null;
@ -88,7 +82,7 @@ public class SpringInvoker implements Invoker {
}
private static class ServiceCache {
private Object bean;
private Object service;
private Map<String, MethodCache> methodCacheMap;
}
private static class MethodCache {
@ -103,13 +97,13 @@ public class SpringInvoker implements Invoker {
if (null != serviceCache) {
return serviceCache;
}
try {
Object bean = applicationContext.getBean(serviceName);
serviceCache = new Cache(bean);
serviceCacheMap.put(serviceName, serviceCache);
} catch (BeansException e) {
throw new Exception();
Object service = services.get(serviceName);
if (null == service) {
throw new Exception(String.format("Invoker: Service[%s] is not exist", serviceName));
}
serviceCache = new Cache(service);
serviceCacheMap.put(serviceName, serviceCache);
return serviceCache;
}
@ -171,7 +165,7 @@ public class SpringInvoker implements Invoker {
Object result = null;
try {
result = methodCache.method.invoke(serviceCache.getBean(), parameters);
result = methodCache.method.invoke(serviceCache.getService(), parameters);
} catch (Exception e) {
throw e;
}

View File

@ -1,26 +1,17 @@
package com.loafle.overflow.probe.container.server;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.json.JsonObjectDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.util.CharsetUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
@Qualifier("containerChannelInitializer")
public class ContainerChannelInitializer extends ChannelInitializer<Channel> {
private static final StringDecoder STRING_DECODER = new StringDecoder(CharsetUtil.UTF_8);
private static final StringEncoder STRING_ENCODER = new StringEncoder(CharsetUtil.UTF_8);
@Autowired
@Qualifier("containerJSONHandler")
private ChannelInboundHandlerAdapter containerJSONHandler;
@Override
protected void initChannel(Channel channel) throws Exception {
@ -30,7 +21,7 @@ public class ContainerChannelInitializer extends ChannelInitializer<Channel> {
.addLast(new JsonObjectDecoder(Integer.MAX_VALUE))
.addLast(STRING_DECODER)
.addLast(STRING_ENCODER)
.addLast(containerJSONHandler);
.addLast(ContainerConfiguration.channelInboundHandlerAdapter());
}
}

View File

@ -1,52 +1,86 @@
package com.loafle.overflow.probe.container.server;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.impl.database.mysql.MySQLCrawler;
import com.loafle.overflow.probe.container.crawler.impl.database.oracle.OracleCrawler;
import com.loafle.overflow.probe.container.crawler.impl.database.postgresql.PostgreSQLCrawler;
import com.loafle.overflow.probe.container.crawler.impl.database.sqlserver.SQLServerCrawler;
import com.loafle.overflow.probe.container.crawler.impl.jmx.JMXCrawler;
import com.loafle.overflow.probe.container.crawler.impl.mongodb.MongoDBCrawler;
import com.loafle.overflow.probe.container.crawler.impl.redis.RedisCralwer;
import com.loafle.overflow.probe.container.crawler.impl.snmp.SNMPCrawler;
import com.loafle.overflow.probe.container.crawler.impl.wmi.WMICrawler;
import com.loafle.overflow.probe.container.rpc.invoker.Invoker;
import com.loafle.overflow.probe.container.rpc.invoker.impl.SimpleInvoker;
import com.loafle.overflow.probe.container.service.ConfigService;
import com.loafle.overflow.probe.container.service.DataService;
import com.loafle.overflow.probe.container.service.StateService;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class ContainerConfiguration {
private int port = 19390;
public abstract class ContainerConfiguration {
private static ObjectMapper objectMapper;
private static ContainerChannelInitializer channelInitializer;
private static ChannelInboundHandlerAdapter channelInboundHandlerAdapter;
private static Invoker invoker;
private static Map<String, Crawler> crawlers = new HashMap<>();
private static Map<String, Object> services = new HashMap<>();
@Autowired
private ContainerChannelInitializer containerChannelInitializer;
static {
addCrawler(new MySQLCrawler());
addCrawler(new OracleCrawler());
addCrawler(new PostgreSQLCrawler());
addCrawler(new SQLServerCrawler());
addCrawler(new JMXCrawler());
addCrawler(new MongoDBCrawler());
addCrawler(new RedisCralwer());
addCrawler(new SNMPCrawler());
addCrawler(new WMICrawler());
@Bean(destroyMethod = "shutdownGracefully")
public NioEventLoopGroup bossGroup() {
return new NioEventLoopGroup();
addService(new ConfigService(crawlers));
addService(new DataService(crawlers));
addService(new StateService(crawlers));
}
@Bean(destroyMethod = "shutdownGracefully")
public NioEventLoopGroup workerGroup() {
return new NioEventLoopGroup();
private static void addCrawler(Crawler crawler) {
String name = crawler.name();
crawlers.put(name, crawler);
}
@Bean
public InetSocketAddress socketAddress() {
return new InetSocketAddress("127.0.0.1", port);
private static void addService(Object service) {
String name = service.getClass().getSimpleName();
services.put(name, service);
}
@Bean
public ServerBootstrap serverBootstrap() {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap
.group(bossGroup(), workerGroup())
.channel(NioServerSocketChannel.class)
.childHandler(containerChannelInitializer);
return serverBootstrap;
public static ObjectMapper objectMapper() {
if (null == objectMapper) {
objectMapper = new ObjectMapper();
}
return objectMapper;
}
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
public static ChannelInitializer channelInitializer() {
if (null == channelInitializer) {
channelInitializer = new ContainerChannelInitializer();
}
return channelInitializer;
}
public static ChannelInboundHandlerAdapter channelInboundHandlerAdapter() {
if (null == channelInboundHandlerAdapter) {
channelInboundHandlerAdapter = new ContainerJSONHandler();
}
return channelInboundHandlerAdapter;
}
public static Invoker invoker() {
if (null == invoker) {
invoker = new SimpleInvoker(objectMapper(), services);
}
return invoker;
}
}

View File

@ -8,23 +8,15 @@ import com.loafle.overflow.probe.container.rpc.protocol.json.ServerResponse;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
@Qualifier("containerJSONHandler")
@ChannelHandler.Sharable
public class ContainerJSONHandler extends SimpleChannelInboundHandler<String> {
@Autowired
private ObjectMapper objectMapper;
@Autowired
private Invoker invoker;
@Override
protected void channelRead0(ChannelHandlerContext ctx, String s) throws Exception {
ObjectMapper objectMapper = ContainerConfiguration.objectMapper();
Invoker invoker = ContainerConfiguration.invoker();
ServerRequest req = objectMapper.readValue(s, ServerRequest.class);
ServerResponse res = null;
try {

View File

@ -1,34 +1,39 @@
package com.loafle.overflow.probe.container.server;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import javax.annotation.PreDestroy;
import java.net.InetSocketAddress;
@Component
public class ContainerServer {
@Autowired
private ServerBootstrap serverBootstrap;
@Autowired
private InetSocketAddress socketAddress;
private Channel channel;
private int port = 19390;
public ContainerServer() {
}
public void start() throws Exception {
channel = serverBootstrap.bind(socketAddress).sync().channel().closeFuture().sync().channel();
InetSocketAddress socketAddress = new InetSocketAddress("127.0.0.1", port);
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup(10);
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(ContainerConfiguration.channelInitializer())
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true);
ChannelFuture f = b.bind(socketAddress).sync();
f.channel().closeFuture().sync();
} finally {
workerGroup.shutdownGracefully();
bossGroup.shutdownGracefully();
}
}
@PreDestroy
public void stop() throws Exception {
channel.close();
channel.parent().close();
}
}

View File

@ -0,0 +1,27 @@
package com.loafle.overflow.probe.container.service;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.config.Config;
import java.util.Map;
public class ConfigService extends Service {
public ConfigService(Map<String, Crawler> crawlers) {
super(crawlers);
}
public boolean init(String crawlerName, Config config) throws Exception {
Crawler crawler = getCrawler(crawlerName);
return crawler.init(config);
}
public boolean add(String crawlerName, Config config) throws Exception {
Crawler crawler = getCrawler(crawlerName);
return crawler.add(config);
}
public boolean remove(String crawlerName, String id) throws Exception {
Crawler crawler = getCrawler(crawlerName);
return crawler.remove(id);
}
}

View File

@ -0,0 +1,18 @@
package com.loafle.overflow.probe.container.service;
import com.loafle.overflow.probe.container.crawler.Crawler;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.util.List;
import java.util.Map;
public class DataService extends Service {
public DataService(Map<String, Crawler> crawlers) {
super(crawlers);
}
public List<ResultSet> get(String crawlerName, String id) throws Exception {
Crawler crawler = getCrawler(crawlerName);
return crawler.get(id);
}
}

View File

@ -0,0 +1,19 @@
package com.loafle.overflow.probe.container.service;
import com.loafle.overflow.probe.container.crawler.Crawler;
import java.util.Map;
public abstract class Service {
private Map<String, Crawler> crawlers;
protected Service(Map<String, Crawler> crawlers) {
this.crawlers = crawlers;
}
protected Crawler getCrawler(String crawlerName) throws Exception {
if (!this.crawlers.containsKey(crawlerName)) {
throw new Exception(String.format("Container: Crawler[%s] is not exist", crawlerName));
}
return this.crawlers.get(crawlerName);
}
}

View File

@ -0,0 +1,15 @@
package com.loafle.overflow.probe.container.service;
import com.loafle.overflow.probe.container.crawler.Crawler;
import java.util.Map;
public class StateService extends Service {
public StateService(Map<String, Crawler> crawlers) {
super(crawlers);
}
public boolean status() throws Exception {
return true;
}
}

View File

@ -1,25 +0,0 @@
package com.loafle.overflow.probe.container;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
public class ApplicationTests {
@Autowired
private ApplicationContext applicationContext;
@Test
public void testStart() throws Exception {
}
}

View File

@ -0,0 +1,13 @@
package com.loafle.overflow.probe.container.crawler;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
public abstract class CrawlerTest {
protected ObjectMapper objectMapper;
@Before
public void setUp() throws Exception {
objectMapper = new ObjectMapper();
}
}

View File

@ -0,0 +1,62 @@
package com.loafle.overflow.probe.container.crawler.impl.database;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class DatabaseCrawlerTest extends CrawlerTest {
// //MySQL
// info.setUrl("jdbc:mysql://192.168.1.215:3306"); // ?useSSL=true&verifyServerCertificate=false
// info.setId("root");
// info.setPw("qwe123");
// info.setSSL(false);
// info.setQuery("show session status");
// //MSSQL
// info.setUrl("jdbc:sqlserver://192.168.1.103:1433;"); //encrypt=false;trustServerCertificate=true"
// info.setId("sa");
// info.setPw("qwer5795");
// info.setSSL(true);
// info.setQuery("select * from master.dbo.sysprocesses");
// //PGSQL
// info.setUrl("jdbc:postgresql://192.168.1.107:5432/postgres");
// info.setId("postgres");
// info.setPw("!@#$qwer1234");
// info.setSSL(false);
// info.setQuery("select * from pg_stat_activity");
// //Oracle
// info.setUrl("jdbc:oracle:thin:@192.168.1.30:1521/oracle.loafle.com");
// info.setId("sys as sysdba");
// info.setPw("qwer5795QWER");
// info.setSSL(false);
// info.setQuery("select * from v$sysstat");
protected Config getConfig(String path) throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
String filePath = classLoader.getResource(path).getFile();
Config c = objectMapper.readValue(new File(filePath),Config.class);
return c;
}
protected void print(String s, List<ResultSet> mm) {
System.out.println(s);
Map<String,String> m = new HashMap<>();
for(ResultSet r : mm) {
m.putAll(r.getData());
}
for (Map.Entry<String, String> item : m.entrySet()) {
System.out.println("key=" + item.getKey() + " ||||||||||| value=" + item.getValue());
}
}
}

View File

@ -0,0 +1,15 @@
package com.loafle.overflow.probe.container.crawler.impl.database.mysql;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawlerTest;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Test;
import java.util.List;
public class MySQLCrawlerTest extends DatabaseCrawlerTest {
@Test
public void testMySQL() throws Exception {
Object result = new MySQLCrawler().getInternal( getConfig("config/mysql/mysql-test.json"));
print("MySQL row", (List<ResultSet>) result);
}
}

View File

@ -0,0 +1,15 @@
package com.loafle.overflow.probe.container.crawler.impl.database.oracle;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawlerTest;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Test;
import java.util.List;
public class OracleCrawlerTest extends DatabaseCrawlerTest {
@Test
public void testMySQL() throws Exception {
Object result = new OracleCrawler().getInternal( getConfig("config/oracle/oracle-test.json"));
print("Oracle row", (List<ResultSet>) result);
}
}

View File

@ -0,0 +1,15 @@
package com.loafle.overflow.probe.container.crawler.impl.database.postgresql;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawlerTest;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Test;
import java.util.List;
public class PostgreSQLCrawlerTest extends DatabaseCrawlerTest {
@Test
public void testPostgreSQL() throws Exception {
Object result = new PostgreSQLCrawler().getInternal( getConfig("config/postgresql/postgresql.json"));
print("PostgreSQL", (List<ResultSet>) result);
}
}

View File

@ -0,0 +1,22 @@
package com.loafle.overflow.probe.container.crawler.impl.database.sqlserver;
import com.loafle.overflow.probe.container.crawler.impl.database.DatabaseCrawlerTest;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Test;
import java.util.List;
public class SQLServerCrawlerTest extends DatabaseCrawlerTest {
@Test
public void testConnection_Count() throws Exception {
Object result = new SQLServerCrawler().getInternal( getConfig("config/sqlserver/sqlserver_connection_count.json"));
print("SQL Server Connection count", (List<ResultSet>) result);
}
@Test
public void testMultiKeyArray() throws Exception {
Object result = new SQLServerCrawler().getInternal( getConfig("config/sqlserver/sqlserver_multiple_key_array.json"));
print("SQL Server MultiArray", (List<ResultSet>) result);
}
}

View File

@ -0,0 +1,6 @@
package com.loafle.overflow.probe.container.crawler.impl.jmx;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
public class JMXCrawlerTest extends CrawlerTest {
}

View File

@ -0,0 +1,65 @@
package com.loafle.overflow.probe.container.crawler.impl.jmx.tomcat;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.impl.jmx.JMXCrawler;
import com.loafle.overflow.probe.container.crawler.impl.jmx.JMXCrawlerTest;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Test;
import java.io.File;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class TomcatCrawlerTest extends JMXCrawlerTest {
@Test
public void testSum() {
assertEquals(1,1);
}
@Test
public void TestDoCrawler() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource("config/tomcat/");
String path = classLoader.getResource("config/tomcat/example1.json").getFile();
Config c = objectMapper.readValue(new File(path),Config.class);
JMXCrawler cr = new JMXCrawler();
List<ResultSet> result = (List<ResultSet>) cr.getInternal(c);
print("",result);
}
//keytool -export -alias alias_name -keystore path_to_keystore_file -rfc -file path_to_certificate_file
private void print(String s, List<ResultSet> mm) {
System.out.println(s);
Map<String,String> m = new HashMap<>();
for(ResultSet r : mm) {
m.putAll(r.getData());
}
for (Map.Entry<String, String> item : m.entrySet()) {
System.out.println("key=" + item.getKey() + " ||||||||||| value=" + item.getValue());
}
}
@Test
public void testParseObject () {
String s = "org.apache.catalina.mbeans.ConnectorMBean[Catalina:type=Connector,port=8080]";
int start = s.indexOf("[");
int end = s.lastIndexOf("]");
s = s.substring(start + 1,end);
assertEquals("Catalina:type=Connector,port=8080",s);
}
}

View File

@ -0,0 +1,45 @@
package com.loafle.overflow.probe.container.crawler.impl.mongodb;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
public class MongoDBCrawlerTest extends CrawlerTest {
@Test
@Ignore
public void TestCollectMetric() throws Exception {
// read test resources config/example.json
ClassLoader classLoader = getClass().getClassLoader();
String path = classLoader.getResource("config/mongodb/example.json").getFile();
Config c = objectMapper.readValue(new File(path),Config.class);
MongoDBCrawler cr = new MongoDBCrawler();
List<ResultSet> rl = (List<ResultSet>)cr.collectMetric(c);
for(int indexI = 0 ; indexI < rl.size(); ++indexI) {
Map<String, String> m = rl.get(indexI).getData();
for( String key : m.keySet()) {
System.out.print("key : " + key);
System.out.print("|| value : ");
System.out.println(m.get(key));
}
}
// assertEquals(6, m.size());
}
}

View File

@ -0,0 +1,47 @@
package com.loafle.overflow.probe.container.crawler.impl.redis;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
public class RedisCralwerTest extends CrawlerTest {
@Test
@Ignore
public void collectMetric() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
String path = classLoader.getResource("config/redis/example.json").getFile();
Config c = objectMapper.readValue(new File(path),Config.class);
RedisCralwer rc = new RedisCralwer();
List<ResultSet> result = (List<ResultSet>) rc.getInternal(c);
print("",result);
}
private void print(String s, List<ResultSet> mm) {
System.out.println(s);
Map<String,String> m = new HashMap<>();
for(ResultSet r : mm) {
m.putAll(r.getData());
}
for (Map.Entry<String, String> item : m.entrySet()) {
System.out.println("key=" + item.getKey() + " ||||||||||| value=" + item.getValue());
}
}
}

View File

@ -0,0 +1,79 @@
package com.loafle.overflow.probe.container.crawler.impl.snmp;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
public class SNMPCrawlerTest extends CrawlerTest {
/***
* v2c test info
* private static String addr = "192.168.1.215";
* private static String port = "161";
* private static String community = "public";
*
* v3 test info
* loafle MD5 "qwer5795" DES "qweqwe123" : AUTHPRIV
* loafle2 SHA "qwer5795" AES "qweqwe123" : AUTHPRIV
* loafle3 MD5 "qwer5795" : AUTHNOPRIV
* loafle4 :NOAUTHNOPRIV
*/
@Ignore
@Test
public void testSNMP3() throws Exception {
SNMPCrawler c = new SNMPCrawler();
ClassLoader classLoader = getClass().getClassLoader();
String p = classLoader.getResource("config/snmp/examplev3.json").getFile();
Config config = objectMapper.readValue(new File(p),Config.class);
Object result = c.getInternal(config);
if(result instanceof Boolean) {
System.out.println("validate : " + result);
}else {
printResult((List<ResultSet>)result);
}
}
@Ignore
@Test
public void testSNMP2c() throws Exception {
SNMPCrawler c = new SNMPCrawler();
ClassLoader classLoader = getClass().getClassLoader();
String p = classLoader.getResource("config/snmp/examplev2.json").getFile();
Config config = objectMapper.readValue(new File(p),Config.class);
Object result = c.getInternal(config);
if(result instanceof Boolean) {
System.out.println("validate : " + result);
}else {
printResult((List<ResultSet>)result);
}
}
private void printResult(List<ResultSet> resultList) {
for(int indexI = 0 ; indexI < resultList.size(); ++indexI) {
Map<String,String> resultMap = resultList.get(indexI).getData();
System.out.println("============================================");
for( String key : resultMap.keySet() ){
System.out.println( String.format("key : %s ||| value : %s", key, resultMap.get(key)) );
}
System.out.println("============================================");
}
}
}

View File

@ -0,0 +1,313 @@
package com.loafle.overflow.probe.container.crawler.impl.wmi;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.probe.container.crawler.CrawlerTest;
import com.loafle.overflow.probe.container.crawler.config.Config;
import com.loafle.overflow.probe.container.crawler.result.ResultSet;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import static org.junit.Assert.*;
public class WMICrawlerTest extends CrawlerTest {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
// @Ignore
@Test
public void testLinuxExe() throws Exception {
String command = "/home/snoop/temp/wmic";
ProcessBuilder builder = new ProcessBuilder(command, "-U","administrator%dbseogns18", "//192.168.1.106", "SELECT Caption FROM Win32_LogicalDisk", "--namespace=root/cimv2", "--delimiter=||");
Process process = builder.start();
byte[] msg = new byte[1024];
StringBuffer buf = new StringBuffer();
while(process.getInputStream().read(msg) > 0) {
buf.append(new String(msg));
Arrays.fill(msg, (byte)0);
}
System.out.println(buf.toString());
}
@Test
public void testWMI() throws Exception {
WMICrawler wmiCrawler = new WMICrawler();
Map<String, Object> map = new HashMap<String, Object>();
// String id = "administrator";
// String pw = "!@#$qwer1234";
// String nameSpace = "root/cimv2";
// String query = "select * from Win32_OperatingSystem";
// String ip = "192.168.1.1";
// map.put("id", "administrator");
// map.put("pw", "!@#$qwer1234");
// map.put("nameSpace", "root/cimv2");
// map.put("query", "select * from Win32_OperatingSystem");
// map.put("ip", "192.168.1.1");
Config config = new Config();
ClassLoader classLoader = getClass().getClassLoader();
String s = classLoader.getResource("config/wmi").getFile();
System.out.println(s);
// Config c = mapper.readValue(new File(classLoader.getResource("config").getFile()),Config.class);
// List<Map<String, String>> resultList = (List<Map<String, String>>)wmiCrawler.getInternal(map);
//
//
// for( Map<String,String> rMap : resultList) {
// for( String key : rMap.keySet() ){
// System.out.println( String.format("key : %s ||| value : %s", key, rMap.get(key)) );
// }
// }
}
@Test
public void testOS() {
System.out.println(System.getProperty("os.name"));
}
@Test
public void testConfig() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
String p = classLoader.getResource("config/wmi/example.json").getFile();
System.out.println(p);
Config c = objectMapper.readValue(new File(p),Config.class);
System.out.println(c);
}
// @Ignore
@Test
public void testWMIJson() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
String p = classLoader.getResource("config/wmi/meta/meta_network.json").getFile();
Config c = objectMapper.readValue(new File(p),Config.class);
// Map<String, Object> map = new HashMap<>();
// map.put("id", "administrator");
// map.put("pw", "!@#$qwer1234");
// c.getTarget().setAuth(map);
// c.getTarget().getAuth().put("id", "administrator");
// c.getTarget().getAuth().put("pw", "!@#$qwer1234");
WMICrawler wmiCrawler = new WMICrawler();
List<ResultSet> resultList = (List<ResultSet>)wmiCrawler.getInternal(c);
PrintResultList(resultList);
// for(int indexI = 0 ; indexI < resultList.size(); ++indexI) {
// Map<String,String> resultMap = resultList.get(indexI).getData();
// System.out.println("============================================");
// for( String key : resultMap.keySet() ){
// System.out.println( String.format("key : %s ||| value : %s", key, resultMap.get(key)) );
// }
// System.out.println("============================================");
// }
}
public void PrintResultList(List<ResultSet> resultList) {
for(int indexI = 0 ; indexI < resultList.size(); ++indexI) {
Map<String,String> resultMap = resultList.get(indexI).getData();
System.out.println("============================================");
for( String key : resultMap.keySet() ){
System.out.println( String.format("key : %s ||| value : %s", key, resultMap.get(key)) );
}
System.out.println("============================================");
}
}
@Test
public void testMetaProcess() throws Exception {
// get targetinfo
ClassLoader classLoader = getClass().getClassLoader();
String p = classLoader.getResource("config/wmi/test.json").getFile();
Config c = objectMapper.readValue(new File(p),Config.class);
List<Config> metaConfigList = loadMetaConfig();
List<ResultSet> retlist = new ArrayList<>();
WMICrawlerOS os = WMICrawlerOS.getInstance();
ResultSet ofResultSet = null;
for(Config metaConfig : metaConfigList) {
for(int indexI = 0; indexI < metaConfig.getItems().size(); ++indexI) {
ofResultSet = os.processWMI(c, metaConfig.getItems().get(indexI));
if(ofResultSet != null) {
retlist.add(ofResultSet);
}
}
}
PrintResultList(retlist);
}
public List<Config> loadMetaConfig() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource("config/wmi/meta");
if(url == null) {
return null;
}
String path = url.getFile();
File pathFile = new File(path);
System.out.println(path);
String[] metaFiles = pathFile.list();
List<Config> retList = new ArrayList<>();
Config metaConfig = null;
for(String fi : metaFiles) {
if(fi.indexOf("meta_") > -1) {
metaConfig = objectMapper.readValue(new File(path+"/"+fi), Config.class);
if(metaConfig != null) {
retList.add(metaConfig);
}
}
}
return retList;
}
@Test
public void testInt() {
Integer a = 1;
aaa(a);
System.out.println(a);
}
public void aaa(Integer a) {
++a;
}
@Test
public void testString() {
String str = "cpu[].usage.system";
int idx = str.indexOf("[");
int arrIdx = 0;
String ret = "";
ret += str.substring(0, idx +1);
ret += String.valueOf(arrIdx);
ret += str.substring(idx +1);
System.out.println(ret);
}
@Test
public void testReplace() {
String aaa = "cpu[$0].usage.system";
String bbb = "$";
String ccc = bbb + String.valueOf(0);
String ddd = aaa.replace(ccc, "asdfasdf");
System.out.println(ddd);
}
@Test
public void testMap() {
Map<String, String> aa = new HashMap<>();
aa.put("111", "123123123");
aa.put("222", "123123123");
Map<String, String> bb = new HashMap<>();
bb.put("333", "123123123");
bb.put("444", "123123123");
aa.putAll(bb);
for( String key : aa.keySet() ){
System.out.println( String.format("key : %s ||| value : %s", key, aa.get(key)) );
}
}
@Test
public void testRes() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource("config/wmi/meta");
File file = new File(url.getFile());
String[] fl = file.list();
for(String f : fl) {
System.out.println(f);
}
}
}

View File

@ -0,0 +1,43 @@
{
"id" : "SOEJWEOJWOEJOSDJFOASDJFOSDFO2903870928734",
"target" : {
"connection" : {
"ip" : "192.168.1.215",
"port" : "27017",
"ssl" : false,
"portType" : "tcp"
},
"auth" : {
}
},
"schedule" : {
"interval" : "10"
},
"crawler" : {
"name":"mongodb",
"container":"java_proxy"
},
"items" : [
{
"keys" : [
{"metric":"memory.usage.bits", "key":"bits"},
{"metric":"memory.usage.rss", "key":"resident"},
{"metric":"memory.usage.vmem", "key":"virtual"},
{"metric":"memory.usage.supported", "key":"supported"},
{"metric":"memory.usage.mapped", "key":"mapped"},
{"metric":"memory.usage.mappedWithJournal", "key":"mappedWithJournal"}
],
"queryInfo" : {
"query": "mem",
"extend" : {
"dataBaseName":"admin",
"statusCommand": "serverStatus"
}
},
"mappingInfo" : {
"parseDirection" : "col"
}
}
]
}

View File

@ -0,0 +1,395 @@
{
"id": "3",
"target": {
"auth": {
"pw": "qwer5795QWER",
"id": "docker",
"url": "jdbc:mysql://192.168.1.15:33067"
},
"connection": {
"ip": "192.168.1.15",
"port": "33067",
"portType": "TCP",
"ssl": false
}
},
"schedule": {
"interval": "5"
},
"crawler": {
"name": "MYSQL_CRAWLER",
"container": "java_proxy"
},
"items": [{
"keys": [{
"metric": "Performance.mysql.schema.users.lost",
"key": "Performance_schema_users_lost"
},
{
"metric": "Performance.mysql.schema.thread.instances.lost",
"key": "Performance_schema_thread_instances_lost"
},
{
"metric": "Performance.mysql.schema.thread.classes.lost",
"key": "Performance_schema_thread_classes_lost"
},
{
"metric": "Performance.mysql.schema.table.lock.stat.lost",
"key": "Performance_schema_table_lock_stat_lost"
},
{
"metric": "Performance.mysql.schema.table.instances.lost",
"key": "Performance_schema_table_instances_lost"
},
{
"metric": "Performance.mysql.schema.table.handles.lost",
"key": "Performance_schema_table_handles_lost"
},
{
"metric": "Performance.mysql.schema.statement.classes.lost",
"key": "Performance_schema_statement_classes_lost"
},
{
"metric": "Performance.mysql.schema.stage.classes.lost",
"key": "Performance_schema_stage_classes_lost"
},
{
"metric": "Performance.mysql.schema.socket.instances.lost",
"key": "Performance_schema_socket_instances_lost"
},
{
"metric": "Performance.mysql.schema.socket.classes.lost",
"key": "Performance_schema_socket_classes_lost"
},
{
"metric": "Performance.mysql.schema.session.connect.attrs.lost",
"key": "Performance_schema_session_connect_attrs_lost"
},
{
"metric": "Performance.mysql.schema.rwlock.instances.lost",
"key": "Performance_schema_rwlock_instances_lost"
},
{
"metric": "Performance.mysql.schema.rwlock.classes.lost",
"key": "Performance_schema_rwlock_classes_lost"
},
{
"metric": "Performance.mysql.schema.program.lost",
"key": "Performance_schema_program_lost"
},
{
"metric": "Performance.mysql.schema.prepared.statements.lost",
"key": "Performance_schema_prepared_statements_lost"
},
{
"metric": "Performance.mysql.schema.nested.statement.lost",
"key": "Performance_schema_nested_statement_lost"
},
{
"metric": "Performance.mysql.schema.mutex.instances.lost",
"key": "Performance_schema_mutex_instances_lost"
},
{
"metric": "Performance.mysql.schema.mutex.classes.lost",
"key": "Performance_schema_mutex_classes_lost"
},
{
"metric": "Performance.mysql.schema.metadata.lock.lost",
"key": "Performance_schema_metadata_lock_lost"
},
{
"metric": "Performance.mysql.schema.memory.classes.lost",
"key": "Performance_schema_memory_classes_lost"
},
{
"metric": "Performance.mysql.schema.locker.lost",
"key": "Performance_schema_locker_lost"
},
{
"metric": "Performance.mysql.schema.index.stat.lost",
"key": "Performance_schema_index_stat_lost"
},
{
"metric": "Performance.mysql.schema.hosts.lost",
"key": "Performance_schema_hosts_lost"
},
{
"metric": "Performance.mysql.schema.file.instances.lost",
"key": "Performance_schema_file_instances_lost"
},
{
"metric": "Performance.mysql.schema.file.handles.lost",
"key": "Performance_schema_file_handles_lost"
},
{
"metric": "Performance.mysql.schema.file.classes.lost",
"key": "Performance_schema_file_classes_lost"
},
{
"metric": "Performance.mysql.schema.digest.lost",
"key": "Performance_schema_digest_lost"
},
{
"metric": "Performance.mysql.schema.cond.instances.lost",
"key": "Performance_schema_cond_instances_lost"
},
{
"metric": "Performance.mysql.schema.cond.classes.lost",
"key": "Performance_schema_cond_classes_lost"
},
{
"metric": "Performance.mysql.schema.accounts.lost",
"key": "Performance_schema_accounts_lost"
},
{
"metric": "Connection.mysql.Max.used.connections.time",
"key": "Max_used_connections_time"
},
{
"metric": "Connection.mysql.Max.used.connections",
"key": "Max_used_connections"
},
{
"metric": "Connection.mysql.connections",
"key": "Connections"
},
{
"metric": "Connection.mysql.errors.tcpwrap",
"key": "Connection_errors_tcpwrap"
},
{
"metric": "Connection.mysql.errors.select",
"key": "Connection_errors_select"
},
{
"metric": "Connection.mysql.errors.peer.address",
"key": "Connection_errors_peer_address"
},
{
"metric": "Connection.mysql.errors.max.connections",
"key": "Connection_errors_max_connections"
},
{
"metric": "Connection.mysql.errors.internal",
"key": "Connection_errors_internal"
},
{
"metric": "Connection.mysql.errors.accept",
"key": "Connection_errors_accept"
},
{
"metric": "Innodb.mysql.available.undo.logs",
"key": "Innodb_available_undo_logs"
},
{
"metric": "Innodb.mysql.truncated.status.writes",
"key": "Innodb_truncated_status_writes"
},
{
"metric": "Innodb.mysql.num.open.files",
"key": "Innodb_num_open_files"
},
{
"metric": "Innodb.mysql.rows.updated",
"key": "Innodb_rows_updated"
},
{
"metric": "Innodb.mysql.rows.read",
"key": "Innodb_rows_read"
},
{
"metric": "Innodb.mysql.rows.inserted",
"key": "Innodb_rows_inserted"
},
{
"metric": "Innodb.mysql.rows.deleted",
"key": "Innodb_rows_deleted"
},
{
"metric": "Innodb.mysql.row.lock.waits",
"key": "Innodb_row_lock_waits"
},
{
"metric": "Innodb.mysql.row.lock.time.max",
"key": "Innodb_row_lock_time_max"
},
{
"metric": "Innodb.mysql.row.lock.time.avg",
"key": "Innodb_row_lock_time_avg"
},
{
"metric": "Innodb.mysql.row.lock.time",
"key": "Innodb_row_lock_time"
},
{
"metric": "Innodb.mysql.row.lock.current.waits",
"key": "Innodb_row_lock_current_waits"
},
{
"metric": "Innodb.mysql.pages.written",
"key": "Innodb_pages_written"
},
{
"metric": "Innodb.mysql.pages.read",
"key": "Innodb_pages_read"
},
{
"metric": "Innodb.mysql.pages.created",
"key": "Innodb_pages_created"
},
{
"metric": "Innodb.mysql.page.size",
"key": "Innodb_page_size"
},
{
"metric": "Innodb.mysql.os.log.written",
"key": "Innodb_os_log_written"
},
{
"metric": "Innodb.mysql.os.log.pending.writes",
"key": "Innodb_os_log_pending_writes"
},
{
"metric": "Innodb.mysql.os.log.pending.fsyncs",
"key": "Innodb_os_log_pending_fsyncs"
},
{
"metric": "Innodb.mysql.os.log.fsyncs",
"key": "Innodb_os_log_fsyncs"
},
{
"metric": "Innodb.mysql.log.writes",
"key": "Innodb_log_writes"
},
{
"metric": "Innodb.mysql.log.write.requests",
"key": "Innodb_log_write_requests"
},
{
"metric": "Innodb.mysql.log.waits",
"key": "Innodb_log_waits"
},
{
"metric": "Innodb.mysql.dblwr.writes",
"key": "Innodb_dblwr_writes"
},
{
"metric": "Innodb.mysql.dblwr.pages.written",
"key": "Innodb_dblwr_pages_written"
},
{
"metric": "Innodb.mysql.data.written",
"key": "Innodb_data_written"
},
{
"metric": "Innodb.mysql.data.writes",
"key": "Innodb_data_writes"
},
{
"metric": "Innodb.mysql.data.reads",
"key": "Innodb_data_reads"
},
{
"metric": "Innodb.mysql.data.read",
"key": "Innodb_data_read"
},
{
"metric": "Innodb.mysql.data.pending.writes",
"key": "Innodb_data_pending_writes"
},
{
"metric": "Innodb.mysql.data.pending.reads",
"key": "Innodb_data_pending_reads"
},
{
"metric": "Innodb.mysql.data.pending.fsyncs",
"key": "Innodb_data_pending_fsyncs"
},
{
"metric": "Innodb.mysql.data.fsyncs",
"key": "Innodb_data_fsyncs"
},
{
"metric": "Innodb.mysql.buffer.pool.write.requests",
"key": "Innodb_buffer_pool_write_requests"
},
{
"metric": "Innodb.mysql.buffer.pool.wait.free",
"key": "Innodb_buffer_pool_wait_free"
},
{
"metric": "Innodb.mysql.buffer.pool.reads",
"key": "Innodb_buffer_pool_reads"
},
{
"metric": "Innodb.mysql.buffer.pool.read.requests",
"key": "Innodb_buffer_pool_read_requests"
},
{
"metric": "Innodb.mysql.buffer.pool.read.ahead.evicted",
"key": "Innodb_buffer_pool_read_ahead_evicted"
},
{
"metric": "Innodb.mysql.buffer.pool.read.ahead",
"key": "Innodb_buffer_pool_read_ahead"
},
{
"metric": "Innodb.mysql.buffer.pool.read.ahead.rnd",
"key": "Innodb_buffer_pool_read_ahead_rnd"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.total",
"key": "Innodb_buffer_pool_pages_total"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.misc",
"key": "Innodb_buffer_pool_pages_misc"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.free",
"key": "Innodb_buffer_pool_pages_free"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.flushed",
"key": "Innodb_buffer_pool_pages_flushed"
},
{
"metric": "Innodb.mysql.buffer.pool.bytes.dirty",
"key": "Innodb_buffer_pool_bytes_dirty"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.dirty",
"key": "Innodb_buffer_pool_pages_dirty"
},
{
"metric": "Innodb.mysql.buffer.pool.bytes.data",
"key": "Innodb_buffer_pool_bytes_data"
},
{
"metric": "Innodb.mysql.buffer.pool.pages.data",
"key": "Innodb_buffer_pool_pages_data"
},
{
"metric": "Innodb.mysql.buffer.pool.resize.status",
"key": "Innodb_buffer_pool_resize_status"
},
{
"metric": "Innodb.mysql.buffer.pool.load.status",
"key": "Innodb_buffer_pool_load_status"
},
{
"metric": "Innodb.mysql.buffer.pool.dump.status",
"key": "Innodb_buffer_pool_dump_status"
}],
"queryInfo": {
"query": "show status where variable_name = 'Performance_schema_users_lost' or variable_name = 'Performance_schema_thread_instances_lost' or variable_name = 'Performance_schema_thread_classes_lost' or variable_name = 'Performance_schema_table_lock_stat_lost' or variable_name = 'Performance_schema_table_instances_lost' or variable_name = 'Performance_schema_table_handles_lost' or variable_name = 'Performance_schema_statement_classes_lost' or variable_name = 'Performance_schema_stage_classes_lost' or variable_name = 'Performance_schema_socket_instances_lost' or variable_name = 'Performance_schema_socket_classes_lost' or variable_name = 'Performance_schema_session_connect_attrs_lost' or variable_name = 'Performance_schema_rwlock_instances_lost' or variable_name = 'Performance_schema_rwlock_classes_lost' or variable_name = 'Performance_schema_program_lost' or variable_name = 'Performance_schema_prepared_statements_lost' or variable_name = 'Performance_schema_nested_statement_lost' or variable_name = 'Performance_schema_mutex_instances_lost' or variable_name = 'Performance_schema_mutex_classes_lost' or variable_name = 'Performance_schema_metadata_lock_lost' or variable_name = 'Performance_schema_memory_classes_lost' or variable_name = 'Performance_schema_locker_lost' or variable_name = 'Performance_schema_index_stat_lost' or variable_name = 'Performance_schema_hosts_lost' or variable_name = 'Performance_schema_file_instances_lost' or variable_name = 'Performance_schema_file_handles_lost' or variable_name = 'Performance_schema_file_classes_lost' or variable_name = 'Performance_schema_digest_lost' or variable_name = 'Performance_schema_cond_instances_lost' or variable_name = 'Performance_schema_cond_classes_lost' or variable_name = 'Performance_schema_accounts_lost' or variable_name = 'Max_used_connections_time' or variable_name = 'Max_used_connections' or variable_name = 'Connections' or variable_name = 'Connection_errors_tcpwrap' or variable_name = 'Connection_errors_select' or variable_name = 'Connection_errors_peer_address' or variable_name = 'Connection_errors_max_connections' or variable_name = 'Connection_errors_internal' or variable_name = 'Connection_errors_accept' or variable_name = 'Innodb_available_undo_logs' or variable_name = 'Innodb_truncated_status_writes' or variable_name = 'Innodb_num_open_files' or variable_name = 'Innodb_rows_updated' or variable_name = 'Innodb_rows_read' or variable_name = 'Innodb_rows_inserted' or variable_name = 'Innodb_rows_deleted' or variable_name = 'Innodb_row_lock_waits' or variable_name = 'Innodb_row_lock_time_max' or variable_name = 'Innodb_row_lock_time_avg' or variable_name = 'Innodb_row_lock_time' or variable_name = 'Innodb_row_lock_current_waits' or variable_name = 'Innodb_pages_written' or variable_name = 'Innodb_pages_read' or variable_name = 'Innodb_pages_created' or variable_name = 'Innodb_page_size' or variable_name = 'Innodb_os_log_written' or variable_name = 'Innodb_os_log_pending_writes' or variable_name = 'Innodb_os_log_pending_fsyncs' or variable_name = 'Innodb_os_log_fsyncs' or variable_name = 'Innodb_log_writes' or variable_name = 'Innodb_log_write_requests' or variable_name = 'Innodb_log_waits' or variable_name = 'Innodb_dblwr_writes' or variable_name = 'Innodb_dblwr_pages_written' or variable_name = 'Innodb_data_written' or variable_name = 'Innodb_data_writes' or variable_name = 'Innodb_data_reads' or variable_name = 'Innodb_data_read' or variable_name = 'Innodb_data_pending_writes' or variable_name = 'Innodb_data_pending_reads' or variable_name = 'Innodb_data_pending_fsyncs' or variable_name = 'Innodb_data_fsyncs' or variable_name = 'Innodb_buffer_pool_write_requests' or variable_name = 'Innodb_buffer_pool_wait_free' or variable_name = 'Innodb_buffer_pool_reads' or variable_name = 'Innodb_buffer_pool_read_requests' or variable_name = 'Innodb_buffer_pool_read_ahead_evicted' or variable_name = 'Innodb_buffer_pool_read_ahead' or variable_name = 'Innodb_buffer_pool_read_ahead_rnd' or variable_name = 'Innodb_buffer_pool_pages_total' or variable_name = 'Innodb_buffer_pool_pages_misc' or variable_name = 'Innodb_buffer_pool_pages_free' or variable_name = 'Innodb_buffer_pool_pages_flushed' or variable_name = 'Innodb_buffer_pool_bytes_dirty' or variable_name = 'Innodb_buffer_pool_pages_dirty' or variable_name = 'Innodb_buffer_pool_bytes_data' or variable_name = 'Innodb_buffer_pool_pages_data' or variable_name = 'Innodb_buffer_pool_resize_status' or variable_name = 'Innodb_buffer_pool_load_status' or variable_name = 'Innodb_buffer_pool_dump_status'",
"extend": null
},
"mappingInfo": {
"parseDirection": "row",
"arrayColumns": null,
"keyColumns": ["Variable_name"],
"valueColumn": "Value"
}
}]
}

View File

@ -0,0 +1,44 @@
{
"id" : "SOEJWEOJWOEJOSDJFOASDJFOSDFO2903870928734",
"target" : {
"connection" : {
"ip" : "192.168.1.104",
"port" : "6379",
"ssl" : false,
"portType" : "tcp"
},
"auth" : {
"url":"jdbc:mysql://192.168.1.215:3306",
"id":"root",
"pw":"qwe123"
}
},
"schedule" : {
"interval" : "10"
},
"crawler" : {
"name":"mysql",
"container":"java_proxy"
},
"items" : [
{
"keys" : [
{
"metric":"net.connection_count",
"key":"Connections"
}
],
"queryInfo" : {
"query":"show status where `variable_name` = 'Connections'"
},
"mappingInfo" : {
"parseDirection" : "row",
"valueColumn" : "Value",
"keyColumns" : [
"Variable_name"
]
}
}
]
}

View File

@ -0,0 +1,36 @@
{
"id" : "SOEJWEOJWOEJOSDJFOASDJFOSDFO2903870928734",
"target" : {
"connection" : {
"ip" : "192.168.1.107",
"port" : "5432",
"ssl" : false,
"portType" : "tcp"
},
"auth" : {
"url":"jdbc:postgresql://192.168.1.107:5432/postgres",
"id":"postgres",
"pw":"!@#$qwer1234"
}
},
"schedule" : {
"interval" : "10"
},
"crawler" : {
"name":"pgsql",
"container":"java_proxy"
},
"items" : [
{
"keys" : [
{
"metric":"net.connection_count",
"key" : "connection_count"
}
],
"queryInfo":{
"query" : "select count(pid) as connection_count from pg_catalog.pg_stat_activity where state <> 'idle'"
}
}
]
}

Some files were not shown because too many files have changed in this diff Show More