Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does mfs monitor scripts in nagios

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to monitor the script of mfs in nagios, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Recently, I have been testing the mfs. Finally, after the online test, I began to organize and monitor the mfs.

Mfs monitoring index

Listening port

Listening process

Monitor vip

Monitor, read and write

Now a shell script for monitoring whether the process is alive is attached for reference only.

Root@loocha4:/usr/local/nagios/libexec/New# cat check_mfs.sh #! / bin/bash# = # # MFS status check plugins for nagios## Written by: caimengzhi# Release: 1.The Create Date: 2017-01-1 "Description: Nagios plugins (script) to check MFS status # # = # Nagios return codesSTATE_OK=0STATE_WARNING=1STATE_CRITICAL=2STATE_UNKNOWN=3status=0#Get Master server ProcessMaster () {MFS_PID=$ (ps-ef | grep-v grep | grep mfsmaster | wc- L) if [${MFS_PID}-eq 0] Then echo "ERROR: mfs master does not start" exit $STATE_CRITICAL else echo "OK: mfs master server running OK!" Exit $STATE_OK fi} # Get chunker server ProcessChunker () {MFS_PID=$ (ps-ef | grep-v grep | grep mfschunkserver | wc-l) if [${MFS_PID}-eq 0]; then echo "ERROR: mfschunkserver does not start" exit $STATE_CRITICAL else echo "OK: mfs master chunkserver running OK!" Exit $STATE_OK fi} Disk_used () {Disk_used= `df-h | grep ${mountpoint} | awk'{print $4} '`if [${Disk_used%/%}-ge ${warningdiskused}-a ${Disk_used%/%}-lt ${criticaldiskused}]; then echo "Waring: mfs diskused Rate is" ${Disk_used} "exit $STATE_WARNING elif [${Disk_used%/%}-ge ${criticaldiskused}] Then echo "CRITICAL: mfs disk used Rate is" ${Disk_used} "" exit $STATE_CRITICAL elif ["${Disk_used%/%}" = "]; then echo" CRITICAL: mfs client not mount on "exit $STATE_CRITICAL else echo" OK: MFS client mount on and disk used rate is "${Disk_used}", Everything is OK! " Exit $STATE_OK fi} # Get metalogger server ProcessMetalogger () {MFS_PID=$ (ps-ef | grep-v grep | grep mfsmetalogger | wc-l) if [${MFS_PID}-eq 0]; then echo "ERROR: mfs mfsmetalogger does not start" exit $STATE_CRITICAL else echo "OK: mfs master mfsmetalogger running OK!" Exit $STATE_OK fi} # Functions plugin usageprint_usage () {echo "" echo "- M MFS master server status" echo "- C MFS chunker server status" echo "- U MFS client disk used Rate" echo "- L MFS metalogger server status" echo "- h Show this page" echo "" echo "Usage1: sh check_mfs.sh-M mfsmasterpath" echo "ex: sh check_mfs.sh-M / usr / sbin/mfs "echo" Usage2: sh check_mfs.sh-C mfschunkpath "echo" ex: sh check_mfs.sh-C / usr/sbin/mfs "echo" Usage3: sh check_mfs.sh-U mountpoint warningrate criticalrate "echo" ex: sh check_mfs.sh-U / mnt/mfs 6080 "echo" Usage4: sh check_mfs.sh-L mfsmetaloggerpath "echo" ex: sh check_mfs.sh-L / usr/ Sbin/mfs "echo" ex: sh check_mfs.sh-h "echo"exit 0} if [$#-ne 1] Then echo "Pls input sh $0-h and check." Print_usage exit 1X in # Parse parameterwhile [$#-gt 0] do case "$1" in-H |-h |-- help) print_usage exit $STATE_OK;;-M |-m |-master) Master;;-C |-c |-- chunker) Chunker -U |-u |-- usedwarning) mountpoint=$ {2 print_usage exit-"/ mnt/mfs"} warningdiskused=$ {3 warningdiskused=$-"75"} criticaldiskused=$ {4V-"85"} Disk_used;;-L |-l |-- metalogger) Metalogger;; *) echo "Unknown argement: $1" print_usage exit $STATE_UNKNOWN Esacshiftdoneexit 0

Here are the results of the test

Root@loocha4:/usr/local/nagios/libexec/New# ps aux | grep mfsroot 1148 0.0 8112 936 pts/0 S + 13:29 0:00 grep-- color=auto mfsmfs 6021 1.2 0.3 455572 204124? S

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report