continuent-monitors-nagios 0.0.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,95 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Simple Bash Script To Check Tungsten Services
4
- # Nagios Plugin For NRPE
5
- #
6
- # This script accepts two arguments, {{-r}} and {{-c}}. The {{-r}} argument
7
- # will tell the script to check that the replicator and manager services are
8
- # running. The {{-c}} argument will check the connector service, the
9
- # arguments may be given individually or together. If any service is not
10
- # running, the script will return a critical error.
11
- #
12
- OK_STATE=0
13
- WARNING_STATE=1
14
- CRITICAL_STATE=2
15
- THOME=`dirname $0`
16
-
17
- function display_help
18
- {
19
- echo "Usage: ./check_tungsten_latency [-r] [-c] [-h]"
20
- echo " -r Check the replicator and manager services"
21
- echo " -c Check the connector service"
22
- echo " -h Display this message"
23
- exit 0
24
- }
25
-
26
- services_checked=""
27
- services_checked_glue=""
28
- services_stopped=""
29
- services_stopped_glue=""
30
- stopped_count=0
31
-
32
- while getopts "rch" Option
33
- do
34
- case $Option in
35
- r )
36
- # Mark that the replicator and manager were checked
37
- services_checked="${services_checked}${services_checked_glue}Replicator, Manager"
38
- services_checked_glue=", "
39
-
40
- replicator_running=`${THOME}/../../tungsten-replicator/bin/replicator status | grep "PID" | wc -l`
41
- # Check the replicator status
42
- if [ $replicator_running -eq 0 ]; then
43
- services_stopped="${services_stopped}${services_stopped_glue}Replicator"
44
- services_stopped_glue=", "
45
- stopped_count=$(($stopped_count+1))
46
- fi
47
-
48
- manager_running=`${THOME}/../../tungsten-manager/bin/manager status | grep "PID" | wc -l`
49
- # Check the manager status
50
- if [ $manager_running -eq 0 ]; then
51
- services_stopped="${services_stopped}${services_stopped_glue}Manager"
52
- services_stopped_glue=", "
53
- stopped_count=$(($stopped_count+1))
54
- fi
55
- ;;
56
- c )
57
- # Mark that the connector was checked
58
- services_checked="${services_checked}${services_checked_glue}Connector"
59
- services_checked_glue=", "
60
-
61
- connector_running=`${THOME}/../../tungsten-connector/bin/connector status | grep "PID" | wc -l`
62
- # Check the connector status
63
- if [ $connector_running -eq 0 ]; then
64
- services_stopped="${services_stopped}${services_stopped_glue}Connector"
65
- services_stopped_glue=", "
66
- stopped_count=$(($stopped_count+1))
67
- fi
68
- ;;
69
- h )
70
- display_help
71
- ;;
72
- esac
73
- done
74
-
75
- # One of the services isn't running
76
- if [ $stopped_count -gt 0 ]
77
- then
78
- if [ $stopped_count -gt 1 ]; then
79
- echo "CRITICAL: $services_stopped are not running"
80
- else
81
- echo "CRITICAL: $services_stopped is not running"
82
- fi
83
-
84
- exit $CRITICAL_STATE
85
- fi
86
-
87
- # Ensure that something was checked
88
- if [[ $services_checked == "" ]]; then
89
- echo "CRITICAL: No services were checked"
90
- exit $CRITICAL_STATE
91
- fi
92
-
93
- # Everything is running
94
- echo "OK: All services (${services_checked}) are running"
95
- exit $OK_STATE