diff options
Diffstat (limited to 'plugins/check_cluster.c')
-rw-r--r-- | plugins/check_cluster.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c index 703fff97..031f8334 100644 --- a/plugins/check_cluster.c +++ b/plugins/check_cluster.c | |||
@@ -59,8 +59,6 @@ int check_type=CHECK_SERVICES; | |||
59 | char *data_vals=NULL; | 59 | char *data_vals=NULL; |
60 | char *label=NULL; | 60 | char *label=NULL; |
61 | 61 | ||
62 | int verbose=0; | ||
63 | |||
64 | int process_arguments(int,char **); | 62 | int process_arguments(int,char **); |
65 | 63 | ||
66 | 64 | ||
@@ -71,12 +69,13 @@ int main(int argc, char **argv){ | |||
71 | int return_code=STATE_OK; | 69 | int return_code=STATE_OK; |
72 | thresholds *thresholds = NULL; | 70 | thresholds *thresholds = NULL; |
73 | 71 | ||
72 | np_set_mynames(argv[0], "CLUSTER"); | ||
74 | if(process_arguments(argc,argv)==ERROR) | 73 | if(process_arguments(argc,argv)==ERROR) |
75 | usage(_("Could not parse arguments")); | 74 | usage(_("Could not parse arguments")); |
76 | 75 | ||
77 | /* Initialize the thresholds */ | 76 | /* Initialize the thresholds */ |
78 | set_thresholds(&thresholds, warn_threshold, crit_threshold); | 77 | set_thresholds(&thresholds, warn_threshold, crit_threshold); |
79 | if(verbose) | 78 | if(np_get_verbosity()>0) |
80 | print_thresholds("check_cluster", thresholds); | 79 | print_thresholds("check_cluster", thresholds); |
81 | 80 | ||
82 | /* check the data values */ | 81 | /* check the data values */ |
@@ -121,21 +120,17 @@ int main(int argc, char **argv){ | |||
121 | 120 | ||
122 | 121 | ||
123 | /* return the status of the cluster */ | 122 | /* return the status of the cluster */ |
124 | if(check_type==CHECK_SERVICES){ | 123 | if(check_type==CHECK_SERVICES) |
125 | return_code=get_status(total_services_warning+total_services_unknown+total_services_critical, thresholds); | 124 | np_die(get_status(total_services_warning+total_services_unknown+total_services_critical, thresholds), |
126 | printf("CLUSTER %s: %s: %d ok, %d warning, %d unknown, %d critical\n", | 125 | "%s: %d ok, %d warning, %d unknown, %d critical\n", |
127 | state_text(return_code), (label==NULL)?"Service cluster":label, | 126 | (label==NULL)?"Service cluster":label, |
128 | total_services_ok,total_services_warning, | 127 | total_services_ok,total_services_warning, |
129 | total_services_unknown,total_services_critical); | 128 | total_services_unknown,total_services_critical); |
130 | } | 129 | else |
131 | else{ | 130 | np_die(get_status(total_services_warning+total_services_unknown+total_services_critical, thresholds), |
132 | return_code=get_status(total_hosts_down+total_hosts_unreachable, thresholds); | 131 | "%s: %d up, %d down, %d unreachable\n", |
133 | printf("CLUSTER %s: %s: %d up, %d down, %d unreachable\n", | 132 | (label==NULL)?"Host cluster":label, |
134 | state_text(return_code), (label==NULL)?"Host cluster":label, | ||
135 | total_hosts_up,total_hosts_down,total_hosts_unreachable); | 133 | total_hosts_up,total_hosts_down,total_hosts_unreachable); |
136 | } | ||
137 | |||
138 | return return_code; | ||
139 | } | 134 | } |
140 | 135 | ||
141 | 136 | ||
@@ -198,7 +193,7 @@ int process_arguments(int argc, char **argv){ | |||
198 | break; | 193 | break; |
199 | 194 | ||
200 | case 'v': /* verbose */ | 195 | case 'v': /* verbose */ |
201 | verbose++; | 196 | np_increase_verbosity(1); |
202 | break; | 197 | break; |
203 | 198 | ||
204 | case 'V': /* version */ | 199 | case 'V': /* version */ |