MonitoringCatalog¶
Interacts with sqlite3 db
- class DIRAC.FrameworkSystem.private.monitoring.MonitoringCatalog.MonitoringCatalog(dataPath)¶
Bases:
object
This class is used to perform all kinds queries to the sqlite3 database.
- __init__(dataPath)¶
Initialize monitoring catalog
- activitiesQuery(selDict, sortList, start, limit)¶
Gets all the sources and activities details in a joined format.
- Parameters
- Returns
S_OK with a tuple of the result list and fields list.
- createSchema()¶
Creates all the sql schema if it does not exist
- deleteActivity(sourceId, activityId)¶
Deletes an activity.
- Parameters
sourceId (string) – The source id.
activityId (string) – The activity id.
- Returns
S_OK with rrd filename / S_ERROR with a message.
- deleteView(viewId)¶
Deletes a view for a given id.
- Parameters
viewId (string) – The view id.
- findActivity(sourceId, acName)¶
Finds activity.
- Parameters
sourceId (string) – The source id.
acName (string) – name of the activity.
- Returns
A list containing all the activity information.
- getActivities(dbCond)¶
Gets activities given a db condition.
- Parameters
dbCond (dictionary) – The required database conditions.
- Returns
a list of activities.
- getFilename(sourceId, acName)¶
Gets rrd filename for an activity.
- Parameters
sourceId (string) – The source id.
acName (string) – name of the activity.
- Returns
The filename in a string.
- getLastUpdate(sourceId, acName)¶
Gets the lastUpdate timestamp for a particular activity using the source id.
- Parameters
sourceId (string) – The source id.
acName (string) – name of the activity.
- Returns
The last update time in string.
- getMatchingActivities(condDict)¶
Gets all activities matching the defined conditions.
- Parameters
condDict (dictionary.) – A dictionary containing the conditions.
- Returns
a list of matching activities.
- getSources(dbCond, fields=[])¶
Gets souces for a given db condition.
- Parameters
dbCond (dictionary) – The required database conditions.
fields (list) – A list of required fields.
- Returns
The list of results after the query is performed.
- getViewById(viewId)¶
Gets a view for a given id.
- Parameters
viewId (string) – The view id.
- Returns
A list of values.
- getViews(onlyStatic)¶
Gets views.
- Parameters
onlyStatic (bool) – Whether the views required are static or not.
- Returns
A list of values.
- queryField(field, definedFields)¶
Query the values of a field given a set of defined ones.
- Parameters
field (list) – The field required in a string.
definedFields – A set of defined fields.
- Returns
A list of values.
- registerActivity(sourceId, acName, acDict)¶
Register an activity.
- Parameters
sourceId (string) – The source id.
acName (string) – name of the activity.
acDict (dictionary) – The activity dictionary containing information about ‘category’, ‘description’, ‘bucketLength’, ‘type’, ‘unit’.
- Returns
a list of values.
- registerSource(sourceDict)¶
Registers an activity source.
- Parameters
sourceDict (dictionary) – the source dictionary.
- Returns
a list of values.
- registerView(viewName, viewData, varFields)¶
Registers a new view.
- Parameters
viewName (string) – Name of the view.
viewDescription (dictionary) – A dictionary containing the view description.
varFields (list) – A list of variable fields.
- Returns
S_OK / S_ERROR with the corresponding error message.
- setLastUpdate(sourceId, acName, lastUpdateTime)¶
Updates the lastUpdate timestamp for a particular activity using the source id.
- Parameters
sourceId (string) – The source id.
acName (string) – name of the activity.
lastUpdateTime (string) – The last update time in the proper format.
- Returns
the number of rows updated.