diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..31d16d2 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +PREFIX=${CURDIR}/debian/librenms-agent + +install: + mkdir -p $(PREFIX)/usr/lib/check_mk_agent/plugins + mkdir -p $(PREFIX)/usr/lib/check_mk_agent/repo + mkdir -p $(PREFIX)/usr/lib/check_mk_agent/local + cp -r agent-local/* $(PREFIX)/usr/lib/check_mk_agent/repo/ + rm $(PREFIX)/usr/lib/check_mk_agent/repo/README + mkdir -p $(PREFIX)/usr/bin + install -m 0750 check_mk_agent $(PREFIX)/usr/bin/check_mk_agent + install -m 0750 mk_enplug $(PREFIX)/usr/bin/mk_enplug + install -m 0750 snmp/distro $(PREFIX)/usr/bin/distro + mkdir -p $(PREFIX)/etc/xinetd.d + install -m 0644 check_mk_xinetd $(PREFIX)/etc/xinetd.d/check_mk + +clean: + rm -rf $(CURDIR)/build diff --git a/agent-local/dmi b/agent-local/dmi index f040c89..58ec197 100755 --- a/agent-local/dmi +++ b/agent-local/dmi @@ -5,5 +5,5 @@ echo '<<>>' # requires dmidecode for FIELD in bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency do - echo $FIELD=$(dmidecode -s $FIELD) + echo $FIELD=$(dmidecode -s $FIELD | grep -v '^#') done diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7765710 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +librenms-agent (1.0.1) stable; urgency=low + + - Do not include the README in the repodir + + -- Mark Schouten Thu, 20 Aug 2015 14:15:00 +0200 + +librenms-agent (1.0) stable; urgency=low + + - Initial package release + + -- Mark Schouten Mon, 17 Aug 2015 15:00:00 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..730529c --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: librenms-agent +Section: misc +Priority: extra +Maintainer: Mark Schouten +Build-Depends: debhelper (>= 5) +Standards-Version: 3.9.1 + +Package: librenms-agent +Architecture: all +Pre-Depends: xinetd +Conflicts: check-mk-agent +Provides: check-mk-agent +Suggests: php-cli, php-mysql, libwww-perl, curl, dmidecode, netcat, ipmitool, lm-sensors, python-memcache, python-urllib3, rrdtool, libdbd-pg-perl +Description: Install the LibreNMS Unix Agent + Install the LibreNMS Unix Agent. Please note that the suggested packages are required for some of the plugins diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..cd01d11 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +case "$1" in + configure) + [ -x /usr/sbin/service ] && service xinetd restart + echo "Enable some default services" + /usr/bin/mk_enplug dpkg + /usr/bin/mk_enplug dmi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..edfc650 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +#export DH_VERBOSE=1 + +%: + dh $@ + diff --git a/mk_enplug b/mk_enplug new file mode 100755 index 0000000..db524ec --- /dev/null +++ b/mk_enplug @@ -0,0 +1,62 @@ +#!/bin/bash + +# Copyright (C) 2015 Mark Schouten +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 dated June, +# 1991. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See http://www.gnu.org/licenses/gpl.txt for the full license + +plugdir=/usr/lib/check_mk_agent/plugins +repodir=/usr/lib/check_mk_agent/repo + +findscripts() { + find ${repodir} -type f | sed -e "s#$repodir/##g" +} + +script_enabled() { + s=$1 + + if [ -L ${plugdir}/${s} ]; then + echo "yes" + else + echo "no" + fi +} + +enable_script() { + s=$1 + + ln -s ${repodir}/${s} ${plugdir}/${s} + echo "Enabled $s" +} + +scripts=$(findscripts) + +if [ ! -z "$1" ]; then + s=$1 +else + echo "Which plugin do you want to enable?" + echo ${scripts} + read s +fi + +echo "Enabling $s" + +if [ ! -z "$s" ]; then + if [ ! -r ${repodir}/${s} ]; then + echo "Plugin $s does not exist!" + exit 1 + fi + + if [ `script_enabled $s` != "yes" ]; then + enable_script $s + fi +fi