mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
Place all plugins in a repo-dir and add mk_enplug to enable plugins
This commit is contained in:
4
Makefile
4
Makefile
@ -2,10 +2,12 @@ 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/plugins/
|
||||
cp -r agent-local/* $(PREFIX)/usr/lib/check_mk_agent/repo/
|
||||
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
|
||||
mkdir -p $(PREFIX)/etc/xinetd.d
|
||||
install -m 0644 check_mk_xinetd $(PREFIX)/etc/xinetd.d/check_mk
|
||||
|
||||
|
48
mk_enplug
Executable file
48
mk_enplug
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
Reference in New Issue
Block a user