zabbix监控dell服务器脚本及方式key值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
function CheckChassis ()
{
OMREPORTPATH="/opt/dell/srvadmin/bin/"
TRIGGER=`"$OMREPORTPATH"omreport chassis | grep -i "$1" awk {'print $1'}`;
echo "$TRIGGER";
}
 
function CheckRaidStatus ()
{
OMREPORTPATH="/opt/dell/srvadmin/bin/"
"$OMREPORTPATH"omreport storage vdisk | grep '^ID' | \
        while read LINE
                do
                        read -a VDISKIDALL <<<$LINE;
                        VDISKID="${VDISKIDALL[2]}";
                        VDISKIDSTATUS=`"$OMREPORTPATH"omreport storage vdisk | grep -1 "$VDISKID" grep -i "status" awk {'print $3'}`;
                        VDISKTYPE=`"$OMREPORTPATH"omreport storage vdisk | grep -6 "$VDISKID" grep -i "layout" awk {'print $3'}`; 
                        if [[ "$VDISKIDSTATUS" != "Ok" ]]
                                then
                                        TRIGGER="$VDISKID--$VDISKTYPE--$VDISKIDSTATUS";
                                        echo "$TRIGGER";
                        fi
                done;
}
 
function CheckStorage ()
{
OMREPORTPATH="/opt/dell/srvadmin/bin/"
"$OMREPORTPATH"omreport storage pdisk controller=0 | grep '^ID' | \
        while read LINE
                do
                        read -a PDISKIDALL <<<$LINE;
                        PDISKID="${PDISKIDALL[2]}";
                        PDISKIDSTATUS=`"$OMREPORTPATH"omreport storage pdisk controller=0 | grep -1 "$PDISKID" grep -i "status" awk {'print $3'}`;
                        if [[ "$PDISKIDSTATUS" != "Ok" ]]
                                then
                                        TRIGGER="$PDISKID--$PDISKIDSTATUS";
                                        echo "$TRIGGER";
                        fi
                done;
}
 
 
case "$1" in
        fans)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        intrusion)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        memory)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        supplies)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        management)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        processors)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        temperatures)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        voltages)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        hardware)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        batteries)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
        storage)
                TRIGGERVALUE=`CheckStorage`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                        TRIGGERVALUE="Ok";
                fi
                echo $TRIGGERVALUE;;
        raid)
                TRIGGERVALUE=`CheckRaidStatus`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                        TRIGGERVALUE="Ok";
                fi
                echo $TRIGGERVALUE;;
        *)
                TRIGGERVALUE=`CheckChassis $1`;
                if [ -z "$TRIGGERVALUE" ]
                        then
                                TRIGGERVALUE="UNKNOWN";
                fi
                echo "$TRIGGERVALUE";;
esac;


本文转自   tianshuai369   51CTO博客,原文链接:http://blog.51cto.com/kkkkkk/1711044
上一篇:CentOS 7.x中正确设置时间与时钟服务器同步


下一篇:Solidity智能合约编程漏洞及对策