ptarmiganlabs / butler-sos

Butler SenseOps Stats ("Butler-SOS") is a microservice publishing operational Qlik Sense metrics to InfluxDB, Prometheus and New Relic. Add Grafana for great looking dashboards and you get real-time monitoring of what happens inside a Qlik Sense environment.
https://butler-sos.ptarmiganlabs.com
MIT License
27 stars 13 forks source link

Error when log db result contains info on server not defined in config file #49

Closed mountaindude closed 5 years ago

mountaindude commented 5 years ago

When the query to logdb returns data about a server which is (for some reason) not defined in the config YAML file, an error will occur:

butler-sos | 2019-04-04T15:44:35.700Z error: Log db query error: TypeError: Cannot read property 'hasOwnProperty' of undefined butler-sos | at /nodeapp/butler-sos.js:450:32 butler-sos | at Array.forEach () butler-sos | at pgClient.query.then.res (/nodeapp/butler-sos.js:410:18) butler-sos | at butler-sos | at process._tickDomainCallback (internal/process/next_tick.js:229:7)

Solution: No data should be written to Influxdb for servers that are not defined in YAML config file.

mnirck commented 5 years ago

I have the same issue, but I do not see any other hosts in my PostGreSQL database that are not configured in my YAML config file. In my case the table 'log_entry' is not been created in my influxdb, this is where Grafana queries the info for 'warnings' & 'error' messages. The QLogs in the PostGreSQL is been populated in the 'log_entries' table.

mountaindude commented 5 years ago

Acknowledged, this is a corner case bug.

If you indeed get the error above, there are a couple of things you can do to work around it:

  1. Define ALL servers in your Sense environment in the config YAML file (i.e. in the servers section there should be one host entry for each server)

  2. Disable querying of log db all together by setting enableLogDb=false. To be honest, I have not tried this one myself, but it should work.... On the flip side, you will not get any warnings or errors forwarded to Influxdb, and thus no warnings or errors in Grafana...

The error occurs when the query to logdb returns warnings/errors/info log messages for server(s) that are not defined in the servers section in the YAML config file.

mountaindude commented 5 years ago

Fixed by b265ac5946c64da3cfb37216282b2f9b8bda0c4a