Troubleshooting
Problem
In Console -> Templates -> Alert Templates -> (edit) -> Data Source -> Data Type (SQL Query), long SQL query is not fully accepted in 'SQL Query' box.
Symptom
Attempted to use a long query to create an alert template.

After clicking on 'save', the query has been cut off at the end.

As a result, this query can not be used in alert template.
Cause
There is a character limit for SQL Query in table 'gridalarms_template_expressio
MariaDB [cacti]> desc gridalarms_template_expression;
+------------------+----------
| Field | Type | Null | Key | Default |Extra |
+------------------+----------
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| hash | varchar(32) | YES | MUL | | |
| name | varchar(255) | NO | | NULL | |
| description | varchar(255) | NO | | |
| ds_type | int(10) unsigned | YES | | 0 | |
| type | int(1) | NO | | NULL | |
| db_table | varchar(50) | NO | | |
| sql_query | varchar(1048) | YES | | NULL | |
| script_thold | varchar(255) | YES | | NULL | |
| script_data | varchar(255) | YES | | NULL | |
| script_data_type | int(10) unsigned | YES | | 0 | |
+------------------+----------
As default, the max length accept to 'sql_query' column was 1048. Modify this limit to larger number could fix the problem.
Resolving The Problem
Change sql_query to larger number by using following query:
alter table gridalarms_template_expression modify sql_query varchar(2048);
As a result, 'SQL Query' box is able to accept larger query which helps us create alert template.
Was this topic helpful?
Document Information
Modified date:
01 November 2018
UID
ibm10737057