1 Star 0 Fork 0

打望两江/librenms-agent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mk_enplug 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
# Copyright (C) 2015 Mark Schouten <mark@tuxis.nl>
#
# 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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/geekpi/librenms-agent.git
git@gitee.com:geekpi/librenms-agent.git
geekpi
librenms-agent
librenms-agent
master

搜索帮助