Module: check_mk
Branch: master
Commit: 40d69947837df6855e67415926f9cfee2e36cfee
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=40d69947837df6…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Mon Nov 28 09:40:14 2016 +0100
4106 mk_oracle.ps1: added Oracle wallet support to Windows plugin
The plugin for windows could be used with the Oracle wallet. The support is
limitted to all Instances except ASM. This function is only for
administrators who really knows how to use the wallet.
You have to add an entry with the name of the instance. Please check the
connection with SQLPlus before trying to use the plugin.
The plugin use the following connection:
sqlplus /@<ORACLE_SID>
You have to add a credential to the wallet with the ORACLE_SID as name for
the entry:
Example:
mkstore -wrl <Wallet Directory> createCredential „<ORACLE_SID>"
<Username> <Password>
The wallet is only used, when username is set to '/'. Password,
hostname and listener-port is ignored, because the tnsnames.ora is used.
Please read the doumentation from Oracle for using the wallet. The
sqlnet.ora must be configured for your environment and the wallet must be
created before adding some entries. You could use TNS_ADMIN in
mk_oracle.cfg.txt for pointing to the sqlnet configuration for the plugin.
---
.werks/4106 | 1 -
ChangeLog | 1 +
agents/windows/plugins/mk_oracle.ps1 | 23 +++++++++++++++++------
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/.werks/4106 b/.werks/4106
index 3534f67..4c67f5b 100644
--- a/.werks/4106
+++ b/.werks/4106
@@ -8,4 +8,3 @@ Class: feature
Now you are able to filter by host- resp. service-service-level
defined in global settings/notifications.
-
diff --git a/ChangeLog b/ChangeLog
index e6878e9..70b7b23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* 4094 apc_rackpdu_power: now detects all phases or banks connected to this pdu
NOTE: Please refer to the migration notes!
* 3993 Some minor performance improvements during config generation...
+ * 4106 mk_oracle.ps1: added Oracle wallet support to Windows plugin...
* 3987 FIX: Check_MK Agent Access: Windows agent reported incorrect only from value
* 3952 FIX: diskstat: fixed bug if multipath devices having an alias...
* 3939 FIX: f5_bigip_conns: readded performance data and graphs...
diff --git a/agents/windows/plugins/mk_oracle.ps1 b/agents/windows/plugins/mk_oracle.ps1
index bd212b9..0188ab1 100644
--- a/agents/windows/plugins/mk_oracle.ps1
+++ b/agents/windows/plugins/mk_oracle.ps1
@@ -123,7 +123,8 @@ Param(
)
# if debug=1 then output
if ($DEBUG -gt 0) {
- echo "DEBUG:${error_message}"
+ $MYTIME=Get-Date -Format o
+ echo "${MYTIME} DEBUG:${error_message}"
}
}
@@ -384,11 +385,17 @@ Param(
else {
$assysdbaconnect=""
}
- #$TNSALIAS="$the_host`:$the_port/$sqlsid"
$UPPER_SID=$sqlsid.toupper()
-
$TNSALIAS="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$the_host)(PORT=$the_port))(CONNECT_DATA=(SID=$UPPER_SID)))"
- # we presume we can use an EZconnect
-
$SQL_CONNECT="$the_user/$the_password@$TNSALIAS$assysdbaconnect"
+
+ # use oracle wallet if requested in cfg file
+ if ($the_user -like "/" ) {
+ $SQL_CONNECT="/@$UPPER_SID$assysdbaconnect"
+ }
+ else {
+
$TNSALIAS="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$the_host)(PORT=$the_port))(CONNECT_DATA=(SID=$UPPER_SID)))"
+ # we presume we can use an EZconnect
+
$SQL_CONNECT="$the_user/$the_password@$TNSALIAS$assysdbaconnect"
+ }
debug_echo "value of sql_connect in dbuser = $SQL_CONNECT"
} else {
debug_echo "DBUSER is not defined"
@@ -1269,7 +1276,7 @@ $list_inst=(get-service -Name "Oracle*Service*" -include
"OracleService*", "Orac
# the following line ensures that the output of the files generated by calling
# Oracle SQLplus through Powershell are not limited to 80 character width. The
# 80 character width limit is the default
-$Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size (512, 50)
+$Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size (512, 150)
# We have to set some value for the ORACLE_SID, although here a nonsense value
# This value is used when we want to simply list all the banners
@@ -1420,6 +1427,10 @@ if ($the_count -gt 0) {
}
}
}
+ # We need an line break after last output from sections
+ # otherwise the agent adds <<<local>>> as parameter to the last
line of plugin
+ echo ""
+
}
debug_echo "got to the end"