Categorygithub.com/atc0005/check-illiad
repository
0.2.15
Repository: https://github.com/atc0005/check-illiad.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

check-illiad

Go-based tooling to check/verify an ILLiad server instance.

Latest Release Go Reference go.mod Go version Lint and Build Project Analysis

Table of Contents

Project home

See our GitHub repo for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.

Overview

This repo is intended to provide Nagios plugins that may be used to monitor an ILLiad instance. As of this writing, a plugin named check_illiad_emails is available that may be used to monitor email notifications.

Features

The check_illiad_emails plugin supports monitoring Pending email notifications:

  • with a greater number queued than specified
  • that have remained "in the queue" for longer than a specified amount of time

Default values are provided, but are easily overridden with custom values in order to match usage patterns for each instance.

Status

As of this writing, this plugin is just leaving the bench for real-world use. There may be bugs or minor issues present. Please report any issues that you encounter.

Changelog

See the CHANGELOG.md file for the changes associated with each release of this application.

Requirements

The following is a loose guideline. Other combinations of Go and operating systems for building and running tools from this repo may work, but have not been tested.

Building source code

  • Go
    • see this project's go.mod file for preferred version
    • this project tests against officially supported Go releases
      • the most recent stable release (aka, "stable")
      • the prior, but still supported release (aka, "oldstable")
  • GCC
    • if building with custom options (as the provided Makefile does)
  • make
    • if using the provided Makefile

Running

  • Windows 10
  • Ubuntu Linux 18.04+

Installation

From source

  1. Download Go
  2. Install Go
    • NOTE: Pay special attention to the remarks about $HOME/.profile
  3. Clone the repo
    1. cd /tmp
    2. git clone https://github.com/atc0005/check-illiad
    3. cd check-illiad
  4. Install dependencies (optional)
    • for Ubuntu Linux
      • sudo apt-get install make gcc
    • for CentOS Linux
      • sudo yum install make gcc
    • for Windows
      • Emulated environments (easier)
        • Skip all of this and build using the default go build command in Windows (see below for use of the -mod=vendor flag)
        • build using Windows Subsystem for Linux Ubuntu environment and just copy out the Windows binaries from that environment
        • If already running a Docker environment, use a container with the Go tool-chain already installed
        • If already familiar with LXD, create a container and follow the installation steps given previously to install required dependencies
      • Native tooling (harder)
        • see the StackOverflow Question 32127524 link in the References section for potential options for installing make on Windows
        • see the mingw-w64 project homepage link in the References section for options for installing gcc and related packages on Windows
  5. Build binaries
    • for the current operating system, explicitly using bundled dependencies in top-level vendor folder
      • go build -mod=vendor ./cmd/check_illiad_emails/
    • for all supported platforms (where make is installed)
      • make all
    • for use on Windows
      • make windows
    • for use on Linux
      • make linux
  6. Copy the newly compiled binary from the applicable /tmp subdirectory path (based on the clone instructions in this section) below and deploy where needed.
    • if using Makefile
      • look in /tmp/check-illiad/release_assets/check_illiad_emails/
    • if using go build
      • look in /tmp/check-illiad/

NOTE: Depending on which Makefile recipe you use the generated binary may be compressed and have an xz extension. If so, you should decompress the binary first before deploying it (e.g., xz -d check_illiad_emails-linux-amd64.xz).

Using release binaries

  1. Download the latest release binaries
  2. Decompress binaries
    • e.g., xz -d check_illiad_emails-linux-amd64.xz
  3. Rename binaries
  4. Deploy
    • Place check_illiad_emails in the same location where your distro's package manager places other Nagios plugins
      • as /usr/lib/nagios/plugins/check_illiad_emails on Debian-based systems
      • as /usr/lib64/nagios/plugins/check_illiad_emails on RedHat-based systems

NOTE:

DEB and RPM packages are provided as an alternative to manually deploying binaries.

Configuration

Precedence

The priority order is:

  1. Command line flags (highest priority)
  2. Environment variables
  3. Default settings (lowest priority)

In general, command-line options are the primary way of configuring settings for this application, but environment variables are also a supported alternative. Most plugin settings require that a value be specified by the sysadmin, though some (e.g., logging) have useful defaults.

Command-line Arguments

  • Flags marked as required must be set via CLI flag or environment variable.
  • Flags not marked as required are for settings where a useful default is already defined.
OptionRequiredDefaultRepeatPossibleDescription
h, helpNofalseNoh, helpShow Help text along with the list of supported flags.
emit-brandingNofalseNotrue, falseToggles emission of branding details with plugin status details. This output is disabled by default.
log-levelNoinfoNodisabled, panic, fatal, error, warn, info, debug, traceLog message priority filter. Log messages with a lower level are ignored.
hostYesempty listNovalid fqdn or IP AddressThe hostname of the database server hosting the database used by the ILLiad software. If using encryption, this value should match one of the Subject Alternate Name (SANs) values listed on the certificate.
portNofalseNotrue, falseThe TCP port used to connect to the database server. If not specified, the default port will be used.
instanceNoempty stringNovalid instance nameThe database server instance name. This may be blank.
db-nameYesempty stringNovalid database nameThe name of the database used by ILLiad software and checked by plugins from this project.
usernameYesempty stringNovalid usernameThe username used to connect to the database server. An account with read-only access to the database used by the ILLiad software is sufficient.
passwordYesempty stringNovalid passwordThe plaintext password used to connect to the database server. An account with read-only access to the database used by the ILLiad software is sufficient.
encrypt-modeNofalseNotrue, false, disableWhether data sent between client and server is encrypted. true for yes, false for login packet only and disable for no encryption.
trust-certNofalseNotrue, falseWhether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option.
ignore-missing-emailsNofalseNotrue, falseWhether finding zero email notifications recorded in the database used by ILLiad software should be treated as an OK state. Legitimate scenarios include fresh ILLiad installations or recent purge of history.
count-warningNo1No1+ (minimum of 1)The number of pending email notifications when this plugin will consider the service check to be in a WARNING state.
count-criticalNo3No2+ (minimum 1 greater than warning)The number of pending email notifications when this plugin will consider the service check to be in a CRITICAL state.
age-warningNo5No1+ (minimum of 1)The number of minutes an email notification has been in a pending status when this plugin will consider the service check to be in a WARNING state.
age-criticalNo10No2+ (minimum 1 greater than warning)The number of minutes an email notification has been in a pending status when this plugin will consider the service check to be in a CRITICAL state.

Environment Variables

If used, command-line arguments override the equivalent environment variables listed below. See the Command-line Arguments table for more information.

Flag NameEnvironment Variable NameNotesExample (mostly using default values)
emit-brandingCHECK_ILLIAD_EMAILS_EMIT_BRANDINGCHECK_ILLIAD_EMAILS_EMIT_BRANDING="false"
log-levelCHECK_ILLIAD_EMAILS_LOG_LEVELCHECK_ILLIAD_EMAILS_LOG_LEVEL="info"
hostCHECK_ILLIAD_DBSERVER_HOSTCHECK_ILLIAD_DBSERVER_HOST="mssql52.example.com"
portCHECK_ILLIAD_DBSERVER_PORTCHECK_ILLIAD_DBSERVER_PORT="1433"
instanceCHECK_ILLIAD_DBSERVER_INSTANCECHECK_ILLIAD_DBSERVER_INSTANCE="mssql07"
db-nameCHECK_ILLIAD_DATABASE_NAMECHECK_ILLIAD_DATABASE_NAME="ILLData"
usernameCHECK_ILLIAD_DBSERVER_USERNAMECHECK_ILLIAD_DBSERVER_USERNAME="dbuser"
passwordCHECK_ILLIAD_DBSERVER_PASSWORDCHECK_ILLIAD_DBSERVER_PASSWORD="dbPasW0rdZ"
encrypt-modeCHECK_ILLIAD_DBSERVER_ENCRYPT_MODECHECK_ILLIAD_DBSERVER_ENCRYPT_MODE="false"
trust-certCHECK_ILLIAD_TRUST_CERTCHECK_ILLIAD_TRUST_CERT="false"
ignore-missing-emailsCHECK_ILLIAD_IGNORE_MISSING_EMAILSCHECK_ILLIAD_IGNORE_MISSING_EMAILS="false"
count-warningCHECK_ILLIAD_COUNT_WARNINGCHECK_ILLIAD_COUNT_WARNING="1"
count-criticalCHECK_ILLIAD_COUNT_CRITICALCHECK_ILLIAD_COUNT_CRITICAL="3"
age-warningCHECK_ILLIAD_AGE_WARNINGCHECK_ILLIAD_AGE_WARNING="5"
age-criticalCHECK_ILLIAD_AGE_CRITICALCHECK_ILLIAD_AGE_CRITICAL="10"

Example

Default thresholds

$ ./check_illiad_emails --host mssql52.example.com --port 1433 --instance mssql07 --username dbuser --password 'dbPasW0rdZ' --encrypt-mode false --trust-cert --db-name illdata
OK: 0 email notifications in a pending state found without crossing specified thresholds

**ERRORS**

* None

**THRESHOLDS**

* CRITICAL: [Age: 10m0s, Count: 3]
* WARNING: [Age: 5m0s, Count: 1]

**DETAILED INFO**

* Database Connection
** Host: "mssql52.example.com"
** Port: 1433
** Instance: "mssql07"
** Database: "illdata"
** Encryption Mode: "false"
** Trust Server Cert (disable verification): true

License

MIT License

Copyright (c) 2020 Adam Chalkley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Related projects

References