-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7 instance is down
60 lines (44 loc) · 1.56 KB
/
7 instance is down
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
#!/bin/bash
## need to run a cronjob for executing 'R3trans -d'
# Specify the path to the trans.log file
LOG_FILE="/sapmnt/TS1/profile/trans.log"
# Keyword to check for in the logs
KEYWORD="End of Transport (0000)"
# Function to check the log file for the keyword
check_logs() {
if [ ! -f "$LOG_FILE" ]; then
echo "ERROR: Log file '$LOG_FILE' does not exist"
exit 3 # 3 represents unknown status in Nagios plugins
fi
if grep -q "$KEYWORD" "$LOG_FILE"; then
echo "OK: Keyword '$KEYWORD' found in the trans.log file"
exit 0 # 0 represents OK status in Nagios plugins
else
echo "CRITICAL: Keyword '$KEYWORD' not found in the trans.log file"
exit 2 # 2 represents critical status in Nagios plugins
fi
}
# Main execution
check_logs
---------------------------------------------------------------------------------------------
#!/bin/bash
# Specify the path to the trans.log file
LOG_FILE="/sapmnt/TS1/profile/trans.log"
# Keyword to check for in the logs
KEYWORD="End of Transport (0000)"
# Function to check the log file for the keyword
check_logs() {
if [ ! -f "$LOG_FILE" ]; then
echo "CRITICAL: Log file '$LOG_FILE' does not exist"
exit 2 # Exit with critical status
fi
if grep -q "$KEYWORD" "$LOG_FILE"; then
echo "OK: Keyword '$KEYWORD' found in the trans.log file"
exit 0 # Exit with OK status
else
echo "CRITICAL: Keyword '$KEYWORD' not found in the trans.log file"
exit 2 # Exit with critical status
fi
}
# Main execution
check_logs