wok-next diff nagisk/receipt @ rev 16740

Add nagisk
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 08 15:15:22 2014 +0200 (2014-06-08)
parents
children b5f37c66eddd
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nagisk/receipt	Sun Jun 08 15:15:22 2014 +0200
     1.3 @@ -0,0 +1,49 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="nagisk"
     1.7 +VERSION="1.2.5"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Simple tool to monitor Asterisk from a Nagios server."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +LICENSE="GPL3"
    1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.13 +WEB_SITE="https://github.com/nicolargo/nagisk"
    1.14 +WGET_URL="https://codeload.github.com/nicolargo/nagisk/tar.gz/v$VERSION"
    1.15 +
    1.16 +DEPENDS="nagios-nrpe perl sudo"
    1.17 +BUILD_DEPENDS="wget"
    1.18 +
    1.19 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.20 +genpkg_rules()
    1.21 +{
    1.22 +	mkdir -p $fs/usr/share/nagios/libexec
    1.23 +	cp -a $src/nagisk.pl $fs/usr/share/nagios/libexec
    1.24 +	sed -i 's/^elsif/} &/' $fs/usr/share/nagios/libexec/nagisk.pl
    1.25 +}
    1.26 +
    1.27 +# Pre and post install commands for Tazpkg.
    1.28 +post_install()
    1.29 +{
    1.30 +	grep -qs check_asterisk_version $1/etc/nagios/nrpe.cfg ||
    1.31 +	cat >> $1/etc/nagios/nrpe.cfg <<EOT
    1.32 +command[check_asterisk_version]=/usr/share/nagios/libexec/nagisk.pl -c version
    1.33 +command[check_asterisk_peers]=/usr/share/nagios/libexec/nagisk.pl -c peers -w \$ARG1\$ -x \$ARG2\$
    1.34 +command[check_asterisk_peer]=/usr/share/nagios/libexec/nagisk.pl -c peer -p \$ARG1\$ -w \$ARG2\$ -x \$ARG3\$
    1.35 +command[check_asterisk_channels]=/usr/share/nagios/libexec/nagisk.pl -c channels -w \$ARG1\$ -x \$ARG2\$
    1.36 +command[check_asterisk_konference]=/usr/share/nagios/libexec/nagisk.pl -c konference -w \$ARG1\$ -x \$ARG2\$
    1.37 +command[check_asterisk_jabber]=/usr/share/nagios/libexec/nagisk.pl -c jabber -b \$ARG1\$
    1.38 +#command[check_asterisk_zaptel]=/usr/share/nagios/libexec/nagisk.pl -c zaptel
    1.39 +#command[check_asterisk_span]=/usr/share/nagios/libexec/nagisk.pl -c span -s \$ARG1\$
    1.40 +#command[check_asterisk_dahdi]=/usr/share/nagios/libexec/nagisk.pl -c dahdi
    1.41 +#command[check_asterisk_dahdi_span]=/usr/share/nagios/libexec/nagisk.pl -c dahdi_span -s \$ARG1\$
    1.42 +#command[check_asterisk_pri_span]=/usr/share/nagios/libexec/nagisk.pl -c pri_span -s \$ARG1\$
    1.43 +#command[check_asterisk_pri_spans]=/usr/share/nagios/libexec/nagisk.pl -c pri_spans
    1.44 +command[check_asterisk_registry]=/usr/share/nagios/libexec/nagisk.pl -c registry
    1.45 +EOT
    1.46 +	grep '^nagios ALL= NOPASSWD' $1/etc/sudoers | grep -q asterisk ||
    1.47 +	cat >> $1/etc/sudoers <<EOT
    1.48 +www ALL= NOPASSWD: /usr/sbin/asterisk
    1.49 +EOT
    1.50 +	chown nagios:nagios $1/usr/share/nagios/libexec
    1.51 +	chown nagios:nagios $1/usr/share/nagios/libexec/nagisk.pl
    1.52 +}