监控系统 - check

it2022-05-05  119

监控系统 - check_mk_agent

系统级监控

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 posted on 2014-10-21 15:54 北京涛子 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/liujitao79/p/4040575.html


最新回复(0)