Tried to retrieve Alarm History from an ALARM via UI in a monasca-api vagrant@devstack env (built on MAC), this works fine from CLI for the same ALARM, see test details below error output.
Error: Could not retrieve alarm history for 806e6a30-b85d-4b5a-8f08-6cfb5f0c40ed
monasca-api.log file:
2017-01-03 22:55:49,613 ERROR [monasca_api.common.repositories.influxdb.metrics_repository][GreenThread-42] invalid operation: time and *influxql.StringLiteral are not compatible
2017-01-03 22:55:49,614 ERROR [monasca_api.v2.reference.resource][GreenThread-42] invalid operation: time and *influxql.StringLiteral are not compatible
2017-01-03 22:55:49,664 ERROR [monasca_api.common.repositories.influxdb.metrics_repository][GreenThread-38] invalid operation: time and *influxql.StringLiteral are not compatible
2017-01-03 22:55:49,665 ERROR [monasca_api.v2.reference.resource][GreenThread-38] invalid operation: time and *influxql.StringLiteral are not compatible
Test Details:
vagrant@devstack:/var/log/monasca/api$ monasca alarm-list
+--------------------------------------+--------------------------------------+-----------------------+---------------+---------------------+----------+-------+-----------------+------+-------------------------+----------------------+----------------------+
| id | alarm_definition_id | alarm_definition_name | metric_name | metric_dimensions | severity | state | lifecycle_state | link | state_updated_timestamp | updated_timestamp | created_timestamp |
+--------------------------------------+--------------------------------------+-----------------------+---------------+---------------------+----------+-------+-----------------+------+-------------------------+----------------------+----------------------+
| 806e6a30-b85d-4b5a-8f08-6cfb5f0c40ed | dfe91126-499e-4036-bc48-d2caa6903f70 | TEST | cpu.idle_perc | hostname: devstack | LOW | ALARM | None | None | 2017-01-03T22:42:54Z | 2017-01-03T22:42:54Z | 2017-01-03T22:42:53Z |
| | | | | service: monitoring | | | | | | | |
+--------------------------------------+--------------------------------------+-----------------------+---------------+---------------------+----------+-------+-----------------+------+-------------------------+----------------------+----------------------+
vagrant@devstack:/var/log/monasca/api$ monasca alarm-history 806e6a30-b85d-4b5a-8f08-6cfb5f0c40ed
+--------------------------------------+-----------+--------------+-----------------------------------------------------------------------------------------------+-------------+---------------+---------------------+--------------------------+
| alarm_id | new_state | old_state | reason | reason_data | metric_name | metric_dimensions | timestamp |
+--------------------------------------+-----------+--------------+-----------------------------------------------------------------------------------------------+-------------+---------------+---------------------+--------------------------+
| 806e6a30-b85d-4b5a-8f08-6cfb5f0c40ed | ALARM | UNDETERMINED | Thresholds were exceeded for the sub-alarms: max(cpu.idle_perc) > 0.0 with the values: [91.2] | {} | cpu.idle_perc | hostname: devstack | 2017-01-03T22:42:53.558Z |
| | | | | | | service: monitoring | |
+--------------------------------------+-----------+--------------+-----------------------------------------------------------------------------------------------+-------------+---------------+---------------------+--------------------------+
there appears to be a sql qiery syntax issue with influxdb in /monasca- api/monasca_ api/common/ repositories/ influxdb/ metrics_ repository. py:
def _build_ offset_ clause( self, offset):
if offset:
offset_ clause = " and time > '{}'".format( offset)
offset_ clause = ""
else:
return offset_clause
Removing the quote around the value of time offset fixed the issue in my devstack.
Will push for a fix if that makes sense. The question that I have -- is there a default offset value of zero? didn't see that in the UI>