~ubuntu-branches/ubuntu/trusty/keepalived/trusty

« back to all changes in this revision

Viewing changes to keepalived/check/check_api.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-05-12 20:26:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090512202615-k850bw35qpuvpq4p
Tags: 1.1.17-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/rules: DEB_UPDATE_RCD_PARAMS := expicit init start/stop
    parameters (don't stop at 0 and 6)
  - debian/init.d: init script header adapted to stop rule
  - debian/keepalived.postinst: Remove shutdown and reboot links

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Part:        Checkers registration.
7
7
 *
8
 
 * Version:     $Id: check_api.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
 
8
 * Version:     $Id: check_api.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
9
9
 *
10
10
 * Author:      Alexandre Cassen, <acassen@linux-vs.org>
11
11
 *
19
19
 *              as published by the Free Software Foundation; either version
20
20
 *              2 of the License, or (at your option) any later version.
21
21
 *
22
 
 * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
 
22
 * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
23
23
 */
24
24
 
25
25
#include <dirent.h>
29
29
#include "parser.h"
30
30
#include "memory.h"
31
31
#include "utils.h"
 
32
#include "logger.h"
32
33
#include "global_data.h"
33
34
#include "check_misc.h"
34
35
#include "check_smtp.h"
53
54
dump_checker(void *data_obj)
54
55
{
55
56
        checker *checker_obj = data_obj;
56
 
        syslog(LOG_INFO, " %s:%d", inet_ntop2(CHECKER_RIP(checker_obj))
 
57
        log_message(LOG_INFO, " %s:%d", inet_ntop2(CHECKER_RIP(checker_obj))
57
58
               , ntohs(CHECKER_RPORT(checker_obj)));
58
59
        (*checker_obj->dump_func) (checker_obj);
59
60
}
82
83
 
83
84
        /* queue the checker */
84
85
        list_add(checkers_queue, check_obj);
 
86
 
 
87
        /* In Alpha mode also mark the check as failed. */
 
88
        if (vs->alpha) {
 
89
                list fc = rs->failed_checkers;
 
90
                checker_id_t *id = (checker_id_t *) MALLOC(sizeof(checker_id_t));
 
91
                *id = check_obj->id;
 
92
                list_add (fc, id);
 
93
        }
85
94
}
86
95
 
87
96
/* dump the checkers_queue */
89
98
dump_checkers_queue(void)
90
99
{
91
100
        if (!LIST_ISEMPTY(checkers_queue)) {
92
 
                syslog(LOG_INFO, "------< Health checkers >------");
 
101
                log_message(LOG_INFO, "------< Health checkers >------");
93
102
                dump_list(checkers_queue);
94
103
        }
95
104
}
119
128
 
120
129
        for (e = LIST_HEAD(checkers_queue); e; ELEMENT_NEXT(e)) {
121
130
                checker_obj = ELEMENT_DATA(e);
122
 
                syslog(LOG_INFO,
 
131
                log_message(LOG_INFO,
123
132
                       "Activating healtchecker for service [%s:%d]",
124
133
                       inet_ntop2(CHECKER_RIP(checker_obj)),
125
134
                       ntohs(CHECKER_RPORT(checker_obj)));
139
148
 
140
149
        /* Display netlink operation */
141
150
        if (debug & 32)
142
 
                syslog(LOG_INFO, "Netlink reflector reports IP %s %s",
 
151
                log_message(LOG_INFO, "Netlink reflector reports IP %s %s",
143
152
                       inet_ntop2(address), (enable) ? "added" : "removed");
144
153
 
145
154
        /* Processing Healthcheckers queue */
148
157
                        checker_obj = ELEMENT_DATA(e);
149
158
                        if (CHECKER_VIP(checker_obj) == address && CHECKER_HA_SUSPEND(checker_obj)) {
150
159
                                if (!CHECKER_ENABLED(checker_obj) && enable)
151
 
                                        syslog(LOG_INFO,
 
160
                                        log_message(LOG_INFO,
152
161
                                               "Activating healtchecker for service [%s:%d]",
153
162
                                               inet_ntop2(CHECKER_RIP(checker_obj)),
154
163
                                               ntohs(CHECKER_RPORT(checker_obj)));
155
164
                                if (CHECKER_ENABLED(checker_obj) && !enable)
156
 
                                        syslog(LOG_INFO,
 
165
                                        log_message(LOG_INFO,
157
166
                                               "Suspending healtchecker for service [%s:%d]",
158
167
                                               inet_ntop2(CHECKER_RIP(checker_obj)),
159
168
                                               ntohs(CHECKER_RPORT(checker_obj)));