Coder Social home page Coder Social logo

quarkus-nagios's Introduction

quarkus-nagios

Example

@Wellness
@Singleton
public class QueueSizeHealth implements HealthCheck {

    @Override
    public NagiosCheckResponse call() {
        int queueSize = ...
        return QUEUE_SIZE.result(queueSize).asResponse();
    }

    private static final NagiosCheck QUEUE_SIZE = NagiosCheck.named("queue size")
            .performance()           // export as performance data
            .warningIf().above(30)   // warning range
            .criticalIf().above(100) // critical range
            .build();
}

Nagios

Shell script to set-up as an active service check in nagios:

#!/bin/bash

url=$1

if [ -z "$url" ]; then
    echo "usage: $0 URL"
    exit
fi

declare -A statusmap=(
  ["OK"]="0"
  ["WARN"]="1"
  ["WARNING"]="1"
  ["CRIT"]="2"
  ["CRITICAL"]="2"
  ["UNKNOWN"]="3"
)

result=$(curl --fail --max-time 15 --connect-timeout 7 $url 2>/dev/null)

status=${result%%:*}

exitcode=3
if [ -z "$result" ]; then
    result="UNKNOWN: Got unkown result from $url"
elif [ -z "${statusmap[$status]}" ]; then
    exitcode=${statusmap[$status]}
fi

echo $result
exit $exitcode

deploy

> mvn -DnewVersion=x.x.x versions:set
> mvn -DnewVersion=x.x.x -pl quarkus-nagios-extension versions:set
> mvn -Prelease clean deploy

quarkus-nagios's People

Contributors

derari avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.