MINOR: checks: Add function to get the result code corresponding to a status
The function get_check_status_result() can now be used to get the result code (CHK_RES_*) corresponding to a check status (HCHK_STATUS_*). It will be used by the Prometheus exporter when reporting the check status of a server.
This commit is contained in:
parent
ff97edac3e
commit
7aa3271439
@ -29,6 +29,7 @@
|
||||
extern struct data_cb check_conn_cb;
|
||||
extern struct proxy checks_fe;
|
||||
|
||||
short get_check_status_result(short check_status);
|
||||
const char *get_check_status_description(short check_status);
|
||||
const char *get_check_status_info(short check_status);
|
||||
int httpchk_build_status_header(struct server *s, struct buffer *buf);
|
||||
|
@ -152,6 +152,15 @@ static inline int unclean_errno(int err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Converts check_status code to result code */
|
||||
short get_check_status_result(short check_status)
|
||||
{
|
||||
if (check_status < HCHK_STATUS_SIZE)
|
||||
return check_statuses[check_status].result;
|
||||
else
|
||||
return check_statuses[HCHK_STATUS_UNKNOWN].result;
|
||||
}
|
||||
|
||||
/* Converts check_status code to description */
|
||||
const char *get_check_status_description(short check_status) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user