skyline.panorama package¶
Submodules¶
skyline.panorama.agent module¶
skyline.panorama.panorama module¶
-
class
Panorama
(parent_pid)[source]¶ Bases:
threading.Thread
The Panorama class which controls the panorama thread and spawned processes.
-
mysql_select
(select_stmt)[source]¶ Select data from mysql database
Parameters: select_stmt (str) – the select string Returns: tuple Return type: tuple, boolean Example usage:
query = 'select id, test from test' result = self.mysql_select(query)
Example of the 0 indexed results tuple, which can hold multiple results:
>> print('results: %s' % str(results)) results: [(1, u'test1'), (2, u'test2')] >> print('results[0]: %s' % str(results[0])) results[0]: (1, u'test1')
Note
- If the MySQL query fails a boolean will be returned not a tuple
False
None
-
mysql_insert
(insert)[source]¶ Insert data into mysql table
Parameters: select (str) – the insert string Returns: int Return type: int or boolean Example usage:
query = 'insert into host (host) VALUES ('this_host')' result = self.mysql_insert(query)
Note
- If the MySQL query fails a boolean will be returned not a tuple
False
None
-
insert_new_metric
(metric_name)[source]¶ Insert a new metric into the metrics tables.
Parameters: metric_name (str) – metric name Returns: int or boolean
-
new_load_metric_vars
(metric_vars_file)[source]¶ Load the metric variables for a check from a metric check variables file
Parameters: metric_vars_file (str) – the path and filename to the metric variables files Returns: the metric_vars module object or False
Return type: list
-
update_slack_thread_ts
(i, base_name, metric_timestamp, slack_thread_ts, snab_id)[source]¶ Update an anomaly record with the slack_thread_ts.
Parameters: - i – python process id
- metric_check_file – full path to the metric check file
Returns: returns True
-
update_anomaly_end_timestamp
(i, anomaly_id, anomaly_end_timestamp)[source]¶ Update an anomaly record with the anomaly_end_timestamp.
Parameters: - self (object) – self
- i (object) – python process id
- anomaly_id (int) – the anomaly id
- anomaly_end_timestamp (int) – the anomaly end timestamp
Returns: boolean
Return type: boolean
-
update_alert_ts
(i, base_name, metric_timestamp, alerted_at)[source]¶ Update an anomaly record with the alert_ts.
Parameters: - i – python process id
- base_name – base name
- metric_timestamp – the anomaly timestamp
- alerted_at – the alert timestamp
Returns: returns True
-
determine_db_id
(table, key, value)[source]¶ Get the id of something from the database and create a new entry if it does not exist
Parameters: - table (str) – table name
- key (str) – key name
- value (str) – value name
Returns: int or boolean
-
update_snab
(i, snab_panorama_items)[source]¶ Update snab anomaly records.
Parameters: i – python process id Returns: returns True
-