diff --git a/freebsd/Makefile b/freebsd/Makefile new file mode 100644 index 0000000..c772081 --- /dev/null +++ b/freebsd/Makefile @@ -0,0 +1,33 @@ +# $FreeBSD$ + +PORTNAME= net-snmp-subagent-shell +PORTVERSION= 2.3.0.1 +CATEGORIES= net-mgmt +MASTER_SITES= https://github.com/sergevs/net-snmp-subagent-shell/releases/tag/${PORTVERSION} + +MAINTAINER= abrikus@gmail.com +COMMENT= A complete implementation of net-snmp subagent written on perl. Can be used to define arbitrary functions and provide the results via snmp. + +USE_RC_SUBR= subagent_shell + +USES=perl5 +USE_PERL5= run +USE_AUTOTOOLS= aclocal:env automake:env autoconf:env + +RUN_DEPENDS:= p5-XML-Simple>=2.10:${PORTSDIR}/textproc/p5-XML-Simple \ + net-snmp>=5.5:${PORTSDIR}/net-mgmt/net-snmp + +SUB_FILES= pkg-message +SUB_LIST= PERL=${PERL} + +post-configure: + @cd ${CONFIGURE_WRKSRC}; \ + aclocal; \ + automake --add-missing; \ + autoconf; \ + ./configure + +post-install: + @mv ${STAGEDIR}${PREFIX}/bin/subagent-shell ${STAGEDIR}${PREFIX}/bin/subagent_shell + +.include diff --git a/freebsd/distinfo b/freebsd/distinfo new file mode 100644 index 0000000..54bd6d5 --- /dev/null +++ b/freebsd/distinfo @@ -0,0 +1,2 @@ +SHA256 (net-snmp-subagent-shell-2.3.0.1.tar.gz) = 2b06e2539f77754eae47e7c752dcd6a84092acf1d4edd2b7aa95c338a9f2678f +SIZE (net-snmp-subagent-shell-2.3.0.1.tar.gz) = 84079 diff --git a/freebsd/files/pkg-message.in b/freebsd/files/pkg-message.in new file mode 100644 index 0000000..6f2c2d2 --- /dev/null +++ b/freebsd/files/pkg-message.in @@ -0,0 +1,12 @@ +**** This port installs net-snmp subagent-shell(subagent_shell) but does not start it by default. + If you want to auto-start subagent-shell, add the following to + /etc/rc.conf: + + subagent_shell_enable="YES" + + configuration files, MIBS, functions are located at %%PREFIX%%/etc/snmp/subagent-shell + + please note that in the order to run subagent-shell you have to run net-snmp snmpd + and configure agentx; add the following line to snmpd configuration file(snmpd.conf): + + master agentx diff --git a/freebsd/files/subagent_shell.in b/freebsd/files/subagent_shell.in new file mode 100644 index 0000000..ce27bc1 --- /dev/null +++ b/freebsd/files/subagent_shell.in @@ -0,0 +1,31 @@ +#!/bin/sh + +# PROVIDE: subagent-shell +# REQUIRE: DAEMON snmpd +# +# Add the following line to /etc/rc.conf to enable subagent-shell: +# +# subagent_shell_enable="YES" +# subagent_shell_flags="" + +. /etc/rc.subr + +name=subagent_shell +rcvar=subagent_shell_enable + +load_rc_config subagent-shell + +subagent_shell_enable=${subagent_shell_enable:-"NO"} + +pidfile=${subagent_shell_pidfile:-"/var/run/subagent_shell.pid"} +command_interpreter=%%PERL%% + +command=%%PREFIX%%/bin/${name} +start_precmd=subagent_shell_precmd + +subagent_shell_precmd () { + rc_flags="-d -b /usr/local/etc/snmp/subagent-shell -p ${pidfile} ${rc_flags}" +} + + +run_rc_command "$1" diff --git a/freebsd/pkg-descr b/freebsd/pkg-descr new file mode 100644 index 0000000..e88e747 --- /dev/null +++ b/freebsd/pkg-descr @@ -0,0 +1 @@ +Net SNMP subagent executes arbitrary commands and provide results via snmpd diff --git a/freebsd/pkg-plist b/freebsd/pkg-plist new file mode 100644 index 0000000..55ccddf --- /dev/null +++ b/freebsd/pkg-plist @@ -0,0 +1,23 @@ +@dir etc/snmp/subagent-shell +@dir etc/snmp/subagent-shell/mibs +@dir etc/snmp/subagent-shell/conf.d +bin/subagent_shell +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-APACHE-STATUS-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-DISKSTATS-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-DNSLOOKUP-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-EXEC-COMMAND-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-HTTP-RESPONSE-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-IP-CONNTRACK-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-LAST-LOGINS-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-MAILQ-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-NTPSYNC-STATUS-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-OSINFO-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-PING-STAT-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-PROC-STAT-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-RNDC-STAT-MIB.txt +etc/snmp/subagent-shell/mibs/SUBAGENT-SHELL-VMSTAT-MIB.txt +etc/snmp/subagent-shell/subagent-shell-base.functions +etc/snmp/subagent-shell/subagent-shell-conf.xml +etc/snmp/subagent-shell/subagent-shell-functions-conf.xml +share/man/man8/subagent-shell.8