Managing groups of monitoring objects
Groups of monitoring objects are designed to combine the objects of the monitoring system (modules and elements) in order to simplify the management of these objects.
Groups in the monitoring system have the following attributes:
- id - unique identifier of the group, it is set when creating a group in the system;
- state - the status of the group;
- name - the name of the group;
- descr - description of the group, explanations;
- elements - the list of the identifiers of the elements included in the group;
- modules - the list of identifiers of the modules included in the group;
- smask - notification status mask
- notifiers - list of notification elements;
In order to place an object in a group, you must add the object identifier to the corresponding list: the module identifier in the list of module identifiers, the element identifier in the list of identifiers of the element.
The group changes its state when the state of the objects included in it changes and can be part of the logic schemes. If all group objects are in the "normal" state, the group is also in the "normal" state. If at least one of the objects is in the "warning" state, the group is also in the "warning" state. If at least one of the objects is in the "alarm" state, the group is also in the "alarm" state.
The following functionality is available for groups:
- control access to monitoring system objects for the user profile;
- Notifications (creating notifications) on the status of objects in the group changes;
Controlling access to group objects
Permissions for accessing objects in a group are determined by the presence of the identifier of this group in the permission lists of user profile elements.
Lists of permission for groups of items in a user profile:
- gread - list of identifiers of groups available for reading;
- gwrite - list of identifiers of groups available for reading and writing;
In this case, all groups whose identifiers are specified in the gwrite field will also be available for reading, which is equivalent to having the identifiers of these groups in the gread field.
Notifications when the status of group objects changes
The group can monitor the status of the elements included in it, and generate notifications.
The choice of monitored element states is determined by the bitmask in the smask field.
- 1 - sending notifications when switching to this state;
- 0 - ignore this state (do nothing)
The bit number in the mask corresponds to the status number for the logic scheme.
The identifiers of the class elements of the notification, by means of which the notification is made, are placed in the list of notifiers.
When the state of an element in a group changes, an analysis of this state is done by mask. If the status is significant, a notification is made via each notification element in the list of notifiers.
Create a group
Creation of groups is possible only if the user has the following rights:
- groups or all in the server's access list for writing (the SWrite entry field in the SkyControlUsers table of the user database /mnt/jffs/etc/users.sqlite);
- all in the group access list to write (the GWrite field of the entry in the SkyControlUsers table of the user database /mnt/jffs/etc/users.sqlite);
The group creation request contains the following fields:
- querytype - request type: addgroup - group creation;
- k - the session identifier;
- id - unique identifier of the group;
- name - the name of the group;
- descr - description of the group, explanations;
- elements - the list of identifiers of the elements included in the group, the identifiers of the elements are separated by commas;
- modules - the list of identifiers of the modules included in the group, the module identifiers are separated by commas;
- smask - the status notification mask. Significant events are encoded by the state of the corresponding bit:
- (1<< 1) - "normal";
- (1<< 2) - "low alarm";
- (1<< 3) - "high warning";
- (1<< 4) - "high alarm" or "alarm";
- (1<< 5) - "on";
- (1<< 6) - "off";
- (1<< 7) - "not connected"
- (1<< 9) - "low warning"
- notifiers - list of identifiers of notification elements;
Delete group
Deletion of groups is possible only if the user has the following rights:
- groups or all in the server's access list for writing (the SWrite entry field in the SkyControlUsers table of the user database /mnt/jffs/etc/users.sqlite);
- all in the group access list to write (the GWrite field of the entry in the SkyControlUsers table of the user database /mnt/jffs/etc/users.sqlite);
The delete group request contains the following fields:
- querytype - request type: delgroup - delete a group;
- k - the session identifier;
- id - the unique identifier of the group.
Reading group
The group read request contains the following fields:
- querytype - request type: getgroup - read the contents of the group;
- k - the session identifier;
- id - the unique identifier of the group, in the absence of the identifier, a list of all groups available to this user is displayed.
An example of a response to a specific group request:
<group id="3001" name="Test" descr="Test" elements="101001,101002,101003,101004,101005,101006,101007,101008,101009,101010,101011,101012,101013,101014,101015,101016" modules="" state="alarm" smask="16" notifiers="602001" disabled="0" timeout="0"/>
Example of an answer to a list of groups:
<groups> <group id="3001" name="Test" descr="Test" elements="101001,101002,101003,101004,101005,101006,101007,101008,101009,101010,101011,101012,101013,101014,101015,101016" modules="" state="alarm" mask="16" notifiers="602001" disabled="1" timeout="610"/> <group id="3002" name="Test" descr="Test" elements="201001,201002" modules="" state="normal" smask="0" notifiers="" disabled="0" timeout="0" /> </groups>
disablegroup - disable the group notifications. Extra options are:
- k - user session ID;
- id - identifier of the group;
- timeout - time for which the notifications is disabled, if timeout is 0, then notifications are enabled immediately.
The answer to the getgroup querry has the following additional fields:
- disabled - time remaining to enable (unlock) the group notifications, 0 if notifications are enabled;
- timeout - time for which the notifications is disabled.