├── apache_log
├── .gitignore
├── __init__.py
├── plugins
│ ├── __init__.py
│ ├── urls_counter.py
│ ├── app_thread.py
│ ├── apache_url_stat.py
│ ├── options.py
│ ├── statsd_sender.py
│ └── daemon.py
├── ._.DS_Store
└── readme.md
├── af.oracle.metrics
├── .gitignore
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ ├── log4j.properties
│ │ │ └── sqls.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── os
│ │ │ └── appfirst
│ │ │ ├── Metric.java
│ │ │ ├── Log2File.java
│ │ │ ├── NagiosOutput.java
│ │ │ ├── OracleSqlQuerys.java
│ │ │ └── MysqlTestsQueries.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── os
│ │ └── appfirst
│ │ ├── OracleMetricsTest.java
│ │ └── AppTest.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── libs
│ └── java_statsd_client-0.0.3-jar-with-dependencies.jar
├── mvn_inst_local_repo.sh
├── .springBeans
├── get_oracle_metric.sh
├── build.gradle
├── info.md
├── gradlew.bat
└── pom.xml
├── jmx-collector
├── appfirst-jmx-0.5.jar
├── appfirst-jmx-0.5-jar-with-dependencies.jar
├── src
│ ├── main
│ │ ├── java
│ │ │ ├── com
│ │ │ │ └── objectstyle
│ │ │ │ │ └── appfirst
│ │ │ │ │ └── jmx
│ │ │ │ │ └── collector
│ │ │ │ │ ├── command
│ │ │ │ │ ├── ThresholdDefinition.java
│ │ │ │ │ ├── VirtualMachineDefinition.java
│ │ │ │ │ ├── NoThresholdDefinition.java
│ │ │ │ │ ├── ValueDefinition.java
│ │ │ │ │ ├── URLVirtualMachineDefinition.java
│ │ │ │ │ ├── PatternVirtualMachineDefinition.java
│ │ │ │ │ ├── CompositeValueDefinition.java
│ │ │ │ │ ├── RangeThresholdDefinition.java
│ │ │ │ │ └── Command.java
│ │ │ │ │ ├── result
│ │ │ │ │ ├── ResultData.java
│ │ │ │ │ ├── MBeanDataConverter.java
│ │ │ │ │ ├── converter
│ │ │ │ │ │ ├── SimpleTypeToStringConverter.java
│ │ │ │ │ │ ├── ToStringConverter.java
│ │ │ │ │ │ ├── SimpleTypeConverter.java
│ │ │ │ │ │ ├── PrimitiveToStringTransformer.java
│ │ │ │ │ │ ├── MapConverter.java
│ │ │ │ │ │ ├── SetConverter.java
│ │ │ │ │ │ ├── CompositeTypeConverter.java
│ │ │ │ │ │ └── ArrayTypeConverter.java
│ │ │ │ │ ├── NoResultData.java
│ │ │ │ │ ├── OpenMBeanDataConverter.java
│ │ │ │ │ ├── UnsupportedDataTypeException.java
│ │ │ │ │ ├── ValidationErrorResult.java
│ │ │ │ │ ├── ParseErrorResult.java
│ │ │ │ │ ├── UnsupportedOpenTypeException.java
│ │ │ │ │ ├── ErrorResultData.java
│ │ │ │ │ ├── ErrorResult.java
│ │ │ │ │ ├── ResultProcessor.java
│ │ │ │ │ ├── SimpleResultData.java
│ │ │ │ │ ├── ResultStatus.java
│ │ │ │ │ ├── ArrayResultData.java
│ │ │ │ │ ├── Result.java
│ │ │ │ │ ├── OpenMBeanDataConverterFactory.java
│ │ │ │ │ ├── Primitives.java
│ │ │ │ │ ├── CompositeResultData.java
│ │ │ │ │ └── MBeanDataConverterFactory.java
│ │ │ │ │ ├── output
│ │ │ │ │ ├── Output.java
│ │ │ │ │ ├── SysOutOutput.java
│ │ │ │ │ ├── AfCollectorOutput.java
│ │ │ │ │ ├── QueuedOutput.java
│ │ │ │ │ └── af
│ │ │ │ │ │ └── AfCollector.java
│ │ │ │ │ ├── config
│ │ │ │ │ ├── CommandLineParserException.java
│ │ │ │ │ ├── ThresholdValidationException.java
│ │ │ │ │ ├── parser
│ │ │ │ │ │ └── CommandLineParser.java
│ │ │ │ │ ├── CommandLinesSource.java
│ │ │ │ │ ├── CommandValidationException.java
│ │ │ │ │ ├── FileReaderInputSupplier.java
│ │ │ │ │ ├── CommandLineProcessor.java
│ │ │ │ │ ├── Constants.java
│ │ │ │ │ ├── FileCommandLinesSource.java
│ │ │ │ │ ├── SimpleCommandLinesSource.java
│ │ │ │ │ ├── ThresholdBuilder.java
│ │ │ │ │ └── CommandBuilder.java
│ │ │ │ │ ├── resolve
│ │ │ │ │ ├── VirtualMachineIdentifierInvalidationListener.java
│ │ │ │ │ ├── VirtualMachineResolverRuntimeException.java
│ │ │ │ │ ├── VirtualMachineResolver.java
│ │ │ │ │ ├── VirtualMachineMatcher.java
│ │ │ │ │ ├── VirtualMachineResolverException.java
│ │ │ │ │ ├── VirtualMachineNotFoundException.java
│ │ │ │ │ ├── NotUniqueVirtualMachineException.java
│ │ │ │ │ ├── URLVirtualMachineResolver.java
│ │ │ │ │ ├── StringInclusionVirtualMachineMatcher.java
│ │ │ │ │ ├── JvmstatVirtualMachineMatcher.java
│ │ │ │ │ ├── LocalVirtualMachineIdentifier.java
│ │ │ │ │ ├── VirtualMachineIdentifier.java
│ │ │ │ │ └── CachingLocalVirtualMachineResolver.java
│ │ │ │ │ ├── execution
│ │ │ │ │ ├── CommandExecutor.java
│ │ │ │ │ ├── ThresholdChecker.java
│ │ │ │ │ ├── CommandExecutionException.java
│ │ │ │ │ ├── UnsupportedObjectTypeException.java
│ │ │ │ │ ├── DelegatingThresholdChecker.java
│ │ │ │ │ ├── RangeThresholdChecker.java
│ │ │ │ │ └── CommandsExecutionLifecycle.java
│ │ │ │ │ ├── utils
│ │ │ │ │ └── UserGroupGetter.java
│ │ │ │ │ └── management
│ │ │ │ │ ├── JMXConnectorPool.java
│ │ │ │ │ └── ManagementConnectionFactory.java
│ │ │ ├── TestDeamond.java
│ │ │ └── Connect.java
│ │ └── resources
│ │ │ └── log4j.properties
│ └── test
│ │ └── java
│ │ └── com
│ │ └── objectstyle
│ │ └── appfirst
│ │ └── jmx
│ │ └── collector
│ │ ├── result
│ │ ├── SimpleResultDataTest.java
│ │ ├── CompositeResultDataTest.java
│ │ └── ArrayResultDataTest.java
│ │ ├── utils
│ │ └── JVMAttachTest.java
│ │ └── config
│ │ ├── ThresholdBuilderTest.java
│ │ ├── SimpleCommandLinesSourceTest.java
│ │ ├── parser
│ │ └── RegexBasedCommandLineParserTest.java
│ │ └── CommandBuilderTest.java
├── jmx-collector.sh
├── log4j.properties
├── config-examples.cfg
└── jmxcollector
├── .gitignore
├── poll2log
├── test
├── test_check_resque.py
├── test_check_passenger.py
├── test_check_redis.py
├── test_check_memcached.py
├── test_check_mysql.py
├── test_check_smart.py
├── test_check_mongodb.py
├── test_check_postgresql.py
├── test_plugin.py
└── test_nagios.py
├── Readme_disk_throughput
├── ucommands.py
├── check_passenger.py
├── statsd.py
├── check_ipmi_sensors.ps1
├── check_zookeeper.py
├── check_cassandra.py
├── check_couchdb.py
├── check_couchbase.py
├── check_haproxy.py
└── check_resque.py
/apache_log/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 |
--------------------------------------------------------------------------------
/apache_log/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | __init__.py
3 |
4 | """
5 | __version__ = '0.1.0'
--------------------------------------------------------------------------------
/apache_log/plugins/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | __init__.py
3 |
4 | """
5 | __version__ = '0.1.0'
--------------------------------------------------------------------------------
/apache_log/._.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appfirst/nagios-plugins/HEAD/apache_log/._.DS_Store
--------------------------------------------------------------------------------
/af.oracle.metrics/.gitignore:
--------------------------------------------------------------------------------
1 | .classpath
2 | .project
3 | .settings/
4 | target/
5 | *.log
6 | *.DS_Store
7 |
--------------------------------------------------------------------------------
/jmx-collector/appfirst-jmx-0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appfirst/nagios-plugins/HEAD/jmx-collector/appfirst-jmx-0.5.jar
--------------------------------------------------------------------------------
/af.oracle.metrics/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello, world!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/af.oracle.metrics/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appfirst/nagios-plugins/HEAD/af.oracle.metrics/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/jmx-collector/appfirst-jmx-0.5-jar-with-dependencies.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appfirst/nagios-plugins/HEAD/jmx-collector/appfirst-jmx-0.5-jar-with-dependencies.jar
--------------------------------------------------------------------------------
/af.oracle.metrics/libs/java_statsd_client-0.0.3-jar-with-dependencies.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appfirst/nagios-plugins/HEAD/af.oracle.metrics/libs/java_statsd_client-0.0.3-jar-with-dependencies.jar
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/*
2 | sample/
3 | status/
4 | .DS_Store
5 | .classpath
6 | .project
7 | .pydevproject
8 | .settings/
9 | jmx-collector.log
10 | jmx-collector/bin/
11 | jmx-collector/target/
12 | *.pyc
13 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/command/ThresholdDefinition.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.command;
2 |
3 | public abstract class ThresholdDefinition {
4 | }
5 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/command/VirtualMachineDefinition.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.command;
2 |
3 | public abstract class VirtualMachineDefinition {
4 | }
5 |
--------------------------------------------------------------------------------
/af.oracle.metrics/mvn_inst_local_repo.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mvn install:install-file -DgroupId=com.appfirst -DartifactId=java_statsd_client -Dversion=0.3 -Dpackaging=jar -Dfile=libs/java_statsd_client-0.0.3-jar-with-dependencies.jar
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/command/NoThresholdDefinition.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.command;
2 |
3 | public class NoThresholdDefinition extends ThresholdDefinition {
4 | }
5 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ResultData.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public abstract class ResultData {
4 | @Override
5 | public abstract String toString();
6 | }
7 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/output/Output.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.output;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.result.Result;
4 |
5 | public interface Output {
6 | void write(Result result);
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/MBeanDataConverter.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public interface MBeanDataConverter {
4 | ResultData convert(T type, V value) throws UnsupportedDataTypeException;
5 | }
--------------------------------------------------------------------------------
/af.oracle.metrics/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 12 07:27:42 CST 2014
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip
7 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/converter/SimpleTypeToStringConverter.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result.converter;
2 |
3 | class SimpleTypeToStringConverter {
4 | String convert(T value) {
5 | return value.toString();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/NoResultData.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public class NoResultData extends ResultData {
4 | @Override
5 | public String toString() {
6 | throw new UnsupportedOperationException();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/OpenMBeanDataConverter.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import javax.management.openmbean.OpenType;
4 |
5 | public interface OpenMBeanDataConverter, V> extends MBeanDataConverter {
6 | }
7 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/CommandLineParserException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config;
2 |
3 | public class CommandLineParserException extends Exception {
4 | public CommandLineParserException(String message) {
5 | super(message);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineIdentifierInvalidationListener.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | public interface VirtualMachineIdentifierInvalidationListener {
4 | void identifierInvalidated(VirtualMachineIdentifier identifier);
5 | }
6 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/UnsupportedDataTypeException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public class UnsupportedDataTypeException extends Exception {
4 | public UnsupportedDataTypeException(String errorMessage) {
5 | super(errorMessage);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/af.oracle.metrics/src/main/java/com/os/appfirst/Metric.java:
--------------------------------------------------------------------------------
1 | package com.os.appfirst;
2 |
3 | public class Metric {
4 | public String name = null;
5 | public long val = 0;
6 | public String unit = null;
7 |
8 | public Metric(String name, long val, String unit){
9 | this.name = name;
10 | this.val = val;
11 | this.unit = unit;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/ThresholdValidationException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config;
2 |
3 | public class ThresholdValidationException extends CommandValidationException {
4 | public ThresholdValidationException() {
5 | super("Error in threshold definition");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/parser/CommandLineParser.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config.parser;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.config.CommandLineParserException;
4 |
5 | public interface CommandLineParser {
6 | void parse(String commandLine) throws CommandLineParserException;
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/CommandLinesSource.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | public interface CommandLinesSource {
7 | List readLines() throws IOException;
8 |
9 | boolean hasChanges() throws IOException;
10 | }
11 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineResolverRuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | public class VirtualMachineResolverRuntimeException extends RuntimeException {
4 | public VirtualMachineResolverRuntimeException(String s, Throwable throwable) {
5 | super(s, throwable);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/execution/CommandExecutor.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.execution;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.Command;
4 | import com.objectstyle.appfirst.jmx.collector.result.Result;
5 |
6 | public interface CommandExecutor {
7 | Result execute(Command command) throws CommandExecutionException;
8 | }
9 |
--------------------------------------------------------------------------------
/jmx-collector/jmx-collector.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! $JAVA_HOME ]
4 | then
5 | echo 'Please specify JAVA_HOME environment variable'
6 | exit
7 | fi
8 |
9 |
10 | LD_LIBRARY_PATH=/usr/share/appfirst:$JAVA_HOME/jre/lib ${JAVA_HOME}/bin/java -cp .:${JAVA_HOME}/lib/jconsole.jar:${JAVA_HOME}/lib/tools.jar:appfirst-jmx-0.4-jar-with-dependencies.jar com.objectstyle.appfirst.jmx.collector.Application
11 |
12 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineResolver.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.VirtualMachineDefinition;
4 |
5 | public interface VirtualMachineResolver {
6 | VirtualMachineIdentifier resolve(VirtualMachineDefinition definition) throws VirtualMachineResolverException;
7 | }
8 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/output/SysOutOutput.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.output;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.result.Result;
4 |
5 | public class SysOutOutput extends QueuedOutput implements Output {
6 | @Override
7 | public void doWrite(Result result) {
8 | System.out.println(result.toString());
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/execution/ThresholdChecker.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.execution;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.ThresholdDefinition;
4 | import com.objectstyle.appfirst.jmx.collector.result.ResultData;
5 |
6 | public interface ThresholdChecker {
7 | boolean checkReached(ThresholdDefinition thresholdDefinition, ResultData resultData);
8 | }
9 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/CommandValidationException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config;
2 |
3 | public class CommandValidationException extends Exception {
4 | public CommandValidationException(String s) {
5 | super(s);
6 | }
7 |
8 | public CommandValidationException(String s, Throwable throwable) {
9 | super(s, throwable);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineMatcher.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.VirtualMachineDefinition;
4 | import com.sun.tools.attach.VirtualMachineDescriptor;
5 |
6 | public interface VirtualMachineMatcher {
7 | boolean matches(VirtualMachineDefinition definition, VirtualMachineDescriptor descriptor);
8 | }
9 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineResolverException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | public class VirtualMachineResolverException extends Exception {
4 | public VirtualMachineResolverException(String s) {
5 | super(s);
6 | }
7 |
8 | public VirtualMachineResolverException(String s, Throwable throwable) {
9 | super(s, throwable);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ValidationErrorResult.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.config.CommandValidationException;
4 |
5 | public class ValidationErrorResult extends Result {
6 | public ValidationErrorResult(CommandValidationException exception) {
7 | super(exception.getMessage(), ResultStatus.EXECUTION_ERROR, new NoResultData());
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/af.oracle.metrics/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | # Direct log messages to a log file
2 | log4j.appender.file=org.apache.log4j.RollingFileAppender
3 | log4j.appender.file.File= /tmp/af.oracle.metrics.debug.log
4 | log4j.appender.file.MaxFileSize=1MB
5 | log4j.appender.file.MaxBackupIndex=1
6 | log4j.appender.file.layout=org.apache.log4j.PatternLayout
7 | log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
8 |
9 | # Root logger option
10 | log4j.rootLogger=debug, file
--------------------------------------------------------------------------------
/af.oracle.metrics/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 | java:com.os.appfirst.App
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ParseErrorResult.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.config.CommandLineParserException;
4 |
5 | public class ParseErrorResult extends Result {
6 | public ParseErrorResult(CommandLineParserException exception) {
7 | super("JMX-Collector-Parser", ResultStatus.EXECUTION_ERROR, new ErrorResultData(exception.getMessage()));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/UnsupportedOpenTypeException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import javax.management.openmbean.OpenType;
4 |
5 | import static java.lang.String.format;
6 |
7 | public class UnsupportedOpenTypeException extends UnsupportedDataTypeException {
8 | public UnsupportedOpenTypeException(OpenType> type) {
9 | super(format("Unsupported data type '%s'", type.getTypeName()));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ErrorResultData.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public class ErrorResultData extends ResultData {
4 | private final String message;
5 |
6 | public ErrorResultData(String message) {
7 | this.message = message;
8 | }
9 |
10 | public String getMessage() {
11 | return message;
12 | }
13 |
14 | @Override
15 | public String toString() {
16 | return message;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/jmx-collector/src/test/java/com/objectstyle/appfirst/jmx/collector/result/SimpleResultDataTest.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import org.junit.Test;
4 |
5 | import static junit.framework.Assert.assertEquals;
6 |
7 | public class SimpleResultDataTest {
8 | @Test
9 | public void testToString() throws Exception {
10 | assertEquals("val=1", new SimpleResultData("val", "1").toString());
11 | assertEquals("key=2", new SimpleResultData("key", "2").toString());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ErrorResult.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | public class ErrorResult extends Result {
4 | public ErrorResult(String name, String message) {
5 | this(name, new ErrorResultData(message));
6 | }
7 |
8 | public ErrorResult(String name, ErrorResultData errorResultData) {
9 | super(name, ResultStatus.EXECUTION_ERROR, errorResultData);
10 | }
11 |
12 | @Override
13 | public String toString() {
14 | return super.toString();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/jmx-collector/src/test/java/com/objectstyle/appfirst/jmx/collector/result/CompositeResultDataTest.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import com.google.common.collect.ImmutableMap;
4 | import org.junit.Test;
5 |
6 | import static junit.framework.Assert.assertEquals;
7 |
8 | public class CompositeResultDataTest {
9 | @Test
10 | public void testToString() throws Exception {
11 | assertEquals("key1=1 key2=2 key3=3",
12 | new CompositeResultData(ImmutableMap.of("key1", "1", "key2", "2", "key3", "3")).toString());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/execution/CommandExecutionException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.execution;
2 |
3 | public class CommandExecutionException extends Exception {
4 | public CommandExecutionException(String s) {
5 | super(s);
6 | }
7 |
8 | public CommandExecutionException(String s, Throwable throwable) {
9 | super(s, throwable);
10 | }
11 |
12 | public CommandExecutionException(Throwable throwable) {
13 | super(String.format("Error while executing command"), throwable);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/VirtualMachineNotFoundException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.VirtualMachineDefinition;
4 |
5 | import static java.lang.String.format;
6 |
7 | public class VirtualMachineNotFoundException extends VirtualMachineResolverException {
8 | public VirtualMachineNotFoundException(VirtualMachineDefinition definition) {
9 | super(format("Virtual machine definition does not match any virtual machine: '%s'", definition.toString()));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/jmx-collector/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=OFF, console, file
2 |
3 | log4j.appender.console=org.apache.log4j.ConsoleAppender
4 | log4j.appender.console.layout=org.apache.log4j.PatternLayout
5 | log4j.appender.console.target=System.err
6 | log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
7 |
8 | log4j.appender.file=org.apache.log4j.RollingFileAppender
9 | log4j.appender.file.File=jmx-collector.log
10 | log4j.appender.file.layout=org.apache.log4j.PatternLayout
11 | log4j.appender.file.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
12 |
13 | log4j.logger.com.objectstyle.appfirst.jmx.collector=OFF
14 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/resolve/NotUniqueVirtualMachineException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.resolve;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.VirtualMachineDefinition;
4 |
5 | import static java.lang.String.format;
6 |
7 | public class NotUniqueVirtualMachineException extends VirtualMachineResolverException {
8 | public NotUniqueVirtualMachineException(VirtualMachineDefinition definition) {
9 | super(format("Virtual machine definition matches more then one virtual machine: '%s'", definition.toString()));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=DEBUG, console, file
2 |
3 | log4j.appender.console=org.apache.log4j.ConsoleAppender
4 | log4j.appender.console.layout=org.apache.log4j.PatternLayout
5 | log4j.appender.console.target=System.err
6 | log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
7 |
8 | log4j.appender.file=org.apache.log4j.RollingFileAppender
9 | log4j.appender.file.File=jmx-collector.log
10 | log4j.appender.file.layout=org.apache.log4j.PatternLayout
11 | log4j.appender.file.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
12 |
13 | log4j.logger.com.objectstyle.appfirst.jmx.collector=TRACE
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/TestDeamond.java:
--------------------------------------------------------------------------------
1 | import java.util.Properties;
2 |
3 | public class TestDeamond {
4 |
5 | public static void main(String[] args) {
6 |
7 | Runnable runnable = new Runnable() {
8 | @Override
9 | public void run() {
10 | while(true)
11 | {
12 | Properties properties = System.getProperties();
13 | properties.list(System.out);
14 | try {
15 | Thread.sleep(1000);
16 | } catch (InterruptedException e) {
17 | break;
18 | }
19 | }
20 | }
21 | };
22 |
23 | Thread thread = new Thread(runnable);
24 | thread.setDaemon(true);
25 | thread.run();
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/execution/UnsupportedObjectTypeException.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.execution;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.command.ValueDefinition;
4 |
5 | public class UnsupportedObjectTypeException extends CommandExecutionException {
6 | public UnsupportedObjectTypeException(ValueDefinition valueDefinition, Class> objectType) {
7 | super(String.format("Unsupported object type '%s' for attribute '%s' of object '%s'",
8 | objectType.getName(), valueDefinition.getAttribute(), valueDefinition.getName()));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/config/FileReaderInputSupplier.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.config;
2 |
3 | import com.google.common.io.InputSupplier;
4 |
5 | import java.io.File;
6 | import java.io.FileReader;
7 | import java.io.IOException;
8 |
9 | public class FileReaderInputSupplier implements InputSupplier {
10 | private final File file;
11 |
12 | public FileReaderInputSupplier(File file) {
13 | this.file = file;
14 | }
15 |
16 | @Override
17 | public Readable getInput() throws IOException {
18 | return new FileReader(file);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/ResultProcessor.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result;
2 |
3 | import javax.management.MBeanAttributeInfo;
4 | import javax.management.openmbean.OpenType;
5 |
6 | public interface ResultProcessor {
7 | void startResult(String outputName);
8 |
9 | void startExecutionError(String executionErrorMessage);
10 |
11 | void startData(MBeanAttributeInfo attributeInfo, Object value) throws UnsupportedDataTypeException;
12 |
13 | void startOpenMBeanData(OpenType type, T value) throws UnsupportedOpenTypeException;
14 |
15 | void endResult();
16 | }
17 |
--------------------------------------------------------------------------------
/jmx-collector/src/main/java/com/objectstyle/appfirst/jmx/collector/result/converter/ToStringConverter.java:
--------------------------------------------------------------------------------
1 | package com.objectstyle.appfirst.jmx.collector.result.converter;
2 |
3 | import com.objectstyle.appfirst.jmx.collector.result.MBeanDataConverter;
4 | import com.objectstyle.appfirst.jmx.collector.result.ResultData;
5 | import com.objectstyle.appfirst.jmx.collector.result.SimpleResultData;
6 |
7 | public class ToStringConverter implements MBeanDataConverter {
8 | @Override
9 | public ResultData convert(String type, Object value) {
10 | return new SimpleResultData(new SimpleTypeToStringConverter