Add fd-limit-reached degraded condition for open-ldap service

Added a new degrade action result code (161) to degrade the open-ldap
service if FD limit is reached. Result code 160 indicates open FD is
approaching to the limit, it will reset the degraded state as well
as normal result code 0.

SM was not designed to raise service level warnings/alarms. A major
alarms will be raised by collectd when open-ldap open file descriptors
is approaching to the limit (above 95%), and a critical alarm will be
raised when the limit is reached (100%).
Ref collectd changes:
https://review.opendev.org/c/starlingx/monitoring/+/819137

Partial-bug: 1952126
Change-Id: I893c137ab81fcf01e949c9ca13cedcbe8fe5d86d
Signed-off-by: Bin Qian <bin.qian@windriver.com>
This commit is contained in:
Bin Qian 2021-11-15 10:53:23 -05:00
parent aa546e8705
commit 4d6a0534f9
4 changed files with 12 additions and 0 deletions

View File

@ -309,6 +309,7 @@ _sm_service_group_condition_mappings[SM_SERVICE_GROUP_CONDITION_MAX] =
{ SM_SERVICE_GROUP_CONDITION_RECOVERY_FAILURE, "recovery-failure" },
{ SM_SERVICE_GROUP_CONDITION_ACTION_FAILURE, "action-failure" },
{ SM_SERVICE_GROUP_CONDITION_FATAL_FAILURE, "fatal-failure" },
{ SM_SERVICE_GROUP_CONDITION_FD_LIMIT_REACHED, "FD-limit-reached" },
};
static SmValueStrMappingT
@ -414,6 +415,7 @@ _sm_service_condition_mappings[SM_SERVICE_CONDITION_MAX] =
{ SM_SERVICE_CONDITION_RECOVERY_FAILURE, "recovery-failure" },
{ SM_SERVICE_CONDITION_ACTION_FAILURE, "action-failure" },
{ SM_SERVICE_CONDITION_FATAL_FAILURE, "fatal-failure" },
{ SM_SERVICE_CONDITION_FD_LIMIT_REACHED, "FD-limit-reached" },
};
static SmValueStrMappingT

View File

@ -458,6 +458,7 @@ typedef enum
SM_SERVICE_GROUP_CONDITION_RECOVERY_FAILURE,
SM_SERVICE_GROUP_CONDITION_ACTION_FAILURE,
SM_SERVICE_GROUP_CONDITION_FATAL_FAILURE,
SM_SERVICE_GROUP_CONDITION_FD_LIMIT_REACHED,
SM_SERVICE_GROUP_CONDITION_MAX
} SmServiceGroupConditionT;
@ -565,6 +566,7 @@ typedef enum
// recovery-failure: recovery of the service has failed.
// action-failure: a service action has failed.
// fatal-failure: a fatal failure has occured.
// FD-limit-reached: limit of open FD has reached.
typedef enum
{
SM_SERVICE_CONDITION_NIL,
@ -578,6 +580,7 @@ typedef enum
SM_SERVICE_CONDITION_RECOVERY_FAILURE,
SM_SERVICE_CONDITION_ACTION_FAILURE,
SM_SERVICE_CONDITION_FATAL_FAILURE,
SM_SERVICE_CONDITION_FD_LIMIT_REACHED,
SM_SERVICE_CONDITION_MAX
} SmServiceConditionT;

View File

@ -628,6 +628,9 @@ INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('ocf-script','default','stop','5','s
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('ocf-script','default','demote','5','success','disabled','unknown','unknown');
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('ocf-script','Filesystem','stop','1','success','disabled','unknown','unknown');
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('ocf-script','Filesystem','stop','plugin-timeout','success','disabled','unknown','unknown');
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('lsb-script','openldap','status','0','success','enabled-active','','');
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('lsb-script','openldap','status','160','success','enabled-active','','');
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('lsb-script','openldap','status','161','success','enabled-active','degraded','FD-limit-reached');
CREATE TABLE SCHEMA_VERSION (ID INTEGER PRIMARY KEY AUTOINCREMENT, MAJOR INTEGER, MINOR INTEGER);
INSERT INTO "SCHEMA_VERSION" VALUES(2,0,0);
CREATE TABLE CONFIGURATION ( ID INTEGER PRIMARY KEY AUTOINCREMENT, "KEY" CHAR(32), "VALUE" CHAR(32) );

View File

@ -124,6 +124,10 @@ static void sm_service_group_audit_map_service_condition(
*condition = SM_SERVICE_GROUP_CONDITION_FATAL_FAILURE;
break;
case SM_SERVICE_CONDITION_FD_LIMIT_REACHED:
*condition = SM_SERVICE_GROUP_CONDITION_FD_LIMIT_REACHED;
break;
default:
*condition = SM_SERVICE_GROUP_CONDITION_UNKNOWN;
DPRINTFE( "Unknown service condition (%i) given.",