Bài đăng phổ biến
-
yum install install libxml2-devel Nguyen Si Nhan
-
How to create a bot to automate daily tasks using Slack Nguyen Si Nhan 1. Setting Up Your Slack App Create a Slack App: Sign in to your Sla...
Friday, October 19, 2012
Thursday, October 18, 2012
Monitor hardisk on dell server with small bash script
This is a my small scirpt (run it as cron),it will send to zabbix status Ok or Fail of your physical disk on Dell server :
Dell.sh
#!/bin/bash
#Writed by nhanns[@]vng[dot]com[dot]vn -nhannguyen[@]0937686468[dot]com
#skype: nguyen_si_nhan
#Program'll send alert status to zabbix
#Check number controller
[ ! -f "/opt/dell/srvadmin/bin/omreport" ] && { echo "omreport:file not found-please install hardware monitor for Dell"; exit 1; }
Controller=0
/opt/dell/srvadmin/bin/omreport storage controller >/tmp/controller.tmp
_file1="/tmp/controller.tmp"
#check empty file
if [ ! -s "$_file1" ]
then
echo "Can not run on this server"
exit 2
fi
while read line; do
Bool=0
if [[ "$line" = ID* ]]; then
Bool=1
(( Controller++ ))
# do something with ?
fi
done < /tmp/controller.tmp
#Export to file status of physical disk
i=0
rm -f /tmp/dellstatus.log;
while (( i < Controller )) ; do
/opt/dell/srvadmin/bin/omreport storage pdisk controller=$i >> /tmp/dellstatus.log
(( ++i ))
done
_file2="/tmp/dellstatus.log"
if [ ! -s "$_file2" ]
then
echo "Can not run on this server"
exit 3
fi
Failstatus=0
statusOK=0
while read line; do
BoolSt=0
BoolOk=0
if [[ "$line" = Status* ]]; then
BoolSt=1
(( Failstatus++ ))
# do something with ... ?
fi
if [[ "$line" = *Ok* ]]; then
BoolOk=1
(( statusOk++ ))
# do something with ...?
fi
if [[ "$line" = *Non-Critical* ]]; then
BoolOk=1
(( statusOk++ ))
# do something with ...?
fi
done < /tmp/dellstatus.log
#echo "There were Failstatus $Failstatus Status ."
#echo "There were statusOk $statusOk Ok ."
# Problem = ` $Failstatus - $statusOk `
#let Problem=$Failstatus - $statusOk
#echo 'There are'
#echo `expr $Failstatus - $statusOk `
/opt/zabbix/bin/zabbix_sender -c /opt/check.conf -k hddstatus -o `expr $Failstatus - $statusOk`
Saturday, October 6, 2012
Solved Linux extended iostat template problem
Problem:
+ Running data query [11].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/iostat.xml'
+ XML file parsed ok.
+ Invalid field <index_order>ioDescr:ioName:ioIndex</index_order>
+ Must contain <direction>input</direction> fields only
Solved:
Edit file <path_cacti>/resource/snmp_queries/iostat.xml
<interface><name>Get IOSTAT Devices</name><description>Queries a host for a list of monitorable devices from iostat</description><oid_index>.1.3.6.1.3.1</oid_index><index_order>ioDescr:ioName:ioIndex</index_order>Change this line: <index_order>ioDescr:ioName:ioIndex</index_order>to : <index_order>ioDescr:ioIndex</index_order>DoneNguyen Si Nhan
Subscribe to:
Posts (Atom)