-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_api
More file actions
executable file
·116 lines (100 loc) · 2.4 KB
/
check_api
File metadata and controls
executable file
·116 lines (100 loc) · 2.4 KB
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
#!/bin/bash
#echo $(curl -s localhost:5005/$1)
status=$(curl -s localhost:5005/$1)
if [[ $1 =~ (validator_status|bonding_status) ]]; then
if [ $status = true ]; then
echo OK
exit 0
elif [ $status = false ]; then
echo CRITICAL
exit 2
else
echo UNKNOWN
exit 3
fi
elif [[ $1 =~ (block_delay) ]]; then
if [ $status -eq 0 ]; then
echo N/A
exit 0
elif (( $(echo "$status < 2" | bc -l) )); then
echo $status seconds
exit 0
else
echo $status seconds
exit 1
fi
elif [[ $1 =~ (missed_block_height) ]]; then
if [ $status -eq 0 ]; then
echo N/A
exit 0
elif [ $status -gt 0 ]; then
echo $status
exit 1
elif [ $status -lt 0 ]; then
echo BLOCK_HEIGHT_NOT_INCREMENTING
exit 2
fi
elif [[ $1 =~ (oracle_status) ]]; then
if [[ $status =~ (OK) ]]; then
echo $status
exit 0
elif [[ $status =~ (MISSED|WARNING) ]]; then
echo $status
exit 1
elif [[ $status =~ (STUCK) ]]; then
echo $status
exit 2
fi
elif [[ $1 =~ (peggo) ]]; then
if (( $(echo "$status == -2" |bc -l) )); then
echo NO DATA
exit 2
elif (( $(echo "$status < 0.01" |bc -l) ));then
echo $status
exit 0
elif (( $(echo "$status >= 0.01" |bc -l) ));then
echo $status
exit 2
else
echo $status
exit 1
fi
elif [[ $1 =~ (yoda) ]]; then
if [[ $status =~ (Active) ]]; then
echo $status
exit 0
elif [[ $status =~ (Inactive) ]]; then
echo $status
exit 2
elif [[ $status =~ (No data) ]]; then
echo $status
exit 1
fi
elif [[ $1 =~ (slinky) ]]; then
if [[ $status =~ (OK) ]]; then
echo $status
exit 0
elif [[ $status =~ (LATE|OFFLINE) ]]; then
echo $status
exit 2
# elif [[ $status =~ (No data) ]]; then
# echo $status
# exit 1
fi
#UMEE VOTE MISSES RATIO
#elif [[ $1 =~ (peggo) ]]; then
#
# if (( $(echo "$status == -2" |bc -l) )); then
# echo NO DATA
# exit 2
# elif (( $(echo "$status < 0.01" |bc -l) ));then
# echo $status
# exit 0
# elif (( $(echo "$status >= 0.01" |bc -l) ));then
# echo $status
# exit 2
# else
# echo $status
# exit 1
# fi
fi