??????Nagios???????????????
???????????? ???????[ 2013/1/22 10:42:02 ] ????????
????????????Nagios?????????????????書?????????п??ò???????????????????????????????????????????????б?д?????????????????б?д?????
????Nagios??????????κ??????????????д??????????????????Nagios????????????Bash????????дNagios???????????????????????????????ü???
??????????????е???????Ч??Nagios??饗Nagios check????????????????????????????????????У?
?????? 0--?????涼?????????????ɡ?
?????? 1--????????????????????????
?????? 2--??????????????????????????崻??????δ???С?
?????? 3--δ???????δ???????????????????????и??????????????????
?????????????????????????????£???????????Nagios web?????Nagios???????????С????????????????????????????????????ò????????????????????????????????????????????????????????????
??????Bash??д?????????Nagios??????????????????????????????????????
#!/bin/bash
????#?????????Σ?$1???????????
filename=$1
????#??????????????????????????????????飬?????????顣
if [ ! -e $filename ]; then
echo "CRITICAL status - file $filename doesn't exist"
????exit 2 #?????????????????????????????????????????????
????#?????????????????????????????????????????????????
elif [ ! -r $filename ]; then
echo "WARNING status - file $filename is not readable."
????exit 1 #???????????????????????????????????????
????#????????????????????????????????????????????????豸?????
elif [ ! -f $filename ]; then
echo "UNKNOWN status - file $filename is not a file."
????exit 3 #????δ?????
????#???????????????????????????????????
else
echo "OK status - file is OK"
exit 0 #Return OK status
fi
????????Bash????#???????????????????????????????????????????????Bash?????????????????????????????http://tldp.org/LDP/abs/html/fto.html????
???????????????????????????????????????Nagios??????????????????????????????е????м??????????????????????????????????????????????????
??????ò??
???????????£????е?Nagios????????????$USER1????????????У??????????/etc/nagios/private/resource.cfg?ж??塣??????EPEL?洢??http://fedoraproject.org/wiki/EPEL???????Nagios????????£?$USER1???????/usr/lib/nagios/plugins???????????????????????????????????$USER1????????????С?????????root???У???????????755??Nagios??????nagios???????nagios?1??????????????????????????????????
????????????????/usr/lib/nagios/plugins???У???????/etc/nagios/objects/commands.cfg????????????Nagios?????????????????check_file.sh??????????????壺
????#????????????????????
define command{
command_name check_file
command_line $USER1$/check_file.sh $ARG1$
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11