Added Kerberos support (depending on Authen::Krb5) #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It adds a dependency on Authen::Krb5, and if "--kerberos" is added, switches the driver from Sybase to ODBC so it can use the SQL native client, which actually has support for the trusted connection functionality.
The Kerberos authentication bit creates the credential cache that is to be used by the SQL client. (Which other modules such as Authen::Krb5::Simple do not create)
This is the code as we are using it in my organization. It has certainly room for some improvement (the driver string for the native client, or allowing use of keytabs), but I wanted to bring to attention that there was a need for such a feature.
It makes the script usable in this fashion :
$ /tmp/check_mssql_health --server .MYORG.REALM --username --password '...' --database <...> --kerberos MYORG.REALM --mode transactions
OK - Surveillance has 6.0221 transactions / sec | Surveillance_transactions_per_sec=6.0221;10000;50000