diff --git a/Dockerfile.alpine b/Dockerfile.alpine index dcef9bb..934ba8f 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -6,7 +6,16 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset +WORKDIR / + +RUN apk --update add bash coreutils libintl curl gcc g++ make openssl-dev net-snmp-tools linux-headers procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + WORKDIR /usr/lib/monitoring-plugins/ -RUN apk --update add bash monitoring-plugins coreutils libintl RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.amazon1 b/Dockerfile.amazon1 index 9c4ed02..5c9abee 100644 --- a/Dockerfile.amazon1 +++ b/Dockerfile.amazon1 @@ -6,7 +6,16 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib64/nagios/plugins/ +WORKDIR / + +RUN yum groupinstall -y "Development Tools" && yum install -y curl expat-devel openssl openssl-devel net-snmp-utils bind-utils && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN yum-config-manager --enable epel && yum install -y which tar nagios-plugins-all RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.amazon2 b/Dockerfile.amazon2 index dba2d97..21decd8 100644 --- a/Dockerfile.amazon2 +++ b/Dockerfile.amazon2 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib64/nagios/plugins/ +WORKDIR / + +RUN yum groupinstall -y "Development Tools" && \ + yum install -y curl expat-devel openssl openssl-devel net-snmp-utils bind-utils which procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN amazon-linux-extras install -y epel && yum install -y which tar nagios-plugins-all RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.centos6 b/Dockerfile.centos6 index 7d20826..245a810 100644 --- a/Dockerfile.centos6 +++ b/Dockerfile.centos6 @@ -8,5 +8,16 @@ ADD create-sensu-asset /usr/bin/create-sensu-asset WORKDIR /usr/lib64/nagios/plugins/ -RUN yum install -y epel-release which && yum install -y nagios-plugins-all +WORKDIR / + +RUN yum groupinstall -y "Development Tools" && yum install -y curl expat-devel openssl openssl-devel net-snmp-utils bind-utils && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ + RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index 7d23732..45604a7 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib64/nagios/plugins/ +WORKDIR / + +RUN yum groupinstall -y "Development Tools" && \ + yum install -y curl expat-devel openssl openssl-devel net-snmp-utils bind-utils which procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN yum install -y epel-release which && yum install -y nagios-plugins-all RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.centos8 b/Dockerfile.centos8 index bb9a5b6..40e2a91 100644 --- a/Dockerfile.centos8 +++ b/Dockerfile.centos8 @@ -6,7 +6,19 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib64/nagios/plugins/ +WORKDIR / + +RUN rm -rf /var/cache/dnf && \ + dnf -y upgrade && \ + dnf groupinstall -y "Development Tools" && \ + dnf install -y curl expat-devel openssl openssl-devel net-snmp-utils bind-utils which procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN yum install -y epel-release which && yum --enablerepo=PowerTools install -y nagios-plugins-all RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.debian10 b/Dockerfile.debian10 index ee72e07..2d2d660 100644 --- a/Dockerfile.debian10 +++ b/Dockerfile.debian10 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib/nagios/plugins/ +WORKDIR / + +RUN apt-get update && \ + apt-get install -y build-essential curl libexpat1-dev openssl libssl-dev libz-dev snmp dnsutils procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN apt-get update && apt-get install -y monitoring-plugins-basic RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.debian8 b/Dockerfile.debian8 index 337a6d9..049c94e 100644 --- a/Dockerfile.debian8 +++ b/Dockerfile.debian8 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib/nagios/plugins/ +WORKDIR / + +RUN apt-get update && \ + apt-get install -y build-essential curl libexpat1-dev openssl libssl-dev libz-dev snmp dnsutils && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN apt-get update && apt-get install -y monitoring-plugins-basic RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.debian9 b/Dockerfile.debian9 index 40e76f9..faddaa0 100644 --- a/Dockerfile.debian9 +++ b/Dockerfile.debian9 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib/nagios/plugins/ +WORKDIR / + +RUN apt-get update && \ + apt-get install -y build-essential curl libexpat1-dev openssl libssl-dev libz-dev snmp dnsutils procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN apt-get update && apt-get install -y monitoring-plugins-basic RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.ubuntu1604 b/Dockerfile.ubuntu1604 index a5e8a93..01775d7 100644 --- a/Dockerfile.ubuntu1604 +++ b/Dockerfile.ubuntu1604 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib/nagios/plugins/ +WORKDIR / + +RUN apt-get update && \ + apt-get install -y build-essential curl libexpat1-dev openssl libssl-dev libz-dev snmp dnsutils procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN apt-get update && apt-get install -y monitoring-plugins-basic RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 index aeec380..afebd45 100644 --- a/Dockerfile.ubuntu1804 +++ b/Dockerfile.ubuntu1804 @@ -6,7 +6,17 @@ ARG PLUGINS="check_http" ADD create-sensu-asset /usr/bin/create-sensu-asset -WORKDIR /usr/lib/nagios/plugins/ +WORKDIR / + +RUN apt-get update && \ + apt-get install -y build-essential curl libexpat1-dev openssl libssl-dev libz-dev snmp dnsutils procps && \ + curl -s -L -O https://www.monitoring-plugins.org/download/monitoring-plugins-2.2.tar.gz && \ + tar xzf monitoring-plugins-2.2.tar.gz && \ + cd monitoring-plugins-2.2 && \ + ./configure --prefix=/usr --libexecdir=/usr/lib/monitoring-plugins && \ + make && \ + make install + +WORKDIR /usr/lib/monitoring-plugins/ -RUN apt-get update && apt-get install -y monitoring-plugins-basic RUN create-sensu-asset -a $SENSU_GO_ASSET_NAME -b $PLUGINS -v $SENSU_GO_ASSET_VERSION -o / diff --git a/README.md b/README.md index ae58180..8a939ba 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,20 @@ +[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu/monitoring-plugins) +[![Build Status](https://travis-ci.org/sensu/monitoring-plugins.svg?branch=master)](https://travis-ci.org/sensu/monitoring-plugins) # Sensu Assets: Monitoring Plugins ## Overview An attempt at packaging individual C plugins from the excellent Monitoring -Plugins project (https://monitoring-plugins.org)[1] in the [Sensu Go][2] +Plugins project [https://monitoring-plugins.org][1] in the [Sensu Go][2] [Asset][3] format. The goal of the project is to provide a simple workflow for creating a Sensu Go Asset containing the C plugins. ## Goal -The goal of this project is to provide Sensu Go Assets for CentOS/RHEL Linux (6, 7, and 8), Debian Linux (8, 9, and 10), Ubuntu Linux (16.04 and 18.04), and Alpine Linux containing all of the plugins from the Monitoring Plugins project. +The goal of this project is to provide Sensu Go Assets for CentOS/RHEL Linux +(6, 7, and 8), Debian Linux (8, 9, and 10), Ubuntu Linux (16.04 and 18.04), +Amazon Linux (1 and 2), and Alpine Linux containing a good subset of the +plugins from the Monitoring Plugins project. ### Current Status @@ -18,28 +23,44 @@ Currently, This project will attempt to provide support for the following plugin - `check_disk` - `check_dns` - `check_http` +- `check_load` +- `check_log` +- `check_mailq` - `check_ntp` - `check_ntp_peer` - `check_ntp_time` - `check_ping` - `check_procs` - `check_smtp` +- `check_snmp` - `check_ssh` - `check_swap` - `check_tcp` - `check_time` - `check_users` -### Next Steps -In no particular order: +### Caveats -- Add support for platform-specific exclusions in the build script (i.e. if - `check_snmp` is available for CentOS and Debian, but not for Alpine, just skip - it on Alpine?) -- Build the plugins from scratch instead of installing the distribution packages - (which are inconsistent between Alpine, Debian, and CentOS) -- Hook up a CI pipeline to automate the builds +Several plugins, though compiled binaries, require that certain commands be available from the OS. + +Examples (not exhaustive): + +* `check_snmp` requires `snmpget` +* `check_procs` requires `ps` +* `check_dns` requires `nslookup` + +## Configuration +### Sensu Go +#### Asset registration + +Assets are the best way to make use of this plugin. If you're not using an asset, please +consider doing so! If you're using sensuctl 5.13 or later, you can use the following +command to add the asset: + +`sensuctl asset add sensu/monitoring-plugins` + +If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai Asset Index page](https://bonsai.sensu.io/assets/sensu/monitoring-plugins). ## Build diff --git a/build.sh b/build.sh index 41e49a1..4d5dfd3 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export PLUGINS="check_disk,check_http,check_ntp,check_ntp_peer,check_ntp_time,check_ping,check_procs,check_smtp,check_ssh,check_swap,check_tcp,check_time,check_users" +export PLUGINS="check_disk,check_dns,check_http,check_load,check_log,check_mailq,check_ntp,check_ntp_peer,check_ntp_time,check_ping,check_procs,check_smtp,check_snmp,check_ssh,check_swap,check_tcp,check_time,check_users" export SENSU_GO_ASSET_VERSION=$(git describe --abbrev=0 --tags) mkdir assets/ diff --git a/travis-build.sh b/travis-build.sh index 351216b..66d8b33 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -6,7 +6,7 @@ # Hardwiring repo-name for now, untile the Dockerfile logic is abstracted/tested to use name as passed to docker as build arg REPO_NAME="monitoring-plugins" -export PLUGINS="check_disk,check_http,check_ntp,check_ntp_peer,check_ntp_time,check_ping,check_procs,check_smtp,check_ssh,check_swap,check_tcp,check_time,check_users" +export PLUGINS="check_disk,check_dns,check_http,check_load,check_log,check_mailq,check_ntp,check_ntp_peer,check_ntp_time,check_ping,check_procs,check_smtp,check_snmp,check_ssh,check_swap,check_tcp,check_time,check_users" [[ -z "$WDIR" ]] && { echo "WDIR is empty using bonsai/" ; WDIR="bonsai/"; }