public class NagiosWriter extends BaseOutputWriter
| Modifier and Type | Field and Description |
|---|---|
protected static int |
LOG_IO_BUFFER_SIZE_BYTES |
protected static java.lang.String |
LOG_PATTERN |
protected ch.qos.logback.classic.Logger |
logger |
protected java.util.Map<java.lang.String,ch.qos.logback.classic.Logger> |
loggers |
BINARY_PATH, BOOLEAN_AS_NUMBER, DEBUG, HOST, OUTPUT_FILE, PORT, TEMPLATE_FILE, TYPE_NAMES| Constructor and Description |
|---|
NagiosWriter(com.google.common.collect.ImmutableList<java.lang.String> typeNames,
boolean booleanAsNumber,
java.lang.Boolean debugEnabled,
java.util.List<java.lang.String> filters,
java.util.List<java.lang.String> thresholds,
java.lang.String nagiosHost,
java.lang.String outputFile,
java.lang.String prefix,
java.lang.String suffix,
java.util.Map<java.lang.String,java.lang.Object> settings) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkFile(Query query)
Creates the logging.
|
void |
close() |
com.google.common.collect.ImmutableList<java.lang.String> |
getFilters() |
java.lang.String |
getNagiosHost() |
java.lang.String |
getOutputFile() |
java.lang.String |
getPrefix() |
java.lang.String |
getSuffix() |
com.google.common.collect.ImmutableList<java.lang.String> |
getThresholds() |
protected ch.qos.logback.classic.Logger |
initLogger(java.lang.String fileStr)
Initializes the logger.
|
void |
internalWrite(Server server,
Query query,
com.google.common.collect.ImmutableList<Result> results)
The meat of the output.
|
protected java.lang.String |
nagiosCheckValue(java.lang.String value,
java.lang.String composeRange)
Define if a value is in a critical, warning or ok state.
|
void |
validateSetup(Server server,
Query query)
Initial log setup.
|
protected boolean |
valueCheck(double value,
java.lang.String simpleRange)
Check if a value is inside of a range defined in the thresholds.
|
create, doWrite, firstNonNull, getConcatedTypeNameValues, getSettings, getTypeNames, isDebugEnabled, start, toStringprotected static final java.lang.String LOG_PATTERN
protected static final int LOG_IO_BUFFER_SIZE_BYTES
protected final java.util.Map<java.lang.String,ch.qos.logback.classic.Logger> loggers
protected ch.qos.logback.classic.Logger logger
public NagiosWriter(com.google.common.collect.ImmutableList<java.lang.String> typeNames,
boolean booleanAsNumber,
java.lang.Boolean debugEnabled,
java.util.List<java.lang.String> filters,
java.util.List<java.lang.String> thresholds,
java.lang.String nagiosHost,
java.lang.String outputFile,
java.lang.String prefix,
java.lang.String suffix,
java.util.Map<java.lang.String,java.lang.Object> settings)
public void validateSetup(Server server, Query query) throws ValidationException
ValidationExceptionpublic void checkFile(Query query) throws ValidationException
The external command file is implemented as a named pipe (FIFO), which is created when Nagios starts and removed when it shuts down. If the file exists when Nagios starts, the Nagios process will terminate with an error message. http://nagios.sourceforge.net/docs/3_0/configmain.html#command_file
ValidationExceptionpublic void internalWrite(Server server, Query query, com.google.common.collect.ImmutableList<Result> results) throws java.lang.Exception
internalWrite in class BaseOutputWriterjava.lang.Exceptionprotected ch.qos.logback.classic.Logger initLogger(java.lang.String fileStr)
throws java.io.IOException
fileStr - java.io.IOExceptionprotected java.lang.String nagiosCheckValue(java.lang.String value,
java.lang.String composeRange)
protected boolean valueCheck(double value,
java.lang.String simpleRange)
public void close()
close in interface OutputWriterclose in interface java.lang.AutoCloseableclose in class BaseOutputWriterpublic com.google.common.collect.ImmutableList<java.lang.String> getFilters()
public com.google.common.collect.ImmutableList<java.lang.String> getThresholds()
public java.lang.String getNagiosHost()
public java.lang.String getOutputFile()
public java.lang.String getPrefix()
public java.lang.String getSuffix()
Copyright © 2010-2021 JmxTrans team. All Rights Reserved.