系统级监控
cpu (system, user)
memory (cache, buffer, use)(MB)
load (cpu core)
diskspace (used, inode)(GB)
diskio (read, write, io)
traffic (in, out)(Mb)
应用级监控
tcp connection
nfs mount
web access user count
lvs
haproxy
install
yum -y install xinetd
yum -y install check-mk-agent-1.2.6p2-1.noarch.rpm
/etc/xinetd.d/check_mk
service check_mk
{
type = UNLISTED
port = 6556
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/check_mk_agent
# If you use fully redundant monitoring and poll the client
# from more then one monitoring servers in parallel you might
# want to use the agent cache wrapper:
#server = /usr/bin/check_mk_caching_agent
# configure the IP address(es) of your Nagios server here:
#only_from = 127.0.0.1 10.0.20.1 10.0.20.2
# Don't be too verbose. Don't log every check. This might be
# commented out for debugging. If this option is commented out
# the default options will be used for this service.
log_on_success =
disable = no
}
/usr/lib/check_mk_agent/plugins
These plugins can be installed in the plugins directory of the Linux agent
in /usr/lib/check_mk_agent/plugins/. Please only install the plugins that
you really need.
If you want a plugin to be run asynchronously and also in
a larger interval then the normal check interval, then you can
copy it to a subdirectory named after a number of *minutes*,
e.g.:
/usr/lib/check_mk_agent/plugins/60/mk_zypper
In that case the agent will:
- Run this plugin in the background and wait not for it to finish.
- Store the result of the plugin in a cache file below /etc/check_mk/cache.
- Use that file for one hour before running the script again.
plugins example
# Run and *send* only once every __ seconds
. $MK_CONFDIR/mk_inventory.cfg 2>/dev/null || true
# Default to four hours
INTERVAL=${INVENTORY_INTERVAL:-14400}
FLAGFILE=$MK_VARDIR/mk_inventory.last.$REMOTE
LAST_RUN=$(stat -c %Y $FLAGFILE)
NOW=$(date +%s)
UNTIL=$((NOW + INTERVAL + 600))
if [ $(( NOW - LAST_RUN )) -ge $INTERVAL ]
then
touch $FLAGFILE
# List of DEB packages
if type dpkg-query >/dev/null; then
echo "<<<lnx_packages:sep(124):persist($UNTIL)>>>"
dpkg-query --show --showformat='${Package}|${Version}|${Architecture}|deb|${Summary}|${Status}\n'
fi
# List of RPM packages in same format
if type rpm >/dev/null; then
echo "<<<lnx_packages:sep(9):persist($UNTIL)>>>"
rpm -qa --qf '%{NAME}\t%{VERSION}\t%{ARCH}\trpm\t%{SUMMARY}\t-\n'
fi
# Information about distribution
echo "<<<lnx_distro:sep(124):persist($UNTIL)>>>"
for f in /etc/{debian_version,lsb-release,redhat-release,SuSE-release} ; do
if [ -e $f ] ; then
echo -n "$f|" ; tr \\n \| < $f | sed 's/|$//' ; echo
fi
done
# CPU Information. We need just the first one
if [ -e /proc/cpuinfo ] ; then
echo "<<<lnx_cpuinfo:sep(58):persist($UNTIL)>>>"
sed 's/[[:space:]]*:[[:space:]]*/:/' < /proc/cpuinfo
fi
# Information about main board, memory, etc.
if type dmidecode >/dev/null ; then
echo "<<<dmidecode:sep(58):persist($UNTIL)>>>"
dmidecode -q | sed 's/\t/:/g'
fi
# Information about kernel architecture
if type uname >/dev/null ; then
echo "<<<lnx_uname:persist($UNTIL)>>>"
uname -m
uname -r
fi
if type lspci > /dev/null ; then
echo "<<<lnx_vga:sep(58):persist($UNTIL)>>>"
lspci -v -s $(lspci | grep VGA | cut -d" " -f 1)
fi
fi
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类