Closed menardorama closed 7 years ago
More information, the issue seems to occur on history_uint for now.
I've tried the sql query on a psql and it's working fine.
Do you have any ideas ?
Hi, it is strange because the table history_uint has not any nullable column. Could you please double check the table definition ?
Hi That's correct the history_uint table have not null on all fields.
By the way, my setup is using history and trend partionning using partition inheritance but it shouldn't have any effect (it worked for trend).
Any chance to put more debug option ?
Hi,
If you can find in this output why the history_uint is failing.... result.gz
Hi,
Do you have any idea why it's failing ?
I tried to find a reason, but the data structure seems good to me....
By googling the error message I got, I can find some related issues but referencing the mysql or sqllite driver.
By the way I encounter this issue with history_uint and trend_uint not the others.
But executing the history_uint manually give me some results
Ok I made some progress on my issue.
The issue is not related to the table structure at all.
In fact from what I see if I put a limit to 10000 records data is correctly transfered in influxdb.
Digging around the data itself made me focus on the item name formatting in the query.
First issue I see is when using $3 parameter in the item name, it's not being replaced example :
TCP count SRC 636 $3 --> net.tcp.count[636,,ESTABLISHED]
Another issue but I don't know if it can have an impact is all the "various" characters such as :
I don't know yet where to find the $3 value in the db but I'm afraid the query will be bigger and bigger and cpu consuming on the db.
What do you think ?
Ok for the table definition.
As shown in the log, the program stops here: if err := rows.Scan(&result); err != nil { return err } The issue comes from the rows.Scan operation. You can add a counter inside the loop to identify the row that seems to be NULL...
I will check how to replace the $3 value.
Hi,
Ok I've found the issue, in the output I get some blank lines which make the fetch failing.
I think by security it would be best to skip those lines.
I have fixed the issue by modifying the Scan if statement like the following (quick and dirty I know...)
for rows.Next() {
var result string
if err := rows.Scan(&result); err != nil {
counter += 1
// blank line skipping
} else {
resultTmp = append(resultTmp, result)
}
}
and for the sql query with missing $3 arguments I've done the following :
WHEN (position('$3' in ite.name) > 0)
THEN replace(ite.name, '$3', split_part(substring(ite.key_ FROM '\[(.+)\]'), ',', 3))
WHEN (position('$1' in ite.name) > 0) AND (position('$3' in ite.name) > 0)
THEN replace(replace(ite.name, '$1', split_part(substring(ite.key_ FROM '\[(.+)\]'), ',', 1)), '$3', split_part(substring(ite.key_ FROM '\[(.+)\]'), ',', 3))
If you are ok I can push a pull request for that (even if I don't like the if statement
And the real issue is that your query is based on the fact that all items belong to an application.
Which is not mandatory in zabbix.
The real fix would be to have a more tolerant sql query
I will bring the modification this week.
solved
Hi
I don't really know why but at the first load I get this error.