introspective-monitoring

Introspective Monitoring library

Лицензия

Лицензия

Группа

Группа

com.ning
Идентификатор

Идентификатор

nagios
Последняя версия

Последняя версия

0.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

introspective-monitoring
Introspective Monitoring library
Ссылка на сайт

Ссылка на сайт

http://github.com/pierre/introspective-monitoring
Система контроля версий

Система контроля версий

http://github.com/pierre/introspective-monitoring/tree/master

Скачать nagios

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.ning/nagios/ -->
<dependency>
    <groupId>com.ning</groupId>
    <artifactId>nagios</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.ning/nagios/
implementation 'com.ning:nagios:0.0.2'
// https://jarcasting.com/artifacts/com.ning/nagios/
implementation ("com.ning:nagios:0.0.2")
'com.ning:nagios:jar:0.0.2'
<dependency org="com.ning" name="nagios" rev="0.0.2">
  <artifact name="nagios" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ning', module='nagios', version='0.0.2')
)
libraryDependencies += "com.ning" % "nagios" % "0.0.2"
[com.ning/nagios "0.0.2"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.googlecode.jsendnsca » jsendnsca jar 2.0.1
log4j : log4j jar 1.2.16
org.skife.config : config-magic jar 0.8

Модули Проекта

Данный проект не имеет модулей.

Introspective Monitoring

Enough with active checks! Make your service advertise its state to Nagios.

HOWTO

  1. Define your service check by implementing com.ning.nagios.ServiceCheck

  2. Configure how your service talks to Nagios by implementing com.ning.nagios.ServiceMonitor

  3. Register the check with your ServiceMonitor

For example, assuming you have a Config object:

public class NagiosMonitor implements ServiceMonitor
{
    private static final Logger log = Logger.getLogger(NagiosMonitor.class);

    private final ConcurrentMap<String, MonitoredService> services = new ConcurrentHashMap<String, MonitoredService>();
    private final PassiveCheckSender sender;
    private final MessagePayloadBuilder payloadBuilder;
    private final TimeSpan checkRate;

    @Inject
    public NagiosMonitor(final Config config)
    {
        this.sender = new NagiosPassiveCheckSender(new NagiosSettingsBuilder()
            .withNagiosHost(config.getNagiosHost())
            .withPort(config.getNagiosPort())
            .withEncryption(config.getNagiosEncryption())
            .withPassword(config.getNagiosPassword())
            .withConnectionTimeout((int) config.getNagiosTimeout().getMillis())
            .withResponseTimeout((int) config.getNagiosTimeout().getMillis())
            .create());
        this.payloadBuilder = new MessagePayloadBuilder().withHostname(config.getNagiosReportedHostname());
        this.checkRate = config.getNagiosCheckRate();
    }

    @Override
    public MonitoredService registerServiceCheck(final String serviceName, final ServiceCheck check)
    {
        final MonitoredService service = new JsendnscaService(serviceName, checkRate, check, sender, payloadBuilder);
        final MonitoredService existingService = services.putIfAbsent(serviceName, service);

        if (existingService != null) {
            throw new IllegalStateException(String.format("Service check [%s] has already been registered", serviceName));
        }

        log.info(String.format("Added service [%s] with check rate of [%s]", service, checkRate));

        return service;
    }
}

You can now do

// Talk to Nagios
final ServiceCheck check = injector.getInstance(ServiceCheck.class);
final ServiceMonitor serviceMonitor = injector.getInstance(ServiceMonitor.class);
serviceMonitor.registerServiceCheck(config.getNagiosServiceName(), check);

Note: the library comes with com.ning.nagios.FakeNagiosMonitor for testing.

License (see LICENSE-2.0.txt file for full license)

Copyright 2011 Ning

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Версии библиотеки

Версия
0.0.2
0.0.1