Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide detailed message in error log for troubleshooting #9466

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

masree
Copy link
Contributor

@masree masree commented Jul 2, 2021

Suppose the entered connection string in telegraf.conf is incorrect, the error logs in telegraf did not indicate the server/database that is having issues. Also it does not expose error, state and severity when certain queries fail in execution due to permission issue. This makes troubleshooting harder if a single VM is monitoring more than 1 database/server.
Current Behavior:

Error in plugin: script AzureSQLDBPerformanceCounters failed: Login error: mssql: Login failed for user 'telegraf'

Desired Behavior:

Error in plugin:Query AzureSQLDBResourceGovernance failed for server: "sample-server" and database: "sample-database" with Error: login error: mssql: Login failed for user 'telegraf'.

Error in plugin:Query AzureSQLDBResourceGovernance failed for server: "sample-server" and database: "sample-database" with Msg 262, Level 12, State 2, Line 4, Error: login error: mssql: Login failed for user 'telegraf'.

This PR includes extracts the serverName and DatabaseName from connection string, and exposes the error, severity and state from SQL driver and adds it to telegraf error log to make troubleshooting easier

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jul 2, 2021
plugins/inputs/sqlserver/sqlserver.go Outdated Show resolved Hide resolved
@masree masree changed the title Include serverName and databaseName in error log Provide detailed message in error log for troubleshooting Jul 7, 2021
Expose server name, database name, error, severity, state in log file. This will help in easier troubleshooting when
login has issues.
Based on error mesage from SSMS:
Msg 262, Level 14, State 1, Line 1
VIEW DATABASE PERFORMANCE STATE permission denied in database
'samepl-DB'.
Copy link
Contributor

@sspaink sspaink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pr! Looks like this should definitely help make the error messages clearer and easier to troubleshoot.

@sspaink sspaink added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jul 12, 2021
@MyaLongmire MyaLongmire merged commit 2267733 into influxdata:master Jul 13, 2021
reimda pushed a commit that referenced this pull request Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants