Skip to content

Commit

Permalink
Merge pull request #15 from nixwiz/compile_from_source
Browse files Browse the repository at this point in the history
Compile from source
  • Loading branch information
Caleb Hailey authored Apr 4, 2020
2 parents 69b7bb9 + 0eb9566 commit 03d28fd
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 32 deletions.
11 changes: 10 additions & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
13 changes: 11 additions & 2 deletions Dockerfile.amazon1
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.amazon2
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
13 changes: 12 additions & 1 deletion Dockerfile.centos6
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
16 changes: 14 additions & 2 deletions Dockerfile.centos8
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.debian10
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.debian8
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.debian9
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.ubuntu1604
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
14 changes: 12 additions & 2 deletions Dockerfile.ubuntu1804
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 1 addition & 1 deletion travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"; }

Expand Down

0 comments on commit 03d28fd

Please sign in to comment.