├── packages ├── System.ValueTuple.4.5.0 │ ├── lib │ │ ├── MonoTouch10 │ │ │ └── _._ │ │ ├── xamarinios10 │ │ │ └── _._ │ │ ├── xamarinmac20 │ │ │ └── _._ │ │ ├── MonoAndroid10 │ │ │ └── _._ │ │ ├── netcoreapp2.0 │ │ │ └── _._ │ │ ├── netstandard2.0 │ │ │ └── _._ │ │ ├── uap10.0.16299 │ │ │ └── _._ │ │ ├── xamarintvos10 │ │ │ └── _._ │ │ ├── xamarinwatchos10 │ │ │ └── _._ │ │ ├── net461 │ │ │ └── System.ValueTuple.dll │ │ ├── net47 │ │ │ ├── System.ValueTuple.dll │ │ │ └── System.ValueTuple.xml │ │ ├── netstandard1.0 │ │ │ └── System.ValueTuple.dll │ │ └── portable-net40+sl4+win8+wp8 │ │ │ └── System.ValueTuple.dll │ ├── ref │ │ ├── MonoTouch10 │ │ │ └── _._ │ │ ├── xamarinios10 │ │ │ └── _._ │ │ ├── xamarinmac20 │ │ │ └── _._ │ │ ├── MonoAndroid10 │ │ │ └── _._ │ │ ├── netcoreapp2.0 │ │ │ └── _._ │ │ ├── netstandard2.0 │ │ │ └── _._ │ │ ├── uap10.0.16299 │ │ │ └── _._ │ │ ├── xamarintvos10 │ │ │ └── _._ │ │ ├── xamarinwatchos10 │ │ │ └── _._ │ │ ├── net461 │ │ │ └── System.ValueTuple.dll │ │ ├── net47 │ │ │ └── System.ValueTuple.dll │ │ └── portable-net40+sl4+win8+wp8 │ │ │ └── System.ValueTuple.dll │ ├── useSharedDesignerContext.txt │ ├── version.txt │ ├── .signature.p7s │ ├── System.ValueTuple.4.5.0.nupkg │ └── LICENSE.TXT ├── System.Diagnostics.Process.4.3.0 │ ├── lib │ │ ├── MonoAndroid10 │ │ │ └── _._ │ │ ├── MonoTouch10 │ │ │ └── _._ │ │ ├── xamarinios10 │ │ │ └── _._ │ │ ├── xamarinmac20 │ │ │ └── _._ │ │ ├── xamarintvos10 │ │ │ └── _._ │ │ ├── xamarinwatchos10 │ │ │ └── _._ │ │ ├── net46 │ │ │ └── System.Diagnostics.Process.dll │ │ └── net461 │ │ │ └── System.Diagnostics.Process.dll │ ├── ref │ │ ├── MonoAndroid10 │ │ │ └── _._ │ │ ├── MonoTouch10 │ │ │ └── _._ │ │ ├── xamarinios10 │ │ │ └── _._ │ │ ├── xamarinmac20 │ │ │ └── _._ │ │ ├── xamarintvos10 │ │ │ └── _._ │ │ ├── xamarinwatchos10 │ │ │ └── _._ │ │ ├── net46 │ │ │ └── System.Diagnostics.Process.dll │ │ ├── net461 │ │ │ └── System.Diagnostics.Process.dll │ │ ├── netstandard1.3 │ │ │ └── System.Diagnostics.Process.dll │ │ └── netstandard1.4 │ │ │ └── System.Diagnostics.Process.dll │ ├── runtimes │ │ ├── win7 │ │ │ └── lib │ │ │ │ └── netcore50 │ │ │ │ └── _._ │ │ ├── win │ │ │ └── lib │ │ │ │ ├── net46 │ │ │ │ └── System.Diagnostics.Process.dll │ │ │ │ ├── net461 │ │ │ │ └── System.Diagnostics.Process.dll │ │ │ │ └── netstandard1.4 │ │ │ │ └── System.Diagnostics.Process.dll │ │ ├── linux │ │ │ └── lib │ │ │ │ └── netstandard1.4 │ │ │ │ └── System.Diagnostics.Process.dll │ │ └── osx │ │ │ └── lib │ │ │ └── netstandard1.4 │ │ │ └── System.Diagnostics.Process.dll │ ├── .signature.p7s │ ├── System.Diagnostics.Process.4.3.0.nupkg │ └── ThirdPartyNotices.txt └── Microsoft.Diagnostics.Runtime.1.0.2 │ ├── Microsoft.Diagnostics.Runtime.1.0.2.nupkg │ └── lib │ ├── net45 │ ├── Microsoft.Diagnostics.Runtime.dll │ └── Microsoft.Diagnostics.Runtime.pdb │ └── netstandard2.0 │ ├── Microsoft.Diagnostics.Runtime.dll │ └── Microsoft.Diagnostics.Runtime.pdb ├── OSDiagTool ├── procdump64.exe ├── ICSharpCode.SharpZipLib.dll ├── Platform │ ├── ConnectionList.cs │ ├── ConfigFiles │ │ ├── ConfigFileProperty.cs │ │ ├── XmlReader.cs │ │ ├── ConfigFileInfo.cs │ │ └── ConfigFileReader.cs │ ├── Integrity │ │ └── IntegrityModel.cs │ ├── LogExporter.cs │ ├── OSServiceConfigFileParser.cs │ ├── PlatformConnectionStringDefiner.cs │ ├── PlatformUtils.cs │ └── PlatformFilesHelper.cs ├── Database │ ├── DatabaseType.cs │ ├── DatabaseQueries │ │ ├── OracleQueries.cs │ │ └── DatabaseTroubleshoot.cs │ └── DatabaseExporter │ │ └── CSVExporter.cs ├── DBConnector │ ├── IDatabaseCommand.cs │ ├── ConnStringModel.cs │ ├── IDBConnector.cs │ ├── DBReader.cs │ └── SqlCommandExecutor.cs ├── README.txt ├── OSDiagToolForm │ ├── DataHelperClass.cs │ ├── OsDiagFormConfModel.cs │ ├── PopUpForm.cs │ ├── PopUpForm.Designer.cs │ └── PopUpForm.resx ├── OSDiagToolConf │ ├── OSDiagToolHelper.cs │ ├── ConfModel.cs │ └── MetamodelTables.cs ├── OSDiagTool.csproj.user ├── packages.config ├── CmdLineCommand.cs ├── App.config ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Helpers │ ├── CmdHelper.cs │ ├── IISHelper.cs │ ├── WindowsEventLogHelper.cs │ └── FileSystemHelper.cs ├── Utils │ ├── WinPerfCounters.cs │ ├── WinUtils.cs │ ├── CryptoUtils.cs │ └── NetworkUtils.cs ├── FileLogger.cs ├── OSDGTool.exe.config ├── RegistryClass.cs ├── app1.manifest ├── app.manifest ├── ThreadDumpCollector.cs ├── OSDGTCmdLine.cs ├── Oracle.DataAccess.Common.Configuration.Section.xsd ├── Tests │ └── Class1.cs └── DBConnection.cs ├── OSDiagToolUnitTests ├── Oracle.ManagedDataAccess.dll ├── Microsoft.Diagnostics.Runtime.dll ├── Properties │ └── AssemblyInfo.cs ├── App.config ├── packages.config └── app.manifest ├── LICENSE ├── OSDiagTool.sln └── .gitignore /packages/System.ValueTuple.4.5.0/lib/MonoTouch10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/xamarinios10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/xamarinmac20/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/MonoTouch10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/xamarinios10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/xamarinmac20/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/MonoAndroid10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/netcoreapp2.0/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/netstandard2.0/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/uap10.0.16299/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/xamarintvos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/xamarinwatchos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/MonoAndroid10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/netcoreapp2.0/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/netstandard2.0/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/uap10.0.16299/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/xamarintvos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/xamarinwatchos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/MonoAndroid10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/MonoTouch10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/xamarinios10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/xamarinmac20/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/xamarintvos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/MonoAndroid10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/MonoTouch10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/xamarinios10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/xamarinmac20/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/xamarintvos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/useSharedDesignerContext.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/xamarinwatchos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/xamarinwatchos10/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/win7/lib/netcore50/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/version.txt: -------------------------------------------------------------------------------- 1 | 30ab651fcb4354552bd4891619a0bdd81e0ebdbf 2 | -------------------------------------------------------------------------------- /OSDiagTool/procdump64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/OSDiagTool/procdump64.exe -------------------------------------------------------------------------------- /OSDiagTool/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/OSDiagTool/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /OSDiagToolUnitTests/Oracle.ManagedDataAccess.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/OSDiagToolUnitTests/Oracle.ManagedDataAccess.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/.signature.p7s -------------------------------------------------------------------------------- /OSDiagToolUnitTests/Microsoft.Diagnostics.Runtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/OSDiagToolUnitTests/Microsoft.Diagnostics.Runtime.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/.signature.p7s -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/System.ValueTuple.4.5.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/System.ValueTuple.4.5.0.nupkg -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/net461/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/lib/net461/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/net47/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/lib/net47/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/net461/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/ref/net461/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/net47/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/ref/net47/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/netstandard1.0/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/lib/netstandard1.0/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/System.Diagnostics.Process.4.3.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/System.Diagnostics.Process.4.3.0.nupkg -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/net46/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/lib/net46/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/lib/net461/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/lib/net461/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/net46/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/ref/net46/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/net461/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/ref/net461/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/net47/System.ValueTuple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.ValueTuple 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/Microsoft.Diagnostics.Runtime.1.0.2/Microsoft.Diagnostics.Runtime.1.0.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/Microsoft.Diagnostics.Runtime.1.0.2/Microsoft.Diagnostics.Runtime.1.0.2.nupkg -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/lib/portable-net40+sl4+win8+wp8/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/lib/portable-net40+sl4+win8+wp8/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/ref/portable-net40+sl4+win8+wp8/System.ValueTuple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.ValueTuple.4.5.0/ref/portable-net40+sl4+win8+wp8/System.ValueTuple.dll -------------------------------------------------------------------------------- /packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/net45/Microsoft.Diagnostics.Runtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/net45/Microsoft.Diagnostics.Runtime.dll -------------------------------------------------------------------------------- /packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/net45/Microsoft.Diagnostics.Runtime.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/net45/Microsoft.Diagnostics.Runtime.pdb -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/netstandard1.3/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/ref/netstandard1.3/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ref/netstandard1.4/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/ref/netstandard1.4/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/net46/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/net46/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/net461/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/net461/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/netstandard2.0/Microsoft.Diagnostics.Runtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/netstandard2.0/Microsoft.Diagnostics.Runtime.dll -------------------------------------------------------------------------------- /packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/netstandard2.0/Microsoft.Diagnostics.Runtime.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/Microsoft.Diagnostics.Runtime.1.0.2/lib/netstandard2.0/Microsoft.Diagnostics.Runtime.pdb -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/linux/lib/netstandard1.4/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/runtimes/linux/lib/netstandard1.4/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/osx/lib/netstandard1.4/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/runtimes/osx/lib/netstandard1.4/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OutSystems/techsupp-osdiagtool/HEAD/packages/System.Diagnostics.Process.4.3.0/runtimes/win/lib/netstandard1.4/System.Diagnostics.Process.dll -------------------------------------------------------------------------------- /OSDiagTool/Platform/ConnectionList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OSDiagTool.Platform 4 | { 5 | public class ConnectionList 6 | { 7 | public string Name { get; set; } 8 | public string Hostname { get; set; } 9 | public List Ports { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OSDiagTool/Database/DatabaseType.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace OSDiagTool.Database 3 | { 4 | public enum DatabaseType 5 | { 6 | Oracle, 7 | SqlServer 8 | } 9 | class DatabaseTypeClass 10 | { 11 | private DatabaseType dbEngine; 12 | 13 | public DatabaseType DbEngine 14 | { 15 | get { return dbEngine; } 16 | set 17 | { 18 | dbEngine = value; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /OSDiagTool/DBConnector/IDatabaseCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.SqlClient; 3 | using Oracle.ManagedDataAccess.Client; 4 | 5 | namespace OSDiagTool.DBConnector 6 | { 7 | public interface IDatabaseCommand 8 | { 9 | void Execute(string query, OSDiagToolConf.ConfModel.strConfModel configurations, SqlConnection sqlConnection = null, OracleConnection oracleConnection = null); 10 | IEnumerable ReadData(string query, OSDiagToolConf.ConfModel.strConfModel configurations, IDatabaseConnection connection, string oracleAdminSchema = null); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /OSDiagTool/README.txt: -------------------------------------------------------------------------------- 1 | 1 - This tool is owned by OutSystems Support; 2 | 2 - If you are reading this, you were probably asked by OutSystems Support to run this executable on the server and send the collected data; 3 | 3 - The tool does not write or modify any machine configurations. It will only read and export this information; 4 | 4 - To run the tool, execute the OSDiagTool.exe; 5 | 5 - Administrator permissions are necessary to run the tool; 6 | 6 - By running the executable, you are accepting the License agreement of Sysinternals Software [1]; 7 | 8 | [1] - https://docs.microsoft.com/en-us/sysinternals/license-terms -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolForm/DataHelperClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OSDiagTool.OSDiagToolForm { 8 | class DataHelperClass { 9 | 10 | public class strConfigurations { 11 | 12 | public OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel FormConfigurations { get; set; } 13 | 14 | public OSDiagToolConf.ConfModel.strConfModel ConfigFileConfigurations { get; set; } 15 | 16 | public puf_popUpForm popup { get; set; } 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolForm/OsDiagFormConfModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OSDiagTool.OSDiagToolForm { 4 | public class OsDiagFormConfModel { 5 | 6 | public class strFormConfigurationsModel { 7 | 8 | public Dictionary cbConfs { get; set; } 9 | 10 | public string saUser { get; set; } 11 | 12 | public string saPwd { get; set; } 13 | 14 | public int iisLogsNrDays { get; set; } 15 | 16 | public int osLogTopRecords { get; set; } 17 | 18 | public List metamodelTables { get; set; } 19 | 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolConf/OSDiagToolHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OSDiagTool.OSDiagToolConf { 8 | class OSDiagToolHelper { 9 | 10 | public static int CountSteps(Dictionary configurations) { 11 | 12 | int steps = 0; 13 | 14 | foreach (KeyValuePair conf in configurations) { 15 | 16 | if (conf.Value.Equals(true)) { 17 | steps++; 18 | } 19 | } 20 | 21 | return steps; 22 | 23 | } 24 | 25 | 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagTool.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | publish\ 9 | 10 | 11 | 12 | 13 | 14 | en-US 15 | false 16 | 17 | -------------------------------------------------------------------------------- /OSDiagToolUnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("OSDiagToolUnitTests")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("OSDiagToolUnitTests")] 10 | [assembly: AssemblyCopyright("Copyright © 2023")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("91220456-55f0-4e13-93fd-b041a2f2a838")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolConf/ConfModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OSDiagTool.OSDiagToolConf { 4 | public class ConfModel { 5 | 6 | public class strConfModel{ 7 | 8 | public bool useMultiThread { get; set; } 9 | public int queryTimeout { get; set; } 10 | public int IISLogsNrDays { get; set; } 11 | 12 | public int osLogTopRecords { get; set; } 13 | 14 | public List tableNames { get; set; } 15 | 16 | public Dictionary> osDiagToolConfigurations { get; set; } 17 | 18 | public Dictionary> databaseQueryConfigurations { get; set; } 19 | 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OSDiagTool/DBConnector/ConnStringModel.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace OSDiagTool.DBConnector 3 | { 4 | public class SQLConnStringModel 5 | { 6 | public string dataSource { get; set; } 7 | 8 | public string initialCatalog { get; set; } 9 | 10 | public string userId { get; set; } 11 | 12 | public string pwd { get; set; } 13 | 14 | public string advancedSettings { get; set; } 15 | 16 | } 17 | 18 | public class OracleConnStringModel 19 | { 20 | public string host { get; set; } 21 | 22 | public string port { get; set; } 23 | 24 | public string serviceName { get; set; } 25 | 26 | public string userId { get; set; } 27 | 28 | public string pwd { get; set; } 29 | 30 | public string advancedSettings { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /OSDiagTool/DBConnector/IDBConnector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.SqlClient; 3 | using Oracle.ManagedDataAccess.Client; 4 | 5 | namespace OSDiagTool 6 | { 7 | interface ISQLDBConnector 8 | { 9 | SqlConnection SQLOpenConnection(DBConnector.SQLConnStringModel SQLConnectionString); 10 | 11 | } 12 | 13 | interface IOracleDBConnector 14 | { 15 | OracleConnection OracleOpenConnection (DBConnector.OracleConnStringModel OracleConnectionString); 16 | } 17 | 18 | public interface IDatabaseConnection : IDisposable 19 | { 20 | void Connect(DBConnector.SQLConnStringModel SQLConnectionString = null, DBConnector.OracleConnStringModel OracleConnectionString = null); 21 | OracleConnection ReturnOracleConnection(); 22 | SqlConnection ReturnSQLConnection(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/ConfigFiles/ConfigFileProperty.cs: -------------------------------------------------------------------------------- 1 | using OSDiagTool.Utils; 2 | 3 | namespace OSDiagTool.Platform.ConfigFiles 4 | { 5 | public class ConfigFileProperty 6 | { 7 | private string _name; 8 | private string _value; 9 | private bool _isEncrypted; 10 | 11 | public ConfigFileProperty(string name, string value, bool isEncrypted) 12 | { 13 | _name = name; 14 | _value = value; 15 | _isEncrypted = isEncrypted; 16 | } 17 | 18 | public string Name 19 | { 20 | get {return _name;} 21 | } 22 | 23 | public string Value 24 | { 25 | get { return _value; } 26 | } 27 | 28 | public bool IsEncrypted 29 | { 30 | get { return _isEncrypted; } 31 | } 32 | 33 | public string GetDecryptedValue(string privateKey) 34 | { 35 | return IsEncrypted ? CryptoUtils.Decrypt(privateKey, Value) : Value; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/Integrity/IntegrityModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OSDiagTool.Platform.Integrity 8 | { 9 | public class IntegrityModel 10 | { 11 | public Dictionary CheckDetails { get; set; } 12 | 13 | // Default constructor 14 | public IntegrityModel() 15 | { 16 | CheckDetails = new Dictionary(); 17 | } 18 | 19 | //Copy constructor 20 | public IntegrityModel(IntegrityModel other) 21 | { 22 | CheckDetails = new Dictionary(other.CheckDetails); 23 | } 24 | } 25 | 26 | public class IntegrityDetails 27 | { 28 | public string SqlText { get; set; } 29 | public string ErrorMessage { get; set; } 30 | public bool returnsRecords { get; set; } 31 | public bool? checkOk { get; set; } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 OutSystems 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OSDiagTool/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /OSDiagTool/CmdLineCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace OSDiagTool 9 | { 10 | public class CmdLineCommand 11 | { 12 | private string _cmd; 13 | private string _outputFile; 14 | 15 | public CmdLineCommand(string cmd, string outputFile="") 16 | { 17 | _cmd = cmd; 18 | _outputFile = outputFile; 19 | } 20 | 21 | public void Execute(CountdownEvent cmdCountdown = null) 22 | { 23 | if (Program.useMultiThread) { cmdCountdown.AddCount(); } 24 | CmdHelper.RunCommand(FullCmd); 25 | if (Program.useMultiThread) { cmdCountdown.Signal(); } 26 | } 27 | 28 | public string FullCmd 29 | { 30 | get { return _cmd + (_outputFile != "" ? string.Format(" > \"{0}\"", _outputFile) : ""); } 31 | } 32 | 33 | public string OutputFile 34 | { 35 | get { return _outputFile; } 36 | set { _outputFile = value; } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/System.ValueTuple.4.5.0/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) .NET Foundation and Contributors 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /OSDiagTool/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/ConfigFiles/XmlReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Xml.Linq; 7 | 8 | namespace OSDiagTool.Platform.ConfigFiles 9 | { 10 | public class XmlReader 11 | { 12 | public static Dictionary ReadAppSettingsConnectiongStrings(string filePath, string[] connectiongStringNames) // , 13 | { 14 | Dictionary ConnectionStrings = new Dictionary(); 15 | 16 | try 17 | { 18 | XElement xmlElement = XElement.Load(filePath); 19 | 20 | foreach (string connection in connectiongStringNames) 21 | { 22 | string value = (from element in xmlElement.Elements("add") 23 | where (string)element.Attribute("key") == connection 24 | select (string)element.Attribute("value")).FirstOrDefault(); 25 | 26 | ConnectionStrings[connection] = value ?? "Connection not found"; 27 | } 28 | 29 | } catch (Exception e) 30 | { 31 | throw e; 32 | } 33 | 34 | return ConnectionStrings; 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolConf/MetamodelTables.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using System.Threading.Tasks; 7 | 8 | namespace OSDiagTool.OSDiagToolConf { 9 | class MetamodelTables { 10 | 11 | // Allowed prefixes 12 | private static string _ossysPrefix = "ossys"; 13 | private static string _osltmPrefix = "osltm"; 14 | 15 | List allowedPrefixes = new List { 16 | _ossysPrefix, 17 | _osltmPrefix, 18 | }; 19 | 20 | public bool ValidateMetamodelTableName(string tableName, List ExistentTables) { 21 | 22 | string item = ExistentTables.Where(x => x.Contains(tableName)).FirstOrDefault(); 23 | 24 | if(!(tableName.ToLower().Contains(" ")) && !(tableName.Equals(item))) { // Check for spaces and if already exists in the List box 25 | bool checkPrefixes = allowedPrefixes.Any(o => tableName.ToLower().StartsWith(o)); // check if tableName matches any of the allowed prefixes in the list 26 | if (checkPrefixes) { 27 | return true; 28 | } 29 | } 30 | return false; 31 | } 32 | 33 | public string TableNameEscapeCharacters(string tableName) { 34 | 35 | Regex pattern = new Regex("[ -*/()';]|[\n]{2}/g"); 36 | return pattern.Replace(tableName, ""); 37 | 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /OSDiagToolUnitTests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /OSDiagTool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OSDiagTool")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OSDiagTool")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7b232307-c985-45dc-83b6-4a421146be3d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OSDiagTool/Helpers/CmdHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Text; 4 | 5 | namespace OSDiagTool 6 | { 7 | public class CmdHelper 8 | { 9 | 10 | public CmdHelper() { } 11 | 12 | 13 | public static void RunCommand(string command, bool isHidden = true) 14 | { 15 | 16 | try { 17 | 18 | Process process = new Process(); 19 | ProcessStartInfo startInfo = new ProcessStartInfo(); 20 | 21 | if (isHidden) 22 | startInfo.WindowStyle = ProcessWindowStyle.Hidden; 23 | 24 | startInfo.FileName = "cmd.exe"; 25 | startInfo.Arguments = "/C " + command; 26 | startInfo.UseShellExecute = false; 27 | startInfo.RedirectStandardOutput = true; 28 | startInfo.StandardOutputEncoding = Encoding.UTF8; 29 | 30 | startInfo.WindowStyle = ProcessWindowStyle.Minimized; 31 | startInfo.CreateNoWindow = true; 32 | 33 | //FileLogger.TraceLog("Cmd: " + command); 34 | 35 | process.StartInfo = startInfo; 36 | 37 | process.Start(); 38 | //FileLogger.TraceLog(process.StandardOutput.ReadToEnd()); 39 | process.WaitForExit(); 40 | process.Close(); 41 | 42 | } catch (Exception e){ 43 | 44 | FileLogger.LogError("Error retrieving memory dumps. Cmd: " + command, e.Message + e.StackTrace); 45 | } 46 | 47 | 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/System.Diagnostics.Process.4.3.0/ThirdPartyNotices.txt: -------------------------------------------------------------------------------- 1 | This Microsoft .NET Library may incorporate components from the projects listed 2 | below. Microsoft licenses these components under the Microsoft .NET Library 3 | software license terms. The original copyright notices and the licenses under 4 | which Microsoft received such components are set forth below for informational 5 | purposes only. Microsoft reserves all rights not expressly granted herein, 6 | whether by implication, estoppel or otherwise. 7 | 8 | 1. .NET Core (https://github.com/dotnet/core/) 9 | 10 | .NET Core 11 | Copyright (c) .NET Foundation and Contributors 12 | 13 | The MIT License (MIT) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. -------------------------------------------------------------------------------- /OSDiagTool/Platform/ConfigFiles/ConfigFileInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OSDiagTool.Platform.ConfigFiles 8 | { 9 | public class ConfigFileInfo 10 | { 11 | private string _platformDBType; 12 | private string _dbms; 13 | private IDictionary _properties; 14 | 15 | public ConfigFileInfo(string platformDbType, string dbms) 16 | { 17 | _platformDBType = platformDbType; 18 | _dbms = dbms; 19 | 20 | _properties = new Dictionary(); 21 | } 22 | 23 | public string PlatformDBType 24 | { 25 | get { return _platformDBType; } 26 | } 27 | 28 | public string DBMS 29 | { 30 | get { return _dbms; } 31 | } 32 | 33 | public ConfigFileProperty GetProperty(string propertyName) 34 | { 35 | return _properties[propertyName]; 36 | } 37 | 38 | public ICollection GetPropertyNames() 39 | { 40 | return _properties.Keys; 41 | } 42 | 43 | public ICollection GetProperties() 44 | { 45 | return _properties.Values; 46 | } 47 | 48 | public void AddProperty(ConfigFileProperty property) 49 | { 50 | _properties.Add(property.Name, property); 51 | } 52 | 53 | public void AddProperties(ICollection properties) 54 | { 55 | foreach(ConfigFileProperty prop in properties) 56 | { 57 | AddProperty(prop); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /OSDiagToolUnitTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OSDiagTool/Helpers/IISHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Linq; 3 | using System.Linq; 4 | using System.IO; 5 | 6 | namespace OSDiagTool 7 | { 8 | class IISHelper 9 | { 10 | 11 | public static void GetIISAccessLogs(string iisapplicationHostPath, string tempFolderPath, FileSystemHelper fsHelper, int daysToFetch) { 12 | 13 | //Retrieving IIS access logs 14 | try { 15 | FileLogger.TraceLog("Retrieving IIS Access logs... "); 16 | 17 | // Loading Xml text from the file. Note: 32 bit processes will redirect \System32 to \SysWOW64: http://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm 18 | if (Environment.Is64BitOperatingSystem == false) { 19 | iisapplicationHostPath = iisapplicationHostPath.Replace("system32", "Sysnative"); 20 | } 21 | var xmlString = XDocument.Load(iisapplicationHostPath); 22 | 23 | // Querying the data and finding the Access logs path 24 | var query = from p in xmlString.Descendants("siteDefaults") 25 | select new { 26 | LogsFilePath = p.Element("logFile").Attribute("directory").Value, 27 | }; 28 | 29 | string iisAccessLogsPath = query.First().LogsFilePath.ToLower(); 30 | 31 | if (iisAccessLogsPath.Contains("%systemdrive%")) { 32 | iisAccessLogsPath = iisAccessLogsPath.Replace("%systemdrive%\\", Path.GetPathRoot(Environment.SystemDirectory)); 33 | if ((Environment.Is64BitOperatingSystem == false) && iisAccessLogsPath.Contains("system32")) { 34 | iisAccessLogsPath = iisAccessLogsPath.Replace("system32", "Sysnative"); 35 | } 36 | } 37 | 38 | //Copies all the contents from the path iisAcessLogsPath, including contents in subfolder 39 | fsHelper.DirectoryCopy(iisAccessLogsPath, Path.Combine(tempFolderPath, "IISLogs"), true, true, daysToFetch); 40 | 41 | } catch (Exception e) { 42 | FileLogger.LogError("Attempted to retrieve IIS Access logs but failed...", e.Message + e.StackTrace); 43 | } 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OSDiagTool/Utils/WinPerfCounters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace OSDiagTool { 5 | class WinPerfCounters { 6 | 7 | private static string _aspNetCategory = "ASP.NET"; 8 | private static string _iisQueueCounter = "Requests Queued"; 9 | 10 | public static float GetCPUUsage() { 11 | 12 | PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); 13 | return cpuCounter.NextValue(); 14 | 15 | } 16 | 17 | public static float GetIISQueue() { 18 | 19 | float iisQueue = 0; 20 | 21 | PerformanceCounter perfCounter = new PerformanceCounter(_aspNetCategory, _iisQueueCounter, true); 22 | 23 | using (perfCounter) { 24 | iisQueue = perfCounter.NextValue(); 25 | } 26 | 27 | return iisQueue; 28 | 29 | } 30 | 31 | public static bool IISQueueAlarm(float queueThreshold) { 32 | 33 | bool alarm = false; 34 | 35 | float iisQueue = WinPerfCounters.GetIISQueue(); 36 | 37 | if (iisQueue >= queueThreshold) { 38 | 39 | return alarm = true; 40 | 41 | } 42 | 43 | return alarm; 44 | 45 | } 46 | 47 | public static int GetParentProcess(int childProcessId) { 48 | 49 | var parentPrc = new PerformanceCounter("Process", "Creating Process ID", FindIndexedProcessName(childProcessId), true); 50 | Process pid = Process.GetProcessById((int)parentPrc.NextValue()); 51 | 52 | return Convert.ToInt32(pid.Id); 53 | 54 | } 55 | 56 | private static string FindIndexedProcessName(int pid) { 57 | var processName = Process.GetProcessById(pid).ProcessName; 58 | var processesByName = Process.GetProcessesByName(processName); 59 | string processIndexdName = null; 60 | 61 | for (var index = 0; index < processesByName.Length; index++) { 62 | processIndexdName = index == 0 ? processName : processName + "#" + index; 63 | var processId = new PerformanceCounter("Process", "ID Process", processIndexdName); 64 | if ((int)processId.NextValue() == pid) { 65 | return processIndexdName; 66 | } 67 | } 68 | 69 | return processIndexdName; 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /OSDiagTool/FileLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Threading; 4 | using System.Reflection; 5 | 6 | namespace OSDiagTool 7 | { 8 | public class FileLogger 9 | { 10 | private static string _tempFolderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "collect_data"); 11 | private static string _consoleLog = Path.Combine(_tempFolderPath, "ConsoleLog.txt"); 12 | static ReaderWriterLock rwl = new ReaderWriterLock(); 13 | 14 | public static void LogError(string customMessage, string errorMessage, bool writeToConsole = true, bool writeDateTime = true) 15 | { 16 | try 17 | { 18 | rwl.AcquireWriterLock(50); 19 | if (writeToConsole) { Console.WriteLine("[ERROR] " + customMessage + ": " + errorMessage); }; 20 | File.AppendAllText(_consoleLog, writeDateTime ? DateTime.Now + "\t" + "[ERROR] \t" + customMessage + " [" + Thread.CurrentThread.ManagedThreadId + "]" + "\t" + errorMessage + Environment.NewLine : 21 | "[" + Thread.CurrentThread.ManagedThreadId + "]" + "[ERROR] \t" + customMessage + "\t" + errorMessage + Environment.NewLine); 22 | } 23 | finally 24 | { 25 | rwl.ReleaseWriterLock(); 26 | } 27 | 28 | 29 | } 30 | 31 | public static void TraceLog(string traceMessage, bool isTaskFinished = false, bool writeDateTime = true) 32 | { 33 | try 34 | { 35 | rwl.AcquireWriterLock(100); 36 | if (isTaskFinished == false) 37 | { 38 | Console.Write(traceMessage); 39 | File.AppendAllText(_consoleLog, writeDateTime ? Environment.NewLine + DateTime.Now + " [" + Thread.CurrentThread.ManagedThreadId + "]" + "\t" + traceMessage : Environment.NewLine + "[" + Thread.CurrentThread.ManagedThreadId + "]" + traceMessage); 40 | } 41 | else if (isTaskFinished == true) 42 | { 43 | Console.WriteLine(traceMessage); 44 | File.AppendAllText(_consoleLog, traceMessage); 45 | } 46 | 47 | } finally 48 | { 49 | rwl.ReleaseWriterLock(); 50 | } 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /OSDiagTool.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29613.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSDiagTool", "OSDiagTool\OSDiagTool.csproj", "{7B232307-C985-45DC-83B6-4A421146BE3D}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSDiagToolUnitTests", "OSDiagToolUnitTests\OSDiagToolUnitTests.csproj", "{91220456-55F0-4E13-93FD-B041A2F2A838}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x64 = Debug|x64 14 | Release|Any CPU = Release|Any CPU 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Debug|x64.ActiveCfg = Debug|x64 21 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Debug|x64.Build.0 = Debug|x64 22 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Release|x64.ActiveCfg = Release|x64 25 | {7B232307-C985-45DC-83B6-4A421146BE3D}.Release|x64.Build.0 = Release|x64 26 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Debug|x64.ActiveCfg = Debug|Any CPU 29 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Debug|x64.Build.0 = Debug|Any CPU 30 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Release|x64.ActiveCfg = Release|Any CPU 33 | {91220456-55F0-4E13-93FD-B041A2F2A838}.Release|x64.Build.0 = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(ExtensibilityGlobals) = postSolution 39 | SolutionGuid = {C55B7585-86E5-4E63-9DB4-4C316567ADED} 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/LogExporter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using OSDiagTool.DatabaseExporter; 3 | using System.IO; 4 | using System.Data.SqlClient; 5 | using Oracle.ManagedDataAccess.Client; 6 | 7 | namespace OSDiagTool.Platform { 8 | class LogExporter { 9 | 10 | public static void PlatformLogExporter(Database.DatabaseType dbEngine, List tableNames, OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel FormConfigurations, string outputDestination, int queryTimeout, DBConnector.SQLConnStringModel SQLConnectionString = null, 11 | DBConnector.OracleConnStringModel OracleConnectionString = null, string adminSchema = null) { 12 | 13 | if (dbEngine.Equals(Database.DatabaseType.SqlServer)) { 14 | 15 | var connector = new DBConnector.SLQDBConnector(); 16 | SqlConnection connection = connector.SQLOpenConnection(SQLConnectionString); 17 | 18 | using (connection) { 19 | 20 | foreach (string table in tableNames) { 21 | 22 | string sqlQuery = "SELECT TOP {0} * FROM {1} ORDER BY INSTANT DESC"; 23 | sqlQuery = string.Format(sqlQuery, FormConfigurations.osLogTopRecords, table); 24 | 25 | FileLogger.TraceLog(string.Format("Exporting log table {0} ", table)); 26 | 27 | CSVExporter.SQLToCSVExport(dbEngine, table, Path.Combine(outputDestination), queryTimeout, sqlQuery, connection, null); 28 | 29 | } 30 | } 31 | 32 | } else if (dbEngine.Equals(Database.DatabaseType.Oracle)){ 33 | 34 | var connector = new DBConnector.OracleDBConnector(); 35 | OracleConnection connection = connector.OracleOpenConnection(OracleConnectionString); 36 | 37 | using (connection) { 38 | 39 | foreach (string table in tableNames) { 40 | 41 | string oracleQuery = "SELECT * FROM (SELECT * FROM {0}.{1} ORDER BY INSTANT DESC) WHERE ROWNUM < {2}"; 42 | oracleQuery = string.Format(oracleQuery, adminSchema, table, FormConfigurations.osLogTopRecords); 43 | 44 | FileLogger.TraceLog(string.Format("Exporting log table {0} ", table)); 45 | 46 | CSVExporter.SQLToCSVExport(dbEngine, table, outputDestination, queryTimeout, oracleQuery, null, connection); 47 | 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /OSDiagTool/Helpers/WindowsEventLogHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Collections.Generic; 5 | 6 | namespace OSDiagTool 7 | { 8 | public class WindowsEventLogHelper 9 | { 10 | protected string _pathToEventLogs = string.Format(@"{0}\winevt\logs", Environment.SystemDirectory); 11 | private IDictionary eventLogs; 12 | private List logNames; 13 | 14 | public WindowsEventLogHelper(bool loadEventsOnInit = true) 15 | { 16 | // can't read Security log :( 17 | //logNames = new List { "System", "Application", "Security" }; 18 | logNames = new List { "System", "Application"}; 19 | eventLogs = new Dictionary(); 20 | 21 | if (loadEventsOnInit) 22 | LoadEvents(); 23 | } 24 | 25 | protected void LoadEvents() 26 | { 27 | EventLog[] logs = EventLog.GetEventLogs(); 28 | 29 | foreach(EventLog log in logs) 30 | { 31 | if (logNames.Contains(log.Log)) 32 | { 33 | eventLogs.Add(log.Log, log); 34 | } 35 | } 36 | } 37 | 38 | public bool EventLogExists(string logName) 39 | { 40 | return EventLog.Exists(logName); 41 | } 42 | 43 | public string GetEventLogFilepath(string logName) 44 | { 45 | return Path.Combine(_pathToEventLogs, logName + ".evtx"); 46 | } 47 | 48 | public void GenerateLogFile(string logName, string targetLogFile, EventLogEntryType logLevel = EventLogEntryType.Information) 49 | { 50 | if (eventLogs.ContainsKey(logName)) 51 | { 52 | using (FileStream fs = File.Create(targetLogFile)) 53 | using (StreamWriter wfs = new StreamWriter(fs)) 54 | { 55 | foreach (EventLogEntry logEntry in eventLogs[logName].Entries) 56 | { 57 | if (logEntry.EntryType <= logLevel) 58 | { 59 | wfs.WriteLine(string.Format("{0} [{1}] {2}", logEntry.TimeGenerated.ToString(), logEntry.EntryType.ToString(), logEntry.Message)); 60 | } 61 | } 62 | } 63 | } 64 | } 65 | 66 | 67 | public void GenerateLogFiles(string targetFolder) 68 | { 69 | foreach(string logName in logNames) 70 | { 71 | string targetFile = Path.Combine(targetFolder, "EventViewerLog_" + logName + ".log"); 72 | GenerateLogFile(logName, targetFile); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /OSDiagTool/DBConnector/DBReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Data.SqlClient; 7 | using Oracle.ManagedDataAccess.Client; 8 | 9 | namespace OSDiagTool.DBConnector 10 | { 11 | class DBReader 12 | { 13 | // SQL Reader 14 | public static void SQLReader(DBConnector.SQLConnStringModel SQLConnectionString, string queryString) 15 | { 16 | var connector = new DBConnector.SLQDBConnector(); 17 | SqlConnection connection = connector.SQLOpenConnection(SQLConnectionString); 18 | 19 | using (connection) 20 | { 21 | SqlCommand command = new SqlCommand(queryString, connection); 22 | 23 | try 24 | { 25 | SqlDataReader reader = command.ExecuteReader(); 26 | while (reader.Read()) 27 | { 28 | // TODO: Implementation of query export to csv file in batches 29 | Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}", reader[0], reader[1], reader[2], reader[3], reader[4]); 30 | } 31 | reader.Close(); 32 | } 33 | catch (Exception e) 34 | { 35 | Console.WriteLine("Unable to read data from SQL DB: ", e); 36 | } 37 | finally 38 | { 39 | connector.SQLCloseConnection(connection); 40 | } 41 | } 42 | } 43 | 44 | 45 | // Oracle Reader 46 | public static void OracleReader(DBConnector.OracleConnStringModel OracleConnectionString, string queryString) 47 | { 48 | var connector = new DBConnector.OracleDBConnector(); 49 | 50 | OracleConnection connection = connector.OracleOpenConnection(OracleConnectionString); 51 | 52 | using (connection) 53 | { 54 | OracleCommand command = new OracleCommand(queryString, connection); 55 | 56 | try 57 | { 58 | OracleDataReader reader = command.ExecuteReader(); 59 | while (reader.Read()) 60 | { 61 | // TODO: Implementation of query export to csv file in batches 62 | Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}", reader[0], reader[1], reader[2], reader[3], reader[4]); 63 | } 64 | reader.Close(); 65 | } 66 | catch (Exception e) 67 | { 68 | Console.WriteLine("Unable to read data from Oracle DB: ", e); 69 | } 70 | finally 71 | { 72 | connector.OracleCloseConnection(connection); 73 | } 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /OSDiagTool/OSDGTool.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 30 6 | 7 | true 8 | true 9 | 10 | 11 | false 12 | false 13 | 14 | 15 | true 16 | true 17 | 18 | 19 | true 20 | true 21 | 22 | 23 | true 24 | true 25 | true 26 | 27 | 28 | 29 | 3 30 | 31 | 32 | 33 | 34 | 35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | 55 | 56 |
57 |
58 |
59 |
60 |
61 |
62 | 63 | 64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | 72 | 73 | 74 | 75 | 10 76 | 30 77 | 78 | 79 | 30 80 | 81 | 500 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /OSDiagTool/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OSDiagTool.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OSDiagTool.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /OSDiagTool/RegistryClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.Win32; 7 | using System.IO; 8 | 9 | namespace OSDiagTool 10 | { 11 | class RegistryClass 12 | { 13 | public RegistryClass() {} 14 | 15 | 16 | public static Microsoft.Win32.RegistryKey GetRegistryKey(string sKey) 17 | { 18 | return Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey); 19 | } 20 | 21 | public static Object GetRegistryValue(string sKey, string sValue) 22 | { 23 | Object obj = null; 24 | 25 | using (Microsoft.Win32.RegistryKey key = GetRegistryKey(sKey)) 26 | { 27 | if (key != null) 28 | { 29 | obj = key.GetValue(sValue); 30 | } 31 | } 32 | 33 | return obj; 34 | } 35 | 36 | // Use this function to copy the values of a registry path. Set the getSubKeys to true if you want all the values of subpaths 37 | public static void RegistryCopy(string registryPath, string destPath, bool getSubKeys, bool isRootCall = true) 38 | { 39 | if (isRootCall) 40 | { 41 | using (var txtFile = File.Create(destPath)); 42 | } 43 | 44 | RegistryKey key = Registry.LocalMachine.OpenSubKey(registryPath); 45 | 46 | string[] keyValueNames = key.GetValueNames(); 47 | 48 | // If the array is not null, keyValueNames and valueNames are written to a text file 49 | if (keyValueNames.Length != 0) 50 | { 51 | File.AppendAllText(destPath, Environment.NewLine + Environment.NewLine + registryPath); 52 | 53 | foreach (string keyValueName in keyValueNames) 54 | { 55 | File.AppendAllText(destPath, Environment.NewLine + "\t" + keyValueName + "\t" + key.GetValue(keyValueName).ToString()); 56 | } 57 | } 58 | 59 | if (getSubKeys) 60 | { 61 | string[] subkeys = key.GetSubKeyNames(); 62 | 63 | // If the array is not null, the full paths of the subkeys are appended to a list and 64 | // the function RegistryCopy calls itself recursively until it has reached the deepest subkey 65 | if (subkeys.Length != 0) 66 | { 67 | List subkeysFullPaths = new List(); 68 | 69 | // Add the full registry path of the subkey to the list 70 | foreach (string subkey in subkeys) 71 | { 72 | subkeysFullPaths.Add(Path.Combine(registryPath, subkey)); 73 | } 74 | 75 | // Cycles each subkey registry path and calls itself recursively 76 | foreach (string subkeyFullPath in subkeysFullPaths) 77 | { 78 | RegistryCopy(subkeyFullPath, destPath, true, false); 79 | } 80 | } 81 | } 82 | } 83 | 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /OSDiagTool/app1.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 59 | 60 | 61 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /OSDiagTool/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 59 | 60 | 61 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /OSDiagToolUnitTests/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 62 | 63 | 64 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolForm/PopUpForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace OSDiagTool.OSDiagToolForm { 12 | public partial class puf_popUpForm : Form { 13 | 14 | public static string _feedbackTestConnectionType = "testConnection"; 15 | public static string _feedbackWaitType = "wait"; 16 | public static string _feedbackDoneType = "done"; 17 | public static string _feedbackErrorType = "error"; 18 | public static bool isBackgroundWorkerCancelled = false; 19 | 20 | public puf_popUpForm(string feedbackType, string message, int totalSteps = 0) { 21 | InitializeComponent(); 22 | 23 | if (feedbackType.Equals(_feedbackWaitType)) { 24 | 25 | this.Text = "Collecting information. Please wait..."; 26 | lb_ProgressFeedback.Visible = true; 27 | lb_ProgressFeedback.Width = lb_ProgressFeedback.Width * 5 / 4; 28 | lb_ProgressFeedback.Height = lb_ProgressFeedback.Height * 4; 29 | this.Height = this.Height * 3 / 2; 30 | this.Width = this.Width * 5 / 4; 31 | 32 | bt_CloseFormPopUp.Visible = false; 33 | pb_progressBar.Style = ProgressBarStyle.Continuous; 34 | pb_progressBar.Width = pb_progressBar.Width * 5 / 4; 35 | pb_progressBar.Maximum = 100; 36 | pb_progressBar.Value = 0; 37 | pb_progressBar.Step = pb_progressBar.Maximum/totalSteps; 38 | pb_progressBar.PerformStep(); 39 | pb_progressBar.Visible = true; 40 | pb_progressBar.Location = new Point(pb_progressBar.Location.X, pb_progressBar.Location.Y * 5/2); 41 | 42 | bt_CancelOsDiagTool.Visible = true; 43 | bt_CancelOsDiagTool.Location = new Point(bt_CloseFormPopUp.Location.X * 3/2, bt_CloseFormPopUp.Location.Y*2); 44 | 45 | } else if (feedbackType.Equals(_feedbackDoneType)) { 46 | this.Width = this.Width * 3; 47 | bt_CloseFormPopUp.Location = new Point(bt_CloseFormPopUp.Location.X * 4, bt_CloseFormPopUp.Location.Y); 48 | this.lbl_message.Text = message; 49 | 50 | } else if (feedbackType.Equals(_feedbackErrorType)) { 51 | bt_CloseFormPopUp.Visible = true; 52 | bt_CloseFormPopUp.Text = "Exit"; 53 | this.lbl_message.Text = message; 54 | 55 | }else if (feedbackType.Equals(_feedbackTestConnectionType)) { 56 | this.lbl_message.Text = message; 57 | } 58 | 59 | } 60 | 61 | public void bt_CloseFormPopUp_Click(object sender, EventArgs e) { 62 | this.Dispose(); 63 | this.Close(); 64 | } 65 | 66 | public static void ChangeFeedbackLabelAndProgressBar (puf_popUpForm popUpForm, string labelText) { 67 | 68 | popUpForm.lb_ProgressFeedback.Items.Add(labelText); 69 | popUpForm.lb_ProgressFeedback.SelectedIndex = popUpForm.lb_ProgressFeedback.Items.Count - 1; 70 | popUpForm.lb_ProgressFeedback.SelectedIndex = -1; 71 | 72 | if (!(popUpForm.pb_progressBar.Value >= popUpForm.pb_progressBar.Maximum)) { 73 | popUpForm.pb_progressBar.PerformStep(); 74 | } 75 | 76 | popUpForm.Refresh(); 77 | 78 | } 79 | 80 | private void bt_CancelOsDiagTool_Click(object sender, EventArgs e) { 81 | 82 | isBackgroundWorkerCancelled = true; 83 | this.Text = "Cancelling. Please wait..."; 84 | 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /OSDiagTool/Database/DatabaseQueries/OracleQueries.cs: -------------------------------------------------------------------------------- 1 | namespace OSDiagTool.Database.DatabaseQueries { 2 | class OracleQueries { 3 | 4 | // Use string.format to append parameters // Sid is always the 1st column 5 | public string alterSession { get; set; } = @"ALTER SESSION SET CURRENT_SCHEMA = {0}"; // Schema 6 | 7 | public string lockedObjects { get; set; } = @"select session_id, object_id, oracle_username, os_user_name, process, locked_mode, xidsqn, xidslot, xidusn from v$locked_object"; 8 | 9 | public string lockedObjects_2 { get; set; } = @"select session_id ""sid"",SERIAL# ""Serial"", substr(object_name,1,20) ""Object"", substr(os_user_name,1,10) ""Terminal"", 10 | substr(oracle_username,1,10) ""Locker"", nvl(lockwait,'active') ""Wait"", 11 | decode(locked_mode, 2, 'row share', 3, 'row exclusive', 4, 'share', 5, 'share row exclusive', 6, 'exclusive', 'unknown') ""Lockmode"", OBJECT_TYPE ""Type"" 12 | FROM SYS.GV_$LOCKED_OBJECT A, SYS.ALL_OBJECTS B, SYS.GV_$SESSION c 13 | WHERE A.OBJECT_ID = B.OBJECT_ID AND C.SID = A.SESSION_ID"; 14 | 15 | public string sidInfo { get; set; } = @"SELECT * FROM V$SESSION s JOIN V$PROCESS p ON p.ADDR = s.PADDR WHERE s.SID IN ({0})"; // {0}: SID 16 | 17 | public string resourceLimit { get; set; } = @"SELECT * FROM V$RESOURCE_LIMIT"; 18 | 19 | public string sessionByIOType { get; set; } = @"select s.sid, s.process cli_process, s.status, t.{0}, s.action, s.program, lpad(t.sql_text,30) 20 | from v$session s, v$sqlarea t, v$process p 21 | where s.sql_address = t.address 22 | and s.sql_hash_value = t.hash_value 23 | and p.addr = s.paddr 24 | and rownum < 10 25 | order by t.{0} desc"; // {0}: DISK_READS for Read Throughput || DIRECT_WRITES for Write Throughput 26 | 27 | public string sqlTextBySID { get; set; } = @"select a.sid, a.serial#, a.program, b.sql_text 28 | from v$session a, v$sqltext b 29 | where a.sql_hash_value = b.hash_value 30 | and a.sid IN ({0}) 31 | order by a.sid,hash_value,piece"; // {0}: SID 32 | 33 | public string topCPUSqls { get; set; } = @"select * from (select sql_text, cpu_time/1000000 cpu_time,elapsed_time/1000000 elapsed_time, disk_reads, buffer_gets, rows_processed 34 | from v$sqlarea order by cpu_time desc, disk_reads desc) where rownum < {0}"; // {0}: Number of rows to fetch 35 | 36 | public string tk_queriesRunningNow { get; set; } = @" 37 | with q as ( 38 | select sql_id from( 39 | select q.sql_id,sum(disk_reads),sum(buffer_gets),sum(cpu_time),sum(elapsed_time) 40 | from v$sqlarea q, v$session s 41 | where s.sql_hash_value = q.hash_value 42 | and s.sql_address = q.address 43 | and s.username is not null 44 | and LAST_ACTIVE_TIME > sysdate - 60/24/60 -- Last Active Time > 60 minutes 45 | group by q.sql_id 46 | order by 5 desc,4 desc,2 desc,3 desc) 47 | where rownum<1000 48 | ) 49 | SELECT sql_id,lpad(plan_hash_value,15) plan_hash_value,sum(executions) executions, 50 | round(sum(rows_processed)/(sum(executions) + .0001),2) rows_prsd_per_exec, 51 | round(sum(disk_reads)/(sum(executions) + .0001),2) phyio_per_exec, 52 | round(sum(buffer_gets)/(sum(executions) + .0001),2) lio_per_exec, 53 | round(sum(cpu_time)/1000/(case when sum(executions) =0 then 1 else sum(executions) end),2) cpu_time_per_exec_milisecs, 54 | round(SUM(elapsed_time)/1000/(case when sum(executions) =0 then 1 else sum(executions) end),2) elap_time_per_exec_milisecs, 55 | sql_profile, parsing_schema_name,module,sql_text 56 | FROM gv$sql where sql_id in ( 57 | select sql_id from q 58 | ) 59 | group by sql_id,plan_hash_value,sql_profile,parsing_schema_name,module,sql_text 60 | order by 1,2"; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /OSDiagTool/Helpers/FileSystemHelper.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.SharpZipLib.GZip; 2 | using ICSharpCode.SharpZipLib.Tar; 3 | using ICSharpCode.SharpZipLib.Zip; 4 | using System.IO; 5 | using System; 6 | 7 | namespace OSDiagTool 8 | { 9 | public class FileSystemHelper 10 | { 11 | public FileSystemHelper() { } 12 | 13 | public void CreateTarGzFromDirectory(string sourceDirectory, string targetTarGzFilepath, bool isRecursive) 14 | { 15 | using (FileStream fs = new FileStream(targetTarGzFilepath, FileMode.Create, FileAccess.Write, FileShare.None)) 16 | using (Stream gzipStream = new GZipOutputStream(fs)) 17 | using (TarArchive tarArchive = TarArchive.CreateOutputTarArchive(gzipStream)) 18 | { 19 | AddDirectoryFilesToTar(tarArchive, sourceDirectory, isRecursive); 20 | } 21 | } 22 | 23 | protected void AddDirectoryFilesToTar(TarArchive tarArchive, string sourceDirectory, bool isRecursive) 24 | { 25 | // Recursively add sub-folders 26 | if (isRecursive) 27 | { 28 | string[] directories = Directory.GetDirectories(sourceDirectory); 29 | foreach (string directory in directories) 30 | AddDirectoryFilesToTar(tarArchive, directory, isRecursive); 31 | } 32 | 33 | // Add files 34 | string[] filenames = Directory.GetFiles(sourceDirectory); 35 | foreach (string filename in filenames) 36 | { 37 | TarEntry tarEntry = TarEntry.CreateEntryFromFile(filename); 38 | tarArchive.WriteEntry(tarEntry, true); 39 | } 40 | } 41 | 42 | public void CreateZipFromDirectory(string sourceDirectory, string targetZipFilepath, bool isRecursive) 43 | { 44 | FastZip zip = new FastZip(); 45 | zip.CreateEmptyDirectories = true; 46 | zip.CreateZip(targetZipFilepath, sourceDirectory, isRecursive, ""); 47 | } 48 | 49 | // Use this function to copy all the contents of a path. Set the copySubDirs to True if you want to copy as well all subfolders contents 50 | public void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs, bool isLimitedDays, int daysToFetch = 3) 51 | { 52 | DateTime dtNow = DateTime.Now; 53 | DateTime dtSubLastWrite = dtNow.AddDays(-daysToFetch); 54 | 55 | // Get the subdirectories for the specified directory. 56 | DirectoryInfo dir = new DirectoryInfo(sourceDirName); 57 | 58 | if (!dir.Exists) 59 | { 60 | throw new DirectoryNotFoundException( 61 | "Source directory does not exist or could not be found: " 62 | + sourceDirName); 63 | } 64 | 65 | DirectoryInfo[] dirs = dir.GetDirectories(); 66 | // If the destination directory doesn't exist, create it. 67 | if (!Directory.Exists(destDirName)) 68 | { 69 | Directory.CreateDirectory(destDirName); 70 | } 71 | 72 | // Get the files in the directory and copy them to the new location. 73 | FileInfo[] files = dir.GetFiles(); 74 | foreach (FileInfo file in files) 75 | { 76 | if (isLimitedDays) { 77 | if (file.LastWriteTime > dtSubLastWrite) { 78 | string temppath = Path.Combine(destDirName, file.Name); 79 | file.CopyTo(temppath, false); 80 | } 81 | } else { 82 | string temppath = Path.Combine(destDirName, file.Name); 83 | file.CopyTo(temppath, false); 84 | } 85 | 86 | } 87 | 88 | // If copying subdirectories, copy them and their contents to new location. 89 | if (copySubDirs) 90 | { 91 | foreach (DirectoryInfo subdir in dirs) 92 | { 93 | string temppath = Path.Combine(destDirName, subdir.Name); 94 | DirectoryCopy(subdir.FullName, temppath, copySubDirs, isLimitedDays, daysToFetch); 95 | } 96 | } 97 | } 98 | 99 | public string GetPathWithWindowsRoot (string path) { 100 | 101 | path = path.ToLower(); 102 | 103 | if (path.Contains("%systemdrive%")) { 104 | return path.Replace("%systemdrive%\\", Path.GetPathRoot(Environment.SystemDirectory)); 105 | } 106 | 107 | return path; 108 | 109 | } 110 | } 111 | } 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /OSDiagTool/Utils/WinUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Runtime.InteropServices; 6 | using System.ServiceProcess; 7 | 8 | namespace OSDiagTool.Utils { 9 | class WinUtils { 10 | 11 | [Flags] 12 | public enum ThreadAccess : int { 13 | TERMINATE = (0x0001), 14 | SUSPEND_RESUME = (0x0002), 15 | GET_CONTEXT = (0x0008), 16 | SET_CONTEXT = (0x0010), 17 | SET_INFORMATION = (0x0020), 18 | QUERY_INFORMATION = (0x0040), 19 | SET_THREAD_TOKEN = (0x0080), 20 | IMPERSONATE = (0x0100), 21 | DIRECT_IMPERSONATION = (0x0200) 22 | } 23 | 24 | [DllImport("kernel32.dll")] 25 | static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId); 26 | [DllImport("kernel32.dll")] 27 | static extern uint SuspendThread(IntPtr hThread); 28 | [DllImport("kernel32.dll")] 29 | static extern int ResumeThread(IntPtr hThread); 30 | [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] 31 | static extern bool CloseHandle(IntPtr handle); 32 | 33 | 34 | public static void SuspendProcess(int pid) { 35 | var process = Process.GetProcessById(pid); // throws exception if process does not exist 36 | 37 | foreach (ProcessThread pT in process.Threads) { 38 | IntPtr pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id); 39 | 40 | if (pOpenThread == IntPtr.Zero) { 41 | continue; 42 | } 43 | 44 | SuspendThread(pOpenThread); 45 | 46 | CloseHandle(pOpenThread); 47 | } 48 | } 49 | 50 | public static void ResumeProcess(int pid) { 51 | var process = Process.GetProcessById(pid); 52 | 53 | if (process.ProcessName == string.Empty) 54 | return; 55 | 56 | foreach (ProcessThread pT in process.Threads) { 57 | IntPtr pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id); 58 | 59 | if (pOpenThread == IntPtr.Zero) { 60 | continue; 61 | } 62 | 63 | var suspendCount = 0; 64 | do { 65 | suspendCount = ResumeThread(pOpenThread); 66 | } while (suspendCount > 0); 67 | 68 | CloseHandle(pOpenThread); 69 | } 70 | } 71 | 72 | public static void WriteToFile(string filePath, string message) { 73 | 74 | if (!File.Exists(filePath)) { 75 | using (File.Create(filePath)); 76 | } 77 | 78 | File.AppendAllText(filePath, message + Environment.NewLine); 79 | 80 | } 81 | 82 | // Retrieves the current status of a windows service 83 | public static string ServiceStatus(string serviceName) { 84 | ServiceController sc; 85 | try 86 | { 87 | sc = new ServiceController(serviceName); 88 | } 89 | catch (ArgumentException) 90 | { 91 | return "Invalid service name."; // Note that just because a name is valid does not mean the service exists. 92 | } 93 | 94 | using (sc) 95 | { 96 | ServiceControllerStatus status; 97 | try 98 | { 99 | sc.Refresh(); // calling sc.Refresh() is unnecessary on the first use of `Status` but if you keep the ServiceController in-memory then be sure to call this if you're using it periodically. 100 | status = sc.Status; 101 | } 102 | catch (Win32Exception ex) 103 | { 104 | // A Win32Exception will be raised if the service-name does not exist or the running process has insufficient permissions to query service status. 105 | return "Error: " + ex.Message; 106 | } 107 | 108 | switch (status) 109 | { 110 | case ServiceControllerStatus.Running: 111 | return "Running"; 112 | case ServiceControllerStatus.Stopped: 113 | return "Stopped"; 114 | case ServiceControllerStatus.Paused: 115 | return "Paused"; 116 | case ServiceControllerStatus.StopPending: 117 | return "Stopping"; 118 | case ServiceControllerStatus.StartPending: 119 | return "Starting"; 120 | default: 121 | return "Changing status"; 122 | } 123 | } 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/OSServiceConfigFileParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Linq; 3 | 4 | namespace OSDiagTool 5 | { 6 | class OSServiceConfigFileParser 7 | { 8 | private string _serviceName; 9 | private string _filepath; 10 | private bool _isFileLoaded; 11 | 12 | private int _logLevel; 13 | private string _logFilePath; 14 | private string _logServerFilePath; 15 | 16 | // if needed, we can fetch more info, but this should be enough for now 17 | 18 | public OSServiceConfigFileParser(string serviceName, string filepath) 19 | { 20 | _serviceName = serviceName; 21 | _filepath = filepath; 22 | _isFileLoaded = false; 23 | } 24 | 25 | public OSServiceConfigFileParser(string serviceName, string filepath, bool forceLoad) : this(serviceName, filepath) 26 | { 27 | if (forceLoad) { 28 | LoadConfFileInfo(); 29 | } 30 | 31 | } 32 | 33 | public string LogServerAPIAndIdentityFilePath { 34 | get { 35 | // lazy load 36 | if (!_isFileLoaded) 37 | LoadServerAPIAndIdentityLogPath(_filepath); 38 | 39 | return _logServerFilePath; 40 | } 41 | } 42 | 43 | public string LogFilePath 44 | { 45 | get 46 | { 47 | // lazy load 48 | if (!_isFileLoaded) 49 | LoadConfFileInfo(); 50 | 51 | return _logFilePath; 52 | } 53 | } 54 | 55 | public int LogLevel 56 | { 57 | get 58 | { 59 | // lazy load 60 | if (!_isFileLoaded) 61 | LoadConfFileInfo(); 62 | 63 | return _logLevel; 64 | } 65 | } 66 | 67 | // Loads all the required information from the OS service conf file 68 | private void LoadConfFileInfo() 69 | { 70 | if (_isFileLoaded) 71 | return; 72 | 73 | try 74 | { 75 | XElement confXml = XElement.Load(_filepath); 76 | 77 | LoadLogFilePathFromConfRoot(confXml); 78 | LoadLogLevelFromConfRoot(confXml); 79 | 80 | _isFileLoaded = true; 81 | } 82 | catch (Exception e) { 83 | FileLogger.LogError("Attempted to load OS Configuration file but failed:", e.Message + e.StackTrace); 84 | } 85 | } 86 | 87 | // Obtain the location of the service log file 88 | private void LoadLogFilePathFromConfRoot(XElement root) 89 | { 90 | // Element chaining can be done because Element is null safe - if the element doesn't exist, it returns an empty element 91 | foreach (XElement el in root.Element("system.diagnostics").Element("trace").Element("listeners").Elements("add")) 92 | { 93 | XAttribute attrName = el.Attribute("name"); 94 | 95 | if (attrName != null && attrName.Value == "MyListener") 96 | { 97 | XAttribute attrData = el.Attribute("initializeData"); 98 | if (attrData != null) 99 | { 100 | _logFilePath = attrData.Value; 101 | } 102 | } 103 | } 104 | } 105 | 106 | 107 | // Obtain the value for LogLevel of the service 108 | private void LoadLogLevelFromConfRoot(XElement root) 109 | { 110 | foreach (XElement el in root.Element("system.diagnostics").Element("switches").Elements("add")) 111 | { 112 | XAttribute attrName = el.Attribute("name"); 113 | 114 | if (attrName != null && attrName.Value == "LogLevel") 115 | { 116 | XAttribute attrValue = el.Attribute("value"); 117 | if (attrValue != null) 118 | { 119 | int.TryParse(attrValue.Value, out _logLevel); 120 | } 121 | } 122 | } 123 | } 124 | 125 | private void LoadServerAPIAndIdentityLogPath(string _filepath) { 126 | 127 | try { 128 | var xml = XDocument.Load(_filepath); 129 | 130 | XNamespace ns = xml.Root.GetDefaultNamespace(); 131 | 132 | foreach (XElement el in xml.Descendants(ns + "targets").Elements(ns + "target")) { 133 | _logServerFilePath = el.Attribute("fileName").Value.ToString(); 134 | break; 135 | } 136 | 137 | } catch (Exception e) { 138 | FileLogger.LogError("Failed to parse Server API / Identity xml ", e.Message + e.StackTrace); 139 | } 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /OSDiagTool/ThreadDumpCollector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using Microsoft.Diagnostics.Runtime; 6 | 7 | 8 | namespace OSDiagTool 9 | { 10 | class ThreadDumpCollector 11 | { 12 | private AttachFlag _mode; 13 | private uint _attachTimeoutInMillis; 14 | 15 | 16 | public ThreadDumpCollector(uint attachTimeoutInMillis, AttachFlag mode) 17 | { 18 | AttachTimeoutInMillis = attachTimeoutInMillis; 19 | Mode = mode; 20 | } 21 | 22 | public ThreadDumpCollector(uint attachTimeoutInMillis) : this(attachTimeoutInMillis, AttachFlag.Passive) { } 23 | 24 | 25 | public string GetThreadDump(int pid) 26 | { 27 | using (StringWriter writer = new StringWriter()) 28 | { 29 | try 30 | { 31 | using (var dataTarget = DataTarget.AttachToProcess(pid, _attachTimeoutInMillis, _mode)) 32 | { 33 | writer.WriteLine(dataTarget.ClrVersions.First().Version); 34 | var runtime = dataTarget.ClrVersions.First().CreateRuntime(); 35 | 36 | foreach (var domain in runtime.AppDomains) 37 | { 38 | writer.WriteLine("Domain " + domain.Name); 39 | } 40 | writer.WriteLine(); 41 | foreach (var t in runtime.Threads) 42 | { 43 | if (!t.IsAlive) 44 | continue; 45 | 46 | if (t.StackTrace.Count == 0) 47 | continue; 48 | 49 | writer.WriteLine("Thread " + t.ManagedThreadId + ": "); 50 | int loop_count = 0; 51 | foreach (var frame in t.EnumerateStackTrace()) 52 | { 53 | writer.WriteLine("\t" + frame.StackPointer.ToString("x16") + " " + frame.ToString()); 54 | loop_count++; 55 | if (loop_count > 200) 56 | { 57 | writer.WriteLine("\t[CORRUPTED]"); 58 | break; 59 | } 60 | } 61 | writer.WriteLine(); 62 | } 63 | } 64 | 65 | return writer.ToString(); 66 | } 67 | catch 68 | { 69 | // This is mostly to catch the "invalid architecture" error. 70 | // Any error that happens we want to ignore and return what we have. 71 | return writer.ToString(); 72 | } 73 | } 74 | } 75 | 76 | public List GetProcessesByName(string processName) 77 | { 78 | return new List(Process.GetProcessesByName(processName)); 79 | } 80 | 81 | public List GetProcessIdsByName(string processName) 82 | { 83 | List processIds = new List(); 84 | 85 | foreach(Process p in Process.GetProcessesByName(processName)) 86 | { 87 | processIds.Add(p.Id); 88 | } 89 | 90 | return processIds; 91 | } 92 | 93 | public List GetProcessIdsByFilename(string processFilename) 94 | { 95 | List processIds = new List(); 96 | 97 | foreach (Process p in Process.GetProcesses().Where(p => GetProcessFilename(p).EndsWith(processFilename))) 98 | { 99 | processIds.Add(p.Id); 100 | } 101 | 102 | return processIds; 103 | } 104 | 105 | public string GetProcessFilename(Process p) 106 | { 107 | try 108 | { 109 | return p.Modules[0].FileName; 110 | } 111 | catch 112 | { 113 | return ""; 114 | } 115 | } 116 | 117 | public AttachFlag Mode 118 | { 119 | get 120 | { 121 | return _mode; 122 | } 123 | set 124 | { 125 | _mode = value; 126 | } 127 | } 128 | 129 | public uint AttachTimeoutInMillis 130 | { 131 | get 132 | { 133 | return _attachTimeoutInMillis; 134 | } 135 | set 136 | { 137 | _attachTimeoutInMillis = value; 138 | } 139 | } 140 | 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /OSDiagTool/Utils/CryptoUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Security.Cryptography; 6 | using System.IO; 7 | using System.Xml.Linq; 8 | 9 | namespace OSDiagTool.Utils 10 | { 11 | 12 | /* 13 | * Most private.key utilities are based on https://github.com/ardoric/ardo.decrypter.net 14 | */ 15 | public static class CryptoUtils 16 | { 17 | static private RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider(); 18 | 19 | private static byte[] DecryptBytes(byte[] key, byte[] iv, byte[] ciphertext) 20 | { 21 | using (Aes crypto = new AesManaged() { Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7 }) 22 | { 23 | crypto.IV = iv; 24 | crypto.Key = key; 25 | using (MemoryStream output = new MemoryStream()) 26 | { 27 | using (CryptoStream cs = new CryptoStream(output, crypto.CreateDecryptor(), CryptoStreamMode.Write)) 28 | { 29 | cs.Write(ciphertext, 0, ciphertext.Length); 30 | } 31 | return output.ToArray(); 32 | } 33 | } 34 | } 35 | 36 | public static string Decrypt(string key, string encryptedText) 37 | { 38 | if (!encryptedText.StartsWith("$2$")) 39 | throw new Exception("Can't decrypt the content: " + encryptedText); 40 | 41 | byte[] the_key = Convert.FromBase64String(key); 42 | byte[] iv = Convert.FromBase64String(encryptedText.Substring(3, 24)); 43 | byte[] ciphertext = Convert.FromBase64String(encryptedText.Substring(3 + 24)); 44 | 45 | return Encoding.UTF8.GetString(DecryptBytes(the_key, iv, ciphertext)); 46 | } 47 | 48 | public static string Encrypt(string key, string plaintext) { 49 | byte[] test = Convert.FromBase64String(key); 50 | string result = Convert.ToBase64String(EncryptBytes(Convert.FromBase64String(key), Encoding.UTF8.GetBytes(plaintext), null)); 51 | return result; 52 | } 53 | 54 | private static byte[] EncryptBytes(byte[] keyBytes, byte[] plainBytes, byte[] associatedData) { 55 | 56 | using (Aes crypto = new AesManaged() { 57 | Mode = CipherMode.CBC, 58 | Padding = PaddingMode.PKCS7 59 | }) { 60 | crypto.Key = keyBytes; 61 | byte[] test = BitConverter.GetBytes(crypto.BlockSize / 8); 62 | crypto.IV = test; 63 | 64 | MemoryStream ms = new MemoryStream(); 65 | ms.Write(crypto.IV, 0, crypto.IV.Length); 66 | using (CryptoStream cs = new CryptoStream(ms, crypto.CreateEncryptor(crypto.Key, crypto.IV), CryptoStreamMode.Write)) { 67 | cs.Write(plainBytes, 0, plainBytes.Length); 68 | } 69 | ms.Close(); 70 | var cipherBytes = ms.ToArray(); 71 | 72 | HMACSHA256 mac = new HMACSHA256(); 73 | mac.Key = keyBytes; 74 | 75 | byte[] allBytes = cipherBytes; 76 | if (associatedData != null) { 77 | allBytes = new byte[cipherBytes.Length + associatedData.Length]; 78 | cipherBytes.CopyTo(allBytes, 0); 79 | associatedData.CopyTo(allBytes, cipherBytes.Length); 80 | } 81 | 82 | byte[] macBytes = mac.ComputeHash(allBytes); 83 | 84 | MemoryStream resStream = new MemoryStream(); 85 | resStream.Write(cipherBytes, 0, cipherBytes.Length); 86 | resStream.Write(macBytes, 0, macBytes.Length); 87 | return resStream.ToArray(); 88 | } 89 | } 90 | 91 | 92 | 93 | 94 | public static string GetPrivateKeyFromFile(string privateKeyFilepath) 95 | { 96 | foreach (string line in File.ReadAllLines(privateKeyFilepath)) 97 | { 98 | string trimmed = line.Trim(); 99 | if (trimmed.Equals(String.Empty) || trimmed.StartsWith("--")) 100 | continue; 101 | return trimmed; 102 | } 103 | return ""; 104 | } 105 | 106 | public static Dictionary GetEncryptedEntriesFromPlatformConfFile(string filepath) 107 | { 108 | using (Stream fileReader = File.OpenRead(filepath)) 109 | { 110 | Dictionary res = new Dictionary(); 111 | XDocument xmlDoc = XDocument.Load(fileReader); 112 | foreach (XElement e in xmlDoc.Descendants().Where(e => e.Attribute("encrypted") != null && e.Attribute("encrypted").Value.ToLower() == "true")) 113 | { 114 | res.Add(e.Name.LocalName, e.Value); 115 | } 116 | return res; 117 | } 118 | } 119 | 120 | 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolForm/PopUpForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace OSDiagTool.OSDiagToolForm { 2 | partial class puf_popUpForm { 3 | /// 4 | /// Required designer variable. 5 | /// 6 | private System.ComponentModel.IContainer components = null; 7 | 8 | /// 9 | /// Clean up any resources being used. 10 | /// 11 | /// true if managed resources should be disposed; otherwise, false. 12 | protected override void Dispose(bool disposing) { 13 | if (disposing && (components != null)) { 14 | components.Dispose(); 15 | } 16 | base.Dispose(disposing); 17 | } 18 | 19 | #region Windows Form Designer generated code 20 | 21 | /// 22 | /// Required method for Designer support - do not modify 23 | /// the contents of this method with the code editor. 24 | /// 25 | private void InitializeComponent() { 26 | this.lbl_message = new System.Windows.Forms.Label(); 27 | this.bt_CloseFormPopUp = new System.Windows.Forms.Button(); 28 | this.pb_progressBar = new System.Windows.Forms.ProgressBar(); 29 | this.lb_ProgressFeedback = new System.Windows.Forms.ListBox(); 30 | this.bt_CancelOsDiagTool = new System.Windows.Forms.Button(); 31 | this.SuspendLayout(); 32 | // 33 | // lbl_message 34 | // 35 | this.lbl_message.AutoSize = true; 36 | this.lbl_message.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 37 | this.lbl_message.Location = new System.Drawing.Point(12, 25); 38 | this.lbl_message.Name = "lbl_message"; 39 | this.lbl_message.Size = new System.Drawing.Size(0, 13); 40 | this.lbl_message.TabIndex = 0; 41 | // 42 | // bt_CloseFormPopUp 43 | // 44 | this.bt_CloseFormPopUp.Location = new System.Drawing.Point(76, 79); 45 | this.bt_CloseFormPopUp.Name = "bt_CloseFormPopUp"; 46 | this.bt_CloseFormPopUp.Size = new System.Drawing.Size(75, 23); 47 | this.bt_CloseFormPopUp.TabIndex = 1; 48 | this.bt_CloseFormPopUp.Text = "Close"; 49 | this.bt_CloseFormPopUp.UseVisualStyleBackColor = true; 50 | this.bt_CloseFormPopUp.Click += new System.EventHandler(this.bt_CloseFormPopUp_Click); 51 | // 52 | // pb_progressBar 53 | // 54 | this.pb_progressBar.Location = new System.Drawing.Point(12, 50); 55 | this.pb_progressBar.Name = "pb_progressBar"; 56 | this.pb_progressBar.Size = new System.Drawing.Size(205, 23); 57 | this.pb_progressBar.TabIndex = 2; 58 | this.pb_progressBar.Visible = false; 59 | // 60 | // lb_ProgressFeedback 61 | // 62 | this.lb_ProgressFeedback.Enabled = false; 63 | this.lb_ProgressFeedback.FormattingEnabled = true; 64 | this.lb_ProgressFeedback.Location = new System.Drawing.Point(12, 13); 65 | this.lb_ProgressFeedback.Name = "lb_ProgressFeedback"; 66 | this.lb_ProgressFeedback.Size = new System.Drawing.Size(205, 30); 67 | this.lb_ProgressFeedback.TabIndex = 3; 68 | this.lb_ProgressFeedback.TabStop = false; 69 | this.lb_ProgressFeedback.Visible = false; 70 | // 71 | // bt_CancelOsDiagTool 72 | // 73 | this.bt_CancelOsDiagTool.Location = new System.Drawing.Point(-5, 79); 74 | this.bt_CancelOsDiagTool.Name = "bt_CancelOsDiagTool"; 75 | this.bt_CancelOsDiagTool.Size = new System.Drawing.Size(75, 23); 76 | this.bt_CancelOsDiagTool.TabIndex = 4; 77 | this.bt_CancelOsDiagTool.Text = "Cancel"; 78 | this.bt_CancelOsDiagTool.UseVisualStyleBackColor = true; 79 | this.bt_CancelOsDiagTool.Visible = false; 80 | this.bt_CancelOsDiagTool.Click += new System.EventHandler(this.bt_CancelOsDiagTool_Click); 81 | // 82 | // puf_popUpForm 83 | // 84 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 85 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 86 | this.ClientSize = new System.Drawing.Size(225, 114); 87 | this.Controls.Add(this.bt_CancelOsDiagTool); 88 | this.Controls.Add(this.lb_ProgressFeedback); 89 | this.Controls.Add(this.pb_progressBar); 90 | this.Controls.Add(this.bt_CloseFormPopUp); 91 | this.Controls.Add(this.lbl_message); 92 | this.MaximizeBox = false; 93 | this.MinimizeBox = false; 94 | this.Name = "puf_popUpForm"; 95 | this.ShowIcon = false; 96 | this.Text = "OSDiagTool"; 97 | this.ResumeLayout(false); 98 | this.PerformLayout(); 99 | 100 | } 101 | 102 | #endregion 103 | 104 | private System.Windows.Forms.Label lbl_message; 105 | private System.Windows.Forms.Button bt_CloseFormPopUp; 106 | public System.Windows.Forms.ProgressBar pb_progressBar; 107 | public System.Windows.Forms.ListBox lb_ProgressFeedback; 108 | private System.Windows.Forms.Button bt_CancelOsDiagTool; 109 | } 110 | } -------------------------------------------------------------------------------- /OSDiagTool/OSDGTCmdLine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OSDiagTool.OSDiagToolConf; 3 | using System.Diagnostics; 4 | 5 | 6 | 7 | namespace OSDiagTool { 8 | class OSDGTCmdLine { 9 | // Cmd Line run does not export Platform Logs neither Metamodel 10 | 11 | public static string osDiagToolEventSource = "OSDiagTool"; 12 | 13 | 14 | 15 | public static void CmdLineRun(OSDiagToolConf.ConfModel.strConfModel configurations, string dbms, DBConnector.SQLConnStringModel SQLConnectionString = null, DBConnector.OracleConnStringModel OracleConnectionString = null, 16 | string dbSaUser = null, string dbSaPwd = null) { 17 | 18 | Console.WriteLine("Starting OSDiagTool data collection."); 19 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool started", EventLogEntryType.Information); 20 | 21 | // Get Platform and Server files 22 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_platform][OSDiagToolConfReader._l3_platformAndServerConfigFiles]) { 23 | 24 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Fetching Platfrom and Server files", EventLogEntryType.Information); 25 | Program.GetPlatformAndServerFiles(); 26 | 27 | } 28 | 29 | // Export Event Viewer and Server logs 30 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_serverLogs][OSDiagToolConfReader._l3_evtAndServer]) { 31 | 32 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Exporting Event Viewer and Server logs", EventLogEntryType.Information); 33 | Program.ExportEventViewerAndServerLogs(); 34 | } 35 | 36 | 37 | // Copy IIS Access logs 38 | if(configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_serverLogs][OSDiagToolConfReader._l3_iisLogs]) { 39 | 40 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Exporting IIS Access logs (number of days exported: )" + configurations.IISLogsNrDays, EventLogEntryType.Information); 41 | Program.CopyIISAccessLogs(configurations.IISLogsNrDays); 42 | 43 | } 44 | 45 | // Database Troubleshoot 46 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_databaseOperations][OSDiagToolConfReader._l3_databaseTroubleshoot]) { 47 | 48 | Platform.PlatformConnectionStringDefiner ConnectionStringDefiner = new Platform.PlatformConnectionStringDefiner(); 49 | Platform.PlatformConnectionStringDefiner ConnStringHelper = ConnectionStringDefiner.GetConnectionString(Program.dbEngine, false, true, ConnectionStringDefiner, dbSaUser, dbSaPwd); 50 | 51 | if (Program.dbEngine.Equals(Database.DatabaseType.SqlServer)) { 52 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Performing Database Troubleshoot (Database engine: SQL Server);", EventLogEntryType.Information); 53 | Program.DatabaseTroubleshootProgram(configurations, ConnStringHelper.SQLConnString); 54 | 55 | } else if (Program.dbEngine.Equals(Database.DatabaseType.Oracle)) { 56 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Performing Database Troubleshoot (Database engine: Oracle);", EventLogEntryType.Information); 57 | Program.DatabaseTroubleshootProgram(configurations, null, ConnStringHelper.OracleConnString); 58 | 59 | } 60 | } 61 | 62 | 63 | // IIS Thread dumps 64 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_threadDumps][OSDiagToolConfReader._l3_iisW3wp]) { 65 | 66 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Retrieving IIS Thread dumps;", EventLogEntryType.Information); 67 | Program.ExportEventViewerAndServerLogs(onlyIISRequests: true); 68 | Program.CollectThreadDumpsProgram(true, false); 69 | 70 | } 71 | 72 | // OutSystems Services Thread dumps 73 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_threadDumps][OSDiagToolConfReader._l3_osServices]) { 74 | 75 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Retrieving OutSystems Services Thread dumps;", EventLogEntryType.Information); 76 | Program.CollectThreadDumpsProgram(false, true); 77 | 78 | } 79 | 80 | // IIS Memory Dumps 81 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_memoryDumps][OSDiagToolConfReader._l3_iisW3wp]) { 82 | 83 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Retrieving IIS memory dumps;", EventLogEntryType.Information); 84 | Program.CollectMemoryDumpsProgram(true, false); 85 | 86 | } 87 | 88 | // OutSystems Services Memory Dumps 89 | if (configurations.osDiagToolConfigurations[OSDiagToolConfReader._l2_memoryDumps][OSDiagToolConfReader._l3_osServices]) { 90 | 91 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool: Retrieving OutSystems Services memory dumps;", EventLogEntryType.Information); 92 | Program.CollectMemoryDumpsProgram(false, true); 93 | 94 | } 95 | 96 | Program.GenerateZipFile(); 97 | 98 | EventLog.WriteEntry(osDiagToolEventSource, "Command Line run of OSDiagTool finished", EventLogEntryType.Information); 99 | 100 | 101 | } 102 | 103 | 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /OSDiagTool/DBConnector/SqlCommandExecutor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.SqlClient; 4 | using Oracle.ManagedDataAccess.Client; 5 | using System.Data; 6 | 7 | namespace OSDiagTool.DBConnector 8 | { 9 | public class SqlCommandExecutor : IDatabaseCommand 10 | { 11 | private IDatabaseConnection connection; 12 | private SqlConnection sqlConnection; 13 | 14 | public SqlCommandExecutor(IDatabaseConnection sqlConnection) 15 | { 16 | connection = sqlConnection; 17 | } 18 | 19 | public void Execute(string query, OSDiagToolConf.ConfModel.strConfModel configurations, SqlConnection sqlConnection, OracleConnection oracleConnection = null) 20 | { 21 | SqlCommand command = new SqlCommand(query, sqlConnection) 22 | { 23 | CommandTimeout = configurations.queryTimeout 24 | }; 25 | } 26 | 27 | public IEnumerable ReadData(string query, OSDiagToolConf.ConfModel.strConfModel configurations, IDatabaseConnection connection, string oracleAdminSchema = null) 28 | { 29 | List result = new List(); 30 | if (connection is SqlConnector) 31 | { 32 | sqlConnection = connection.ReturnSQLConnection(); 33 | } 34 | SqlCommand command = new SqlCommand(query, sqlConnection) 35 | { 36 | CommandTimeout = configurations.queryTimeout 37 | }; 38 | 39 | using (SqlDataReader reader = command.ExecuteReader()) 40 | { 41 | while (reader.Read()) 42 | { 43 | object[] rowData = new object[reader.FieldCount]; 44 | reader.GetValues(rowData); 45 | result.Add(rowData); 46 | } 47 | } 48 | return result; 49 | } 50 | } 51 | 52 | public class OracleCommandExecutor : IDatabaseCommand 53 | { 54 | private IDatabaseConnection connection; 55 | private OracleConnection oracleConnection; 56 | 57 | public OracleCommandExecutor(IDatabaseConnection oracleConnection) 58 | { 59 | connection = oracleConnection; 60 | } 61 | 62 | public void Execute(string query, OSDiagToolConf.ConfModel.strConfModel configurations, SqlConnection sqlConnection = null, OracleConnection oracleConnection = null) 63 | { 64 | if (oracleConnection == null || oracleConnection.State != ConnectionState.Open) 65 | { 66 | throw new InvalidOperationException("Oracle connection not initialized or closed."); 67 | } 68 | 69 | using (OracleCommand command = new OracleCommand(query, oracleConnection)) 70 | { 71 | command.CommandTimeout = configurations.queryTimeout; 72 | } 73 | } 74 | 75 | public IEnumerable ReadData(string query, OSDiagToolConf.ConfModel.strConfModel configurations, IDatabaseConnection connection, string oracleAdminSchema = null) 76 | { 77 | List result = new List(); 78 | if(connection is OracleConnector) 79 | { 80 | oracleConnection = connection.ReturnOracleConnection(); 81 | } 82 | 83 | string alterSessionSql = String.Format("ALTER SESSION SET CURRENT_SCHEMA = {0}", oracleAdminSchema); 84 | 85 | using (OracleTransaction transaction = oracleConnection.BeginTransaction()) 86 | { 87 | try 88 | { 89 | using (OracleCommand alterSessionCmd = new OracleCommand(alterSessionSql, oracleConnection)) 90 | { 91 | alterSessionCmd.Transaction = transaction; 92 | alterSessionCmd.ExecuteNonQuery(); 93 | } 94 | 95 | OracleCommand command = new OracleCommand(query, oracleConnection) 96 | { 97 | CommandTimeout = configurations.queryTimeout 98 | }; 99 | 100 | command.Transaction = transaction; 101 | 102 | using (OracleDataReader reader = command.ExecuteReader()) 103 | { 104 | while (reader.Read()) 105 | { 106 | object[] rowData = new object[reader.FieldCount]; 107 | reader.GetValues(rowData); 108 | result.Add(rowData); 109 | } 110 | } 111 | 112 | transaction.Commit(); 113 | 114 | return result; 115 | 116 | } catch (Exception e) 117 | { 118 | FileLogger.LogError("Eror executing Oracle reader.", e.Message + e.StackTrace); 119 | transaction.Rollback(); 120 | return null; 121 | } 122 | } 123 | } 124 | } 125 | 126 | public static class DatabaseCommandFactory 127 | { 128 | public static IDatabaseCommand GetCommandExecutor(Database.DatabaseType dbEngine, IDatabaseConnection connection) 129 | { 130 | switch (dbEngine) 131 | { 132 | case Database.DatabaseType.SqlServer: 133 | return new SqlCommandExecutor(connection); 134 | case Database.DatabaseType.Oracle: 135 | return new OracleCommandExecutor(connection); 136 | default: 137 | throw new ArgumentException("Unsupported database type while getting command executor"); 138 | } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /OSDiagTool/Oracle.DataAccess.Common.Configuration.Section.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /OSDiagTool/Utils/NetworkUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net.NetworkInformation; 3 | using System.Net; 4 | using System.Net.Sockets; 5 | using System; 6 | using System.Net.Security; 7 | 8 | namespace OSDiagTool.Utils 9 | { 10 | 11 | class NetworkUtils 12 | { 13 | /* 14 | * Performs an ICMP echo request 15 | */ 16 | public static string PingAddress(string hostAddress) 17 | { 18 | Ping pinger = new Ping(); 19 | IPAddress addressToPing = Dns.GetHostAddresses(hostAddress) 20 | .First(address => address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork); 21 | PingReply reply = pinger.Send(addressToPing, 10000); // 10 second timeout 22 | 23 | return reply.Address.ToString(); 24 | } 25 | 26 | /* 27 | * Opens a HTTP or HTTPS web request to an address and a port 28 | * Returns the status code 29 | */ 30 | public static string OpenWebRequest(string address, int port) 31 | { 32 | HttpWebRequest request; 33 | 34 | if (port == 443) 35 | request = (HttpWebRequest)WebRequest.Create("https://" + address); 36 | else 37 | request = (HttpWebRequest)WebRequest.Create("http://" + address); 38 | 39 | request.Timeout = 10000; // 10 second timeout 40 | request.Method = "GET"; 41 | 42 | try 43 | { 44 | // Ignore the certificate trust validation - we just need to know the response 45 | ServicePointManager.ServerCertificateValidationCallback = new 46 | RemoteCertificateValidationCallback 47 | ( 48 | delegate { return true; } 49 | ); 50 | 51 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 52 | { 53 | string result = ((int)response.StatusCode).ToString(); 54 | response.Close(); 55 | 56 | return result; 57 | } 58 | } 59 | // For status codes >= 400 60 | catch (WebException we) 61 | { 62 | // Let's consider that the response can be null 63 | if (we.Response != null) 64 | return ((int)((HttpWebResponse)we.Response).StatusCode).ToString(); 65 | else 66 | FileLogger.LogError("Web request returned a web exception with the following message: ", we.Message + we.StackTrace); 67 | return null; 68 | 69 | } 70 | catch (Exception e) 71 | { 72 | FileLogger.LogError("Web request failed with the error: ", e.Message + e.StackTrace); 73 | return null; 74 | } 75 | } 76 | 77 | /* 78 | * Opens a TCP request request to an address and a port 79 | * Returns if we were able to connect to the port or if it's in use 80 | */ 81 | public static string ConnectToPort(string address, int port, bool retrieveIP = false) 82 | { 83 | TcpClient tcpClient = null; 84 | 85 | try 86 | { 87 | tcpClient = new TcpClient(address, port) 88 | { 89 | ReceiveTimeout = 10000 // 10 second timeout 90 | }; 91 | // If we reached here, then we successfully connected to the port 92 | 93 | // If requested, retrieve the remote IP 94 | if (retrieveIP) 95 | { 96 | IPEndPoint remoteIpEndPoint = tcpClient.Client.RemoteEndPoint as IPEndPoint; 97 | return remoteIpEndPoint.Address.ToString(); 98 | } 99 | 100 | return "OK"; 101 | } 102 | catch (Exception e) 103 | { 104 | // Since we could not connect, let's check if the port is in use 105 | if (IsPortInUse(port)) 106 | return "The port " + port + " is opened but its currently in use"; 107 | else 108 | { 109 | // If we get here, something else happened, like the port is not open, or host is not reachable 110 | FileLogger.LogError("Network stream failed with the error: ", e.Message + e.StackTrace); 111 | return null; 112 | } 113 | } 114 | finally 115 | { 116 | // Close the tcp conection and the underlying network stream 117 | if (tcpClient != null) 118 | { 119 | tcpClient.Client.Close(); 120 | tcpClient.Close(); 121 | } 122 | } 123 | } 124 | 125 | /* 126 | * Checks if a port is an active TCP listener (all TCP states except the Listen state) 127 | */ 128 | private static bool IsPortInUse(int port) 129 | { 130 | bool inUse = false; 131 | 132 | IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties(); 133 | IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners(); 134 | 135 | foreach (IPEndPoint endPoint in ipEndPoints) 136 | { 137 | if (endPoint.Port == port) 138 | { 139 | inUse = true; 140 | break; 141 | } 142 | } 143 | return inUse; 144 | } 145 | 146 | // Check if a hostname is an IP or not 147 | public static bool IsIP(string hostname) 148 | { 149 | return (Uri.CheckHostName(hostname) == UriHostNameType.IPv4 || Uri.CheckHostName(hostname) == UriHostNameType.IPv6); 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /OSDiagTool/Database/DatabaseExporter/CSVExporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.SqlClient; 3 | using Oracle.ManagedDataAccess.Client; 4 | using System.Text.RegularExpressions; 5 | 6 | namespace OSDiagTool.DatabaseExporter { 7 | class CSVExporter { 8 | 9 | public static void SQLToCSVExport(Database.DatabaseType dbEngine, string tableName, string csvFilePath, int queryTimeout, string query, SqlConnection SqlConnection = null, OracleConnection Orclconnection = null) { 10 | 11 | try { 12 | 13 | using (System.IO.StreamWriter fs = new System.IO.StreamWriter(csvFilePath + "\\" + tableName + ".csv")) { 14 | 15 | if (dbEngine.Equals(Database.DatabaseType.SqlServer)) { 16 | 17 | SqlCommand command = new SqlCommand(query, SqlConnection) { 18 | CommandTimeout = queryTimeout 19 | }; 20 | 21 | SqlDataReader dr = command.ExecuteReader(); 22 | 23 | for (int i = 0; i < dr.FieldCount; i++) { 24 | 25 | var name = dr.GetName(i); 26 | 27 | if (name.Contains(",")) { 28 | name = name.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 29 | } 30 | 31 | fs.Write(name + ","); 32 | } 33 | 34 | fs.WriteLine(); 35 | 36 | while (dr.Read()) { 37 | for (int i = 0; i < dr.FieldCount; i++) { 38 | 39 | var value = dr[i].ToString(); 40 | value = Regex.Replace(value, @"(;|\r\n|\n)", " "); // replacing semicolon and new lines 41 | 42 | 43 | if (value.Contains(",")) { 44 | value = value.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 45 | } 46 | 47 | fs.Write(value + ","); 48 | } 49 | 50 | fs.WriteLine(); 51 | } 52 | 53 | } else if(dbEngine.Equals(Database.DatabaseType.Oracle)) { // oracle 54 | 55 | OracleCommand command = new OracleCommand(query, Orclconnection) { 56 | CommandTimeout = queryTimeout 57 | }; 58 | 59 | OracleDataReader dr = command.ExecuteReader(); 60 | 61 | for (int i = 0; i < dr.FieldCount; i++) { 62 | var name = dr.GetName(i); 63 | 64 | if (name.Contains(",")) { 65 | name = name.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 66 | } 67 | 68 | fs.Write(name + ","); 69 | } 70 | 71 | fs.WriteLine(); 72 | 73 | while (dr.Read()) { 74 | for (int i = 0; i < dr.FieldCount; i++) { 75 | 76 | var value = dr[i].ToString(); 77 | 78 | value = Regex.Replace(value, @"(;|\r\n|\n)", " "); // replacing semicolon and new lines 79 | 80 | if (value.Contains(",")) { 81 | value = value.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 82 | } 83 | 84 | fs.Write(value + ","); 85 | } 86 | 87 | fs.WriteLine(); 88 | } 89 | 90 | } 91 | 92 | } 93 | 94 | } catch (Exception e) { 95 | FileLogger.LogError("Unable to read data from SQL DB: " + tableName, e.Message + e.StackTrace, writeToConsole: false, writeDateTime: false); 96 | } 97 | 98 | 99 | } 100 | 101 | 102 | 103 | public static void ORCLToCsvExport(OracleConnection connection, string tableName, string csvFilePath, int queryTimeout, string osAdminSchema, string query) { 104 | 105 | using (System.IO.StreamWriter fs = new System.IO.StreamWriter(csvFilePath + "\\" + tableName + ".csv")) { 106 | 107 | OracleCommand command = new OracleCommand(query, connection) { 108 | CommandTimeout = queryTimeout 109 | }; 110 | 111 | try { 112 | 113 | OracleDataReader dr = command.ExecuteReader(); 114 | 115 | for (int i = 0; i < dr.FieldCount; i++) { 116 | string name = dr.GetName(i); 117 | 118 | if (name.Contains(",")) { 119 | name = name.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 120 | } 121 | 122 | fs.Write(name + ","); 123 | } 124 | 125 | fs.WriteLine(); 126 | 127 | while (dr.Read()) { 128 | for (int i = 0; i < dr.FieldCount; i++) { 129 | string value = dr[i].ToString(); 130 | 131 | if (value.Contains(",")) { 132 | value = value.Replace(",", "_"); // replacing commas for _ to avoid writting in a next cell 133 | } 134 | 135 | fs.Write(value + ","); 136 | } 137 | fs.WriteLine(); 138 | } 139 | 140 | } catch (Exception e) { 141 | FileLogger.LogError("Unable to read data from SQL DB: " + tableName, e.Message + e.StackTrace, writeToConsole: false, writeDateTime: false); 142 | } 143 | 144 | } 145 | 146 | 147 | } 148 | 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /OSDiagTool/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /OSDiagTool/OSDiagToolForm/PopUpForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/PlatformConnectionStringDefiner.cs: -------------------------------------------------------------------------------- 1 | using OSDiagTool.Platform.ConfigFiles; 2 | using OSDiagTool.Utils; 3 | 4 | namespace OSDiagTool.Platform { 5 | public class PlatformConnectionStringDefiner { 6 | 7 | public DBConnector.SQLConnStringModel SQLConnString { get; set; } 8 | public DBConnector.OracleConnStringModel OracleConnString { get; set; } 9 | public string AdminSchema { get; set; } 10 | 11 | public PlatformConnectionStringDefiner GetConnectionString(Database.DatabaseType dbEngine, bool isLogDatabase, bool isSaCredentials, PlatformConnectionStringDefiner ConnStringDefiner, string saUser = null, string saPwd = null) { 12 | 13 | ConfigFileReader confFileParser = new ConfigFileReader(Program.platformConfigurationFilepath, Program.osPlatformVersion); 14 | ConfigFileInfo platformDBInfo = confFileParser.DBPlatformInfo; 15 | ConfigFileInfo loggingDBInfo = confFileParser.DBLoggingInfo; 16 | ConfigFileInfo sessionDBInfo = confFileParser.DBSessionInfo; 17 | 18 | if (dbEngine.Equals(Database.DatabaseType.SqlServer)) { 19 | 20 | ConnStringDefiner.SQLConnString = SetPlatformSQLConnString(isLogDatabase, isSaCredentials, platformDBInfo, loggingDBInfo, saUser, saPwd); 21 | return ConnStringDefiner; 22 | 23 | } else if (dbEngine.Equals(Database.DatabaseType.Oracle)) { 24 | 25 | ConnStringDefiner.OracleConnString = SetPlatformOracleConnString(isLogDatabase, isSaCredentials, platformDBInfo, loggingDBInfo, saUser, saPwd); 26 | ConnStringDefiner.AdminSchema = platformDBInfo.GetProperty("AdminUser").Value; 27 | return ConnStringDefiner; 28 | 29 | } 30 | 31 | return null; 32 | 33 | } 34 | 35 | public DBConnector.SQLConnStringModel SetPlatformSQLConnString(bool isLogDatabase, bool isSaCredentials, ConfigFileInfo platformDBInfo = null, ConfigFileInfo loggingDBInfo = null, string saUser = null, string saPwd = null) { 36 | 37 | var sqlConnString = new DBConnector.SQLConnStringModel(); 38 | 39 | if (!isLogDatabase && !isSaCredentials) { // Uses Runtime user and Platform Main Catalog 40 | 41 | string platformDBRuntimeUser = platformDBInfo.GetProperty("RuntimeUser").Value; 42 | string platformDBRuntimeUserPwd = platformDBInfo.GetProperty("RuntimePassword").GetDecryptedValue(CryptoUtils.GetPrivateKeyFromFile(Program.privateKeyFilepath)); 43 | 44 | sqlConnString.dataSource = platformDBInfo.GetProperty("Server").Value; 45 | sqlConnString.initialCatalog = platformDBInfo.GetProperty("Catalog").Value; 46 | sqlConnString.userId = platformDBRuntimeUser; 47 | sqlConnString.pwd = platformDBRuntimeUserPwd; 48 | sqlConnString.advancedSettings = platformDBInfo.GetProperty("RuntimeAdvancedSettings").Value; 49 | 50 | } 51 | else if (isLogDatabase) { // Uses Runtime Log user and Log Catalog 52 | 53 | sqlConnString.dataSource = loggingDBInfo.GetProperty("Server").Value; 54 | sqlConnString.userId = loggingDBInfo.GetProperty("RuntimeUser").Value; // needs to use oslog configurations 55 | sqlConnString.pwd = loggingDBInfo.GetProperty("RuntimePassword").GetDecryptedValue(CryptoUtils.GetPrivateKeyFromFile(Program.privateKeyFilepath)); 56 | sqlConnString.initialCatalog = loggingDBInfo.GetProperty("Catalog").Value; 57 | 58 | } 59 | else if (isSaCredentials) { // Uses SA Credentials inputted on the Form 60 | 61 | sqlConnString.dataSource = platformDBInfo.GetProperty("Server").Value; 62 | sqlConnString.initialCatalog = platformDBInfo.GetProperty("Catalog").Value; 63 | sqlConnString.userId = saUser; 64 | sqlConnString.pwd = saPwd; 65 | 66 | } 67 | 68 | return sqlConnString; 69 | 70 | } 71 | 72 | public DBConnector.OracleConnStringModel SetPlatformOracleConnString(bool isLogDatabase, bool isSaCredentials, ConfigFileInfo platformDBInfo = null, ConfigFileInfo loggingDBInfo = null, string saUser = null, string saPwd = null) { 73 | 74 | var orclConnString = new DBConnector.OracleConnStringModel(); 75 | 76 | FileLogger.TraceLog("isLogDB: " + isLogDatabase ); 77 | 78 | if (!isLogDatabase && !isSaCredentials) { // Uses Runtime user and Platform Main Catalog 79 | 80 | orclConnString.host = platformDBInfo.GetProperty("Host").Value; 81 | orclConnString.port = platformDBInfo.GetProperty("Port").Value; 82 | orclConnString.serviceName = platformDBInfo.GetProperty("ServiceName").Value; 83 | orclConnString.userId = platformDBInfo.GetProperty("RuntimeUser").Value; 84 | orclConnString.pwd = platformDBInfo.GetProperty("RuntimePassword").GetDecryptedValue(CryptoUtils.GetPrivateKeyFromFile(Program.privateKeyFilepath)); 85 | 86 | 87 | } else if (isLogDatabase) { // Uses Runtime Log user and Log Catalog 88 | 89 | //ConfigFileInfo loggingDBInfo = confFileParser.DBLoggingInfo; 90 | 91 | orclConnString.host = loggingDBInfo.GetProperty("Host").Value; 92 | orclConnString.port = loggingDBInfo.GetProperty("Port").Value; 93 | orclConnString.serviceName = loggingDBInfo.GetProperty("ServiceName").Value; 94 | orclConnString.userId = loggingDBInfo.GetProperty("AdminUser").Value; // needs to use oslog configurations 95 | orclConnString.pwd = loggingDBInfo.GetProperty("AdminPassword").GetDecryptedValue(CryptoUtils.GetPrivateKeyFromFile(Program.privateKeyFilepath)); 96 | 97 | 98 | } else if (isSaCredentials) { // Uses SA Credentials inputted on the Form 99 | 100 | orclConnString.host = platformDBInfo.GetProperty("Host").Value; 101 | orclConnString.port = platformDBInfo.GetProperty("Port").Value; 102 | orclConnString.serviceName = platformDBInfo.GetProperty("ServiceName").Value; 103 | orclConnString.userId = saUser; 104 | orclConnString.pwd = saPwd; 105 | 106 | } 107 | 108 | return orclConnString; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/PlatformUtils.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using Oracle.ManagedDataAccess.Client; 3 | using OSDiagTool.Platform.ConfigFiles; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Data; 7 | using System.Data.SqlClient; 8 | 9 | namespace OSDiagTool.Platform { 10 | public class PlatformUtils { 11 | 12 | public static string GetPlatformVersion(string osServerRegistry) { 13 | 14 | // Find Installation path and Platform Version 15 | string osPlatformVersion = null; 16 | try { 17 | //FileLogger.TraceLog("Verifying OutSystems Platform Version..."); 18 | RegistryKey OSPlatformInstaller = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(osServerRegistry); 19 | 20 | osPlatformVersion = (string)OSPlatformInstaller.GetValue("Server"); 21 | //FileLogger.TraceLog("Platform version: " + osPlatformVersion); 22 | 23 | } catch (Exception) { 24 | //FileLogger.LogError(" * Unable to find OutSystems Platform Server Installation... * ", e.Message + e.StackTrace); 25 | return null; 26 | } 27 | 28 | return osPlatformVersion; 29 | 30 | } 31 | 32 | public static string GetPlatformInstallationPath(string osServerRegistry) { 33 | 34 | try { 35 | //FileLogger.TraceLog("Finding OutSystems Platform Installation Path..."); 36 | 37 | RegistryKey OSPlatformInstaller = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(osServerRegistry); 38 | string osInstallationFolder = (string)OSPlatformInstaller.GetValue(""); 39 | 40 | return osInstallationFolder; 41 | 42 | } catch (Exception) { 43 | //FileLogger.LogError(" * Unable to find OutSystems Platform Version... * ", e.Message + e.StackTrace); 44 | return null; 45 | } 46 | } 47 | 48 | public static bool IsLifeTimeEnvironment(Database.DatabaseType dbEngine, int queryTimeout, SqlConnection SqlConnection = null, OracleConnection orclConnection = null, string platformDBAdminUser = null) { 49 | 50 | if (dbEngine.Equals(Database.DatabaseType.SqlServer)) { 51 | 52 | string _selectPlatSVCSObserver = "SELECT COUNT(ID) FROM OSSYS_PLATFORMSVCS_OBSERVER WHERE ISACTIVE = 1"; // check if it's registered on LifeTime. If it isn't, assume it's LifeTime 53 | 54 | SqlCommand cmd = new SqlCommand(_selectPlatSVCSObserver, SqlConnection) { 55 | CommandTimeout = queryTimeout 56 | }; 57 | 58 | cmd.ExecuteNonQuery(); 59 | int count = Convert.ToInt32(cmd.ExecuteScalar()); 60 | 61 | if (count.Equals(0)) { 62 | return true; 63 | } 64 | 65 | } 66 | else if (dbEngine.Equals(Database.DatabaseType.Oracle)) { 67 | 68 | string _selectPlatSVCSObserver = "SELECT COUNT(ID) FROM " + platformDBAdminUser + "." + "OSSYS_PLATFORMSVCS_OBSERVER WHERE ISACTIVE = 1"; 69 | 70 | OracleCommand cmd = new OracleCommand(_selectPlatSVCSObserver, orclConnection) { 71 | CommandTimeout = queryTimeout 72 | }; 73 | 74 | cmd.ExecuteNonQuery(); 75 | int count = Convert.ToInt32(cmd.ExecuteScalar()); 76 | 77 | if (count.Equals(0)) { 78 | return true; 79 | } 80 | } 81 | 82 | return false; 83 | 84 | } 85 | 86 | public static Dictionary GetServerList(Database.DatabaseType dbEngine, int queryTimeout, SqlConnection SqlConnection = null, OracleConnection orclConnection = null, string platformDBAdminUser = null) 87 | { 88 | 89 | Dictionary lst = new Dictionary(); 90 | 91 | if (dbEngine.Equals(Database.DatabaseType.SqlServer)) 92 | { 93 | // Retrieve list of active servers 94 | string _selectPlatSVCSObserver = "SELECT NAME, IP_ADDRESS FROM OSSYS_SERVER WHERE IS_ACTIVE = 1"; 95 | 96 | SqlCommand cmd = new SqlCommand(_selectPlatSVCSObserver, SqlConnection) 97 | { 98 | CommandTimeout = queryTimeout 99 | }; 100 | 101 | using (IDataReader dataReader = cmd.ExecuteReader()) 102 | { 103 | //Loop through results 104 | while (dataReader.Read()) 105 | { 106 | lst.Add(Convert.ToString(dataReader["NAME"]), Convert.ToString(dataReader["IP_ADDRESS"])); 107 | } 108 | } 109 | } 110 | else if (dbEngine.Equals(Database.DatabaseType.Oracle)) 111 | { 112 | 113 | string _selectPlatSVCSObserver = "SELECT NAME, IP_ADDRESS FROM " + platformDBAdminUser + "." + "OSSYS_SERVER WHERE IS_ACTIVE = 1"; 114 | 115 | OracleCommand cmd = new OracleCommand(_selectPlatSVCSObserver, orclConnection) 116 | { 117 | CommandTimeout = queryTimeout 118 | }; 119 | 120 | using (IDataReader dataReader = cmd.ExecuteReader()) 121 | { 122 | //Loop through results 123 | while (dataReader.Read()) 124 | { 125 | lst.Add(Convert.ToString(dataReader["NAME"]), Convert.ToString(dataReader["IP_ADDRESS"])); 126 | } 127 | } 128 | } 129 | 130 | return lst; 131 | } 132 | 133 | /* 134 | * Read configuration section from the server.hsconf file 135 | */ 136 | public static string GetConfigurationValue(string element, ConfigFileInfo platformInfo) 137 | { 138 | // We need to check if the configuration exists, if not, return null 139 | try { 140 | return platformInfo.GetProperty(element).Value; 141 | } catch (Exception e) { 142 | FileLogger.LogError("Failed to retrieve platform configuration value " + element + " : ", e.Message + e.StackTrace); 143 | return null; 144 | } 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /OSDiagTool/Tests/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using OSDiagTool.DBConnector; 8 | using OSDiagTool.Platform.ConfigFiles; 9 | using OSDiagTool.Utils; 10 | using System.Xml.Linq; 11 | using OSDiagTool.OSDiagToolConf; 12 | using OSDiagTool.DatabaseExporter; 13 | using System.Data.SqlClient; 14 | using OSDiagTool.Database.DatabaseQueries; 15 | using OSDiagTool; 16 | 17 | 18 | namespace OSDiagTool.Tests 19 | { 20 | class Class1 21 | { 22 | public static string PlatformDatabaseConfigurationElement = "PlatformDatabaseConfiguration"; 23 | public static string _oSDiagToolConfPath = @"C:\Users\fcb\Desktop\GitProj\techsupp-osdiagtool\OSDiagTool\OSDiagTool.exe.config"; 24 | //private static string platformConfigurationFilepath = @"C:\Users\fcb\Desktop\GitProj\techsupp-osdiagtool\OSDiagTool\bin\Debug\server.hsconf"; 25 | //private static string _tempPath = @"C:\Users\fcb\Desktop\GitProj\techsupp-osdiagtool\OSDiagTool\bin\Debug"; 26 | 27 | 28 | static void Main(string[] args) 29 | { 30 | 31 | Program.CollectMemoryDumps(true, false); 32 | 33 | 34 | //float test = WinPerfCounters.GetIISQueue(); 35 | 36 | //Program.CollectMemoryDumps(true, true); 37 | 38 | /*string dbEngine = "oracle"; 39 | int queryTimeout = 30; 40 | 41 | OSDiagToolConfReader dgtConfReader = new OSDiagToolConfReader(); 42 | var configurations = dgtConfReader.GetOsDiagToolConfigurations(); 43 | 44 | var orclConnString = new DBConnector.OracleConnStringModel(); 45 | orclConnString.host = @"<>"; 46 | orclConnString.port = @"<>"; 47 | orclConnString.serviceName = @"<>"; 48 | 49 | orclConnString.userId = @"<>"; 50 | orclConnString.pwd = @"<>"; 51 | 52 | 53 | Database.DatabaseQueries.DatabaseTroubleshoot.DatabaseTroubleshooting(dbEngine, configurations, _tempPath, null, orclConnString); 54 | 55 | 56 | 57 | Test(); 58 | 59 | //FileSystemHelper fs = new FileSystemHelper(); 60 | //fs.DirectoryCopy(@"", @"", true, 0); 61 | 62 | var DQ = new OracleQueries(); 63 | string foo = string.Format(DQ.alterSession, "test"); 64 | 65 | //Database.DatabaseQueries.DatabaseTroubleshoot.DatabaseTroubleshooting("sqlserver", 30); 66 | 67 | 68 | 69 | 70 | 71 | var connString = new DBConnector.SQLConnStringModel(); 72 | connString.dataSource = ""; 73 | connString.initialCatalog = ""; 74 | connString.userId = ""; 75 | connString.pwd = "^"; 76 | 77 | //DBReader.SQLReader(connString, "SELECT TOP 5 * FROM OSSYS_ESPACE"); 78 | 79 | //ConfigFileReader confFileParser = new ConfigFileReader(platformConfigurationFilepath, "test"); 80 | //ConfigFileInfo platformDBInfo = confFileParser.DBPlatformInfo; 81 | 82 | //string dbEngine = platformDBInfo.DBMS; 83 | 84 | var connector = new DBConnector.SLQDBConnector(); 85 | SqlConnection connection = connector.SQLOpenConnection(connString); 86 | 87 | 88 | foreach(string table in configurations.tableNames) { 89 | //CSVExporter.SQLToCSVExport(connection, table, Path.Combine(Directory.GetCurrentDirectory(), "collect_data"), configurations.queryTimeout); 90 | } 91 | 92 | 93 | 94 | 95 | List list1 = new List() 96 | { 97 | "Server", 98 | "Catalog", 99 | "AdminUser", 100 | "AdminPassword" 101 | }; 102 | 103 | 104 | HsconfReader(list1); 105 | 106 | 107 | } 108 | 109 | // TODO 110 | 111 | private static void OSDiagConfReader() 112 | { 113 | 114 | XDocument xml = XDocument.Load(_oSDiagToolConfPath); 115 | 116 | var nodes = (from n in xml.Descendants("configuration") 117 | select n.Element("infoToRetrieve").Element("databaseTables").Element("ossys").Elements()).ToList(); 118 | 119 | foreach (XElement el in nodes[0]) { 120 | 121 | string tableName = el.Attribute("name").Value; 122 | 123 | } 124 | 125 | 126 | //var xmlString = XDocument.Load(_oSDiagToolConfPath); 127 | 128 | 129 | // Querying the data 130 | var query = from p in xmlString.Descendants("configuration") 131 | select new 132 | { 133 | test = p.Element("queryTimeout").Value 134 | //test = p.Element("OSDiagToolConf").Attribute("queryTimeout").Value, 135 | }; 136 | 137 | string test = query.First().test.ToLower(); 138 | 139 | 140 | */ 141 | 142 | 143 | //return test; 144 | } 145 | 146 | // must still be added to the Tool code 147 | private static void HsconfReader(List HsconfPropertiesList) 148 | { 149 | //IDictionary HsConfPropertiesVal; 150 | ConfigFileReader confFileParser = new ConfigFileReader("", "test"); 151 | ConfigFileInfo platformDBInfo = confFileParser.DBPlatformInfo; 152 | string _propValue; 153 | 154 | IDictionary HsConfPropertiesVal = new Dictionary(); 155 | 156 | foreach (string HsconfProperty in HsconfPropertiesList) 157 | { 158 | bool isEncrypted = platformDBInfo.GetProperty(HsconfProperty).IsEncrypted; // checking if prop is encrypted 159 | 160 | if (isEncrypted) 161 | { 162 | _propValue = platformDBInfo.GetProperty(HsconfProperty).GetDecryptedValue(CryptoUtils.GetPrivateKeyFromFile("")); 163 | } 164 | else 165 | { 166 | _propValue = platformDBInfo.GetProperty(HsconfProperty).Value; 167 | } 168 | 169 | HsConfPropertiesVal.Add(HsconfProperty, _propValue); 170 | Console.WriteLine(HsconfProperty + " " + _propValue); 171 | } 172 | } 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/PlatformFilesHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace OSDiagTool.Platform { 6 | class PlatformFilesHelper { 7 | 8 | private static string appPoolConfigPath = @"%SYSTEMDRIVE%\inetpub\temp\appPools"; 9 | // OS services config files location changed in the below versions from the Platform installation folder to Platform/ 10 | private static Version schedulerConfPathChangeVersion = new Version("11.11.1"); 11 | private static Version deploymentConfPathChangeVersion = new Version("11.24.0"); 12 | private static Version compilerConfPathChangeVersion = new Version("11.25.0"); 13 | 14 | 15 | public static void CopyPlatformAndServerConfFiles(string _osInstallationFolder, string _iisApplicationHostPath, string _iisWebConfigPath, string _machineConfigPath, string _osPlatFilesDest, string osPlatformVersion) { 16 | 17 | string confFilePath = ""; 18 | Version platformVersion = new Version(osPlatformVersion); 19 | 20 | // List of OS services and components 21 | IDictionary osServiceNames = new Dictionary { 22 | { "ConfigurationTool", "Configuration Tool" }, 23 | { "LogServer", "Log Service" }, 24 | { "CompilerService", "Deployment Controller Service" }, 25 | { "DeployService", "Deployment Service" }, 26 | { "Scheduler", "Scheduler Service" }, 27 | }; 28 | 29 | if (!Program.osPlatformVersion.StartsWith("10.")) { 30 | osServiceNames.Add(@"Server.API\nlog", "Server API"); 31 | osServiceNames.Add(@"Server.Identity\nlog", "Server Identity"); 32 | } 33 | 34 | // Initialize dictionary with all the files that we need to get and can be accessed directly 35 | IDictionary files = new Dictionary { 36 | { "ServerHSConf", Path.Combine(_osInstallationFolder, "server.hsconf") }, 37 | { "OSVersion", Path.Combine(_osInstallationFolder, "version.txt") }, 38 | { "applicationHost.config", _iisApplicationHostPath }, 39 | { "machine.config", _machineConfigPath }, 40 | { "web.config", _iisWebConfigPath } 41 | }; 42 | 43 | // Add OS log and configuration files 44 | foreach (KeyValuePair serviceFileEntry in osServiceNames) { 45 | 46 | bool isNlogConfFile = serviceFileEntry.Key.ToLower().Contains(@"\nlog"); 47 | 48 | switch (serviceFileEntry.Key) 49 | { 50 | case @"Server.Identity\nlog": case @"Server.API\nlog": 51 | confFilePath = Path.Combine(_osInstallationFolder, serviceFileEntry.Key + ".config"); 52 | break; 53 | 54 | case "Scheduler": 55 | if (platformVersion.CompareTo(schedulerConfPathChangeVersion) >= 0) 56 | { 57 | confFilePath = Path.Combine(_osInstallationFolder, serviceFileEntry.Key, serviceFileEntry.Key + ".exe.config"); 58 | } else { goto default; }; 59 | break; 60 | 61 | case "CompilerService": 62 | if (platformVersion.CompareTo(compilerConfPathChangeVersion) >= 0) 63 | { 64 | confFilePath = Path.Combine(_osInstallationFolder, serviceFileEntry.Key, serviceFileEntry.Key + ".exe.config"); 65 | } 66 | else { goto default; }; 67 | break; 68 | 69 | case "DeployService": 70 | if (platformVersion.CompareTo(deploymentConfPathChangeVersion) >= 0) 71 | { 72 | confFilePath = Path.Combine(_osInstallationFolder, serviceFileEntry.Key, serviceFileEntry.Key + ".exe.config"); 73 | } 74 | else { goto default; }; 75 | break; 76 | 77 | default: 78 | confFilePath = Path.Combine(_osInstallationFolder, serviceFileEntry.Key + ".exe.config"); 79 | break; 80 | } 81 | 82 | // Get log file location from conf file 83 | OSServiceConfigFileParser confParser = new OSServiceConfigFileParser(serviceFileEntry.Value, confFilePath); 84 | 85 | string logPath = isNlogConfFile ? confParser.LogServerAPIAndIdentityFilePath : confParser.LogFilePath; 86 | 87 | // Add properties file 88 | files.Add(serviceFileEntry.Value + " config", confFilePath); 89 | 90 | // Add log file 91 | files.Add(serviceFileEntry.Value + " log", logPath); 92 | 93 | } 94 | 95 | // Copy all files to the temporary folder 96 | foreach (KeyValuePair fileEntry in files) { 97 | String filepath = fileEntry.Value; 98 | String fileAlias = fileEntry.Key; 99 | bool isNlogConfFile = false; 100 | 101 | if (filepath != null) { 102 | isNlogConfFile = filepath.ToLower().Contains("nlog.config"); 103 | } 104 | 105 | FileLogger.TraceLog("Copying " + fileAlias + "... "); 106 | if (File.Exists(filepath)) { 107 | String realFilename = isNlogConfFile ? Path.GetFileName(filepath) + "_" + fileAlias : Path.GetFileName(filepath); 108 | File.Copy(filepath, Path.Combine(_osPlatFilesDest, realFilename)); 109 | 110 | } else { 111 | FileLogger.TraceLog("(File does not exist)", true); 112 | } 113 | } 114 | 115 | // Export Environment variables 116 | foreach (System.Collections.DictionaryEntry env in Environment.GetEnvironmentVariables()) { 117 | string name = (string)env.Key; 118 | string value = (string)env.Value; 119 | 120 | Utils.WinUtils.WriteToFile(Path.Combine(_osPlatFilesDest, "EnvironmentVariables.txt"), name + ": " + value); 121 | 122 | } 123 | 124 | // Copy application pool configurations %SYSTEMDRIVE%\inetpub\temp\appPools 125 | FileSystemHelper fsHelper = new FileSystemHelper(); 126 | appPoolConfigPath = fsHelper.GetPathWithWindowsRoot(appPoolConfigPath); 127 | fsHelper.DirectoryCopy(appPoolConfigPath, Path.Combine(_osPlatFilesDest, "AppPoolConfigurations"), true, false); 128 | 129 | } 130 | 131 | 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /OSDiagTool/Platform/ConfigFiles/ConfigFileReader.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Linq; 2 | using System.IO; 3 | using System.Windows.Forms; 4 | 5 | namespace OSDiagTool.Platform.ConfigFiles 6 | { 7 | public class ConfigFileReader 8 | { 9 | public static string PlatformDatabaseConfigurationElement = "PlatformDatabaseConfiguration"; 10 | public static string LoggingDatabaseConfigurationElement = "LoggingDatabaseConfiguration"; 11 | public static string SessionDatabaseConfigurationElement = "SessionDatabaseConfiguration"; 12 | public static string ServiceConfigurationElement = "ServiceConfiguration"; // Read ServiceConfiguration element from server.hsconf 13 | public static string CacheConfigurationElement = "CacheInvalidationConfiguration"; // Read CacheInvalidationConfiguration element from server.hsconf 14 | public static string ServerConfigurationElement = "ServerConfiguration"; // Read ServerConfiguration element from server.hsconf 15 | 16 | public static string IsEncryptedAttributeName = "encrypted"; 17 | public static string ProviderKeyAttributeName = "ProviderKey"; 18 | 19 | public static bool dbLoggingAvailable = true; 20 | 21 | private ConfigFileInfo _dbPlatformDetails; 22 | private ConfigFileInfo _dbLoggingDetails; 23 | private ConfigFileInfo _dbSessionDetails; 24 | private ConfigFileInfo _serviceConfigurationDetails; 25 | private ConfigFileInfo _serverConfigurationDetails; 26 | private ConfigFileInfo _cacheConfigurationDetails; 27 | 28 | private string _configFilePath; 29 | 30 | public ConfigFileReader(string filepath, string osPlatformVersion) 31 | { 32 | _configFilePath = filepath; 33 | ReadFile(osPlatformVersion); 34 | } 35 | 36 | /* 37 | * Read the server.hsconf file and retrieve its sections 38 | */ 39 | private void ReadFile(string osPlatformVersion) 40 | { 41 | try 42 | { 43 | using (FileStream fs = File.OpenRead(_configFilePath)) 44 | { 45 | XElement root = XElement.Load(fs); 46 | _dbPlatformDetails = ReadDbPlatformInfo(root); 47 | if (!(osPlatformVersion.StartsWith("10."))) 48 | { 49 | _dbLoggingDetails = ReadDbLoggingInfo(root); 50 | } 51 | _dbSessionDetails = ReadDbSessionInfo(root); 52 | _serviceConfigurationDetails = ReadServiceConfigurationInfo(root); 53 | _serverConfigurationDetails = ReadServerConfigurationInfo(root); 54 | _cacheConfigurationDetails = ReadCacheConfigurationInfo(root); 55 | } 56 | } 57 | catch (System.IO.FileNotFoundException) 58 | { 59 | Application.Run(new OSDiagToolForm.puf_popUpForm(OSDiagToolForm.puf_popUpForm._feedbackErrorType, "Server.hsconf file not found.")); 60 | } 61 | } 62 | 63 | /* 64 | * Returns the ProviderKey attribute of an database configuration from server.hsconfig 65 | */ 66 | private string ReadDBMSType(XElement root, string dbType) 67 | { 68 | return root.Element(dbType).Attribute("ProviderKey").Value; 69 | } 70 | 71 | private ConfigFileInfo ReadDbPlatformInfo(XElement root) 72 | { 73 | return ReadSection(PlatformDatabaseConfigurationElement, root); 74 | } 75 | 76 | private ConfigFileInfo ReadDbLoggingInfo(XElement root) 77 | { 78 | try 79 | { 80 | return ReadSection(LoggingDatabaseConfigurationElement, root); 81 | } catch 82 | { 83 | dbLoggingAvailable = false; 84 | } 85 | return DBLoggingInfo; 86 | } 87 | 88 | private ConfigFileInfo ReadDbSessionInfo(XElement root) 89 | { 90 | return ReadSection(SessionDatabaseConfigurationElement, root); 91 | } 92 | 93 | private ConfigFileInfo ReadServiceConfigurationInfo(XElement root) 94 | { 95 | return ReadSection(ServiceConfigurationElement, root); 96 | } 97 | 98 | private ConfigFileInfo ReadServerConfigurationInfo(XElement root) 99 | { 100 | return ReadSection(ServerConfigurationElement, root); 101 | } 102 | 103 | private ConfigFileInfo ReadCacheConfigurationInfo(XElement root) 104 | { 105 | return ReadSection(CacheConfigurationElement, root); 106 | } 107 | 108 | private ConfigFileInfo ReadSection(string sectionName, XElement root) 109 | { 110 | // If we are unable to retrieve the ProviderKey value, then the readType should be empty 111 | string readType; 112 | try { 113 | readType = ReadDBMSType(root, sectionName); 114 | } catch { 115 | readType = ""; 116 | } 117 | 118 | ConfigFileInfo dbInfo = new ConfigFileInfo(sectionName, readType); 119 | 120 | foreach (XElement el in root.Element(sectionName).Elements()) 121 | { 122 | string elName = el.Name.LocalName; 123 | dbInfo.AddProperty(ReadProperty(root, sectionName, elName)); 124 | } 125 | 126 | return dbInfo; 127 | } 128 | 129 | // Reading property attributes 130 | private ConfigFileProperty ReadProperty(XElement root, string dbType, string parameter) 131 | { 132 | string value = root.Element(dbType).Element(parameter).Value; 133 | 134 | // If we are unable to retrieve the encrypted attribute's value, then isEncrypted should be set as false 135 | bool isEncrypted; 136 | try 137 | { 138 | isEncrypted = root.Element(dbType).Element(parameter).Attribute(IsEncryptedAttributeName).Value.Equals("true"); 139 | } catch { 140 | isEncrypted = false; 141 | } 142 | return new ConfigFileProperty(parameter, value, isEncrypted); 143 | } 144 | 145 | // PlatformDatabaseConfiguration section of the server.hsconfig 146 | public ConfigFileInfo DBPlatformInfo 147 | { 148 | get { return _dbPlatformDetails; } 149 | } 150 | 151 | // LoggingDatabaseConfiguration section of the server.hsconfig 152 | public ConfigFileInfo DBLoggingInfo 153 | { 154 | get { return _dbLoggingDetails; } 155 | } 156 | 157 | // SessionDatabaseConfiguration section of the server.hsconfig 158 | public ConfigFileInfo DBSessionInfo 159 | { 160 | get { return _dbSessionDetails; } 161 | } 162 | 163 | // ServiceConfiguration section of the server.hsconfig 164 | public ConfigFileInfo ServiceConfigurationInfo 165 | { 166 | get { return _serviceConfigurationDetails; } 167 | } 168 | 169 | // ServerConfiguration section of the server.hsconfig 170 | public ConfigFileInfo ServerConfigurationInfo 171 | { 172 | get { return _serverConfigurationDetails; } 173 | } 174 | 175 | // CacheInvalidationConfiguration section of the server.hsconfig 176 | public ConfigFileInfo CacheConfigurationInfo 177 | { 178 | get { return _cacheConfigurationDetails; } 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /OSDiagTool/DBConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Configuration; 7 | using System.Data.SqlClient; 8 | using System.Data.OracleClient; 9 | using System.Data; 10 | using System.IO; 11 | 12 | namespace OSDiagTool 13 | { 14 | class DBConnection 15 | { 16 | // Abstracted Reader that exports the returned result to a CSV-like file, where the separator character can be selected (for CSV use semi-colon ';' ) 17 | // Usage example: ExportToCsv(myReader, true, "myOutputFile.csv", ";") 18 | public static void ExportToCsv(IDataReader dataReader, bool includeHeaderAsFirstRow, string fileName, string separator) 19 | { 20 | 21 | StreamWriter streamWriter = new StreamWriter(fileName); 22 | 23 | StringBuilder sb = null; 24 | 25 | if (includeHeaderAsFirstRow) 26 | { 27 | sb = new StringBuilder(); 28 | for (int index = 0; index < dataReader.FieldCount; index++) 29 | { 30 | if (dataReader.GetName(index) != null) 31 | sb.Append(dataReader.GetName(index)); 32 | 33 | if (index < dataReader.FieldCount - 1) 34 | sb.Append(separator); 35 | } 36 | streamWriter.WriteLine(sb.ToString()); 37 | } 38 | 39 | while (dataReader.Read()) 40 | { 41 | sb = new StringBuilder(); 42 | for (int index = 0; index < dataReader.FieldCount; index++) 43 | { 44 | if (!dataReader.IsDBNull(index)) 45 | { 46 | string value = dataReader.GetValue(index).ToString(); 47 | if (dataReader.GetFieldType(index) == typeof(String)) 48 | { 49 | if (value.IndexOf("\"") >= 0) 50 | value = value.Replace("\"", "\"\""); 51 | 52 | if (value.IndexOf(separator) >= 0) 53 | value = "\"" + value + "\""; 54 | } 55 | sb.Append(value); 56 | } 57 | 58 | if (index < dataReader.FieldCount - 1) 59 | sb.Append(separator); 60 | } 61 | 62 | if (!dataReader.IsDBNull(dataReader.FieldCount - 1)) 63 | sb.Append(dataReader.GetValue(dataReader.FieldCount - 1).ToString().Replace(separator, " ")); 64 | 65 | streamWriter.WriteLine(sb.ToString()); 66 | } 67 | dataReader.Close(); 68 | streamWriter.Close(); 69 | } 70 | 71 | // SQL Server DB Connection String 72 | public static string SQLConnString(string dataSource, string initialCatalog, string userId, string pwd) 73 | { 74 | string connectionStringSQL = String.Format("Data Source={0};Initial Catalog={1};User id={2};Password={3};", dataSource, initialCatalog, userId, pwd); 75 | 76 | return connectionStringSQL; 77 | } 78 | 79 | // SQL Open Connection 80 | public static SqlConnection SQLOpenConnection(string dataSource, string initialCatalog, string userId, string pwd) 81 | { 82 | string connectionString = SQLConnString(dataSource, initialCatalog, userId, pwd); 83 | 84 | SqlConnection connection = new SqlConnection(connectionString); 85 | 86 | try 87 | { 88 | connection.Open(); 89 | return connection; 90 | } 91 | catch (Exception e) 92 | { 93 | SQLCloseConnection(connection); 94 | Console.WriteLine("Unable to open SQL DB connection" + e.Message); 95 | throw e; 96 | } 97 | } 98 | 99 | // SQL Reader 100 | public static void SQLReader(string dataSource, string initialCatalog, string userId, string pwd, string queryString) 101 | { 102 | SqlConnection connection = SQLOpenConnection(dataSource, initialCatalog, userId, pwd); 103 | 104 | using (connection) 105 | { 106 | SqlCommand command = new SqlCommand(queryString, connection); 107 | 108 | try 109 | { 110 | SqlDataReader reader = command.ExecuteReader(); 111 | while (reader.Read()) 112 | { 113 | // TODO: Implementation of query export to csv file in batches 114 | Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}", reader[0], reader[1], reader[2], reader[3], reader[4]); 115 | } 116 | reader.Close(); 117 | } 118 | catch (Exception e) 119 | { 120 | Console.WriteLine("Unable to read data from SQL DB: ", e); 121 | } 122 | finally 123 | { 124 | SQLCloseConnection(connection); 125 | } 126 | } 127 | } 128 | 129 | // SQL Close Connection 130 | public static void SQLCloseConnection(SqlConnection connection) 131 | { 132 | connection.Close(); 133 | } 134 | 135 | 136 | // Oracle DB Connection String 137 | public static string OracleConnString(string host, string port, string serviceName, string userId, string pwd) 138 | { 139 | string connectionStringORCL = String.Format("SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVICE_NAME={2})));uid = {3}; pwd = {4};", host, port, serviceName, userId, pwd); 140 | 141 | return connectionStringORCL; 142 | } 143 | 144 | // Oracle Open Connection 145 | public static OracleConnection OracleOpenConnection(string host, string port, string serviceName, string userId, string pwd) 146 | { 147 | string connectionString = OracleConnString(host, port, serviceName, userId, pwd); 148 | 149 | OracleConnection connection = new OracleConnection(connectionString); 150 | 151 | try 152 | { 153 | connection.Open(); 154 | return connection; 155 | } 156 | catch (Exception e) 157 | { 158 | OracleCloseConnection(connection); 159 | Console.WriteLine("Unable to retrieve Oracle DB Information" + e.Message); 160 | throw e; 161 | } 162 | } 163 | 164 | // Oracle Reader 165 | public static void OracleReader(string host, string port, string serviceName, string userId, string pwd, string queryString) 166 | { 167 | OracleConnection connection = OracleOpenConnection(host, port, serviceName, userId, pwd); 168 | 169 | using (connection) 170 | { 171 | OracleCommand command = new OracleCommand(queryString, connection); 172 | 173 | try 174 | { 175 | OracleDataReader reader = command.ExecuteReader(); 176 | while (reader.Read()) 177 | { 178 | // TODO: Implementation of query export to csv file in batches 179 | Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}", reader[0], reader[1], reader[2], reader[3], reader[4]); 180 | } 181 | reader.Close(); 182 | } 183 | catch (Exception e) 184 | { 185 | Console.WriteLine("Unable to read data from Oracle DB: ", e); 186 | } 187 | finally 188 | { 189 | OracleCloseConnection(connection); 190 | } 191 | } 192 | } 193 | 194 | // Oracle Close Connection 195 | public static void OracleCloseConnection(OracleConnection connection) 196 | { 197 | connection.Close(); 198 | } 199 | 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /OSDiagTool/Database/DatabaseQueries/DatabaseTroubleshoot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.SqlClient; 4 | using Oracle.ManagedDataAccess.Client; 5 | using OSDiagTool.DatabaseExporter; 6 | using OSDiagTool.OSDiagToolConf; 7 | 8 | namespace OSDiagTool.Database.DatabaseQueries { 9 | class DatabaseTroubleshoot { 10 | 11 | public static void DatabaseTroubleshooting(DatabaseType dbEngine, OSDiagToolConf.ConfModel.strConfModel configurations,string outputDestination, DBConnector.SQLConnStringModel SQLConnectionString = null, 12 | DBConnector.OracleConnStringModel OracleConnectionString = null) { 13 | 14 | // Needs user with sa permissions 15 | 16 | if (dbEngine.Equals(DatabaseType.SqlServer)) { 17 | 18 | List blockingAndBlockedSpids = new List(); 19 | 20 | int top_statCachedPlan = Convert.ToInt32(configurations.databaseQueryConfigurations[OSDiagToolConfReader._l3_sqlServer][OSDiagToolConfReader._l4_top_statCachedPlans]); 21 | int top_topCPU = Convert.ToInt32(configurations.databaseQueryConfigurations[OSDiagToolConfReader._l3_sqlServer][OSDiagToolConfReader._l4_top_topCPU]); 22 | 23 | var sqlDBQueries = new SQLServerQueries(); 24 | 25 | Dictionary sqlQueries = new Dictionary { // use same name as in the DatabaseQueries 26 | { "sessionsSp_Who2", sqlDBQueries.sessionsSp_Who2 }, 27 | { "sessionsSp_Who2_Blocked", sqlDBQueries.sessionsSp_Who2_Blocked }, 28 | { "statCachedPlan", string.Format(sqlDBQueries.statCachedPlans, top_statCachedPlan) }, 29 | { "costlyCPUQueries", string.Format(sqlDBQueries.costlyCPUQueries, top_topCPU) }, 30 | { "dbccInputBuffer", sqlDBQueries.dbccInputBuffer }, 31 | { "sessionsLocksTree", sqlDBQueries.sessionsLocksTree }, 32 | { "locksAssociatedResources", sqlDBQueries.locksAssociatedResources } 33 | }; 34 | 35 | var connector = new DBConnector.SLQDBConnector(); 36 | SqlConnection connection = connector.SQLOpenConnection(SQLConnectionString); 37 | 38 | using (connection) { 39 | 40 | foreach (KeyValuePair entry in sqlQueries) { 41 | 42 | if (!(entry.Key.Equals("sessionsSp_Who2_Blocked") || entry.Key.Equals("dbccInputBuffer"))) { // skip sp_who2_blocked and dbcc since it already exports the entire result set of sp_who2 43 | 44 | CSVExporter.SQLToCSVExport(dbEngine, entry.Key, outputDestination, configurations.queryTimeout, entry.Value, connection, null); 45 | 46 | } else if(entry.Key.Equals("sessionsSp_Who2_Blocked")) { 47 | 48 | SqlCommand cmd = new SqlCommand(entry.Value, connection) { 49 | CommandTimeout = configurations.queryTimeout 50 | }; 51 | 52 | SqlDataReader dr = cmd.ExecuteReader(); 53 | 54 | if (dr.HasRows) { 55 | 56 | while (dr.Read()) { 57 | 58 | blockingAndBlockedSpids.Add(dr.GetValue(0).ToString()); // add blockings spids to list 59 | blockingAndBlockedSpids.Add(dr.GetValue(1).ToString()); // add blocked spids to list 60 | 61 | } 62 | 63 | } 64 | 65 | } else if (entry.Key.Equals("dbccInputBuffer")) { 66 | 67 | if (!(blockingAndBlockedSpids.Count.Equals(0))) { // get sql text of blocked and blockig spids 68 | 69 | string allBlockedSpidsInline = string.Join(",", blockingAndBlockedSpids.ToArray()); 70 | string blockedSqlTextQuery = string.Format(entry.Value, allBlockedSpidsInline); 71 | 72 | CSVExporter.SQLToCSVExport(dbEngine, entry.Key, outputDestination, configurations.queryTimeout, blockedSqlTextQuery, connection, null); 73 | 74 | } 75 | } 76 | }; 77 | } 78 | 79 | 80 | } else if (dbEngine.Equals(Database.DatabaseType.Oracle)) { 81 | 82 | List orclSids = new List(); 83 | 84 | int orcl_TopCPU = Convert.ToInt32(configurations.databaseQueryConfigurations[OSDiagToolConfReader._l3_oracle][OSDiagToolConfReader._l4_top_topCPU]); 85 | 86 | var orclDBQueries = new OracleQueries(); 87 | 88 | Dictionary orclQueries = new Dictionary { // TODO: use reflection to get the property names 89 | { "orcl_lockedObjects", orclDBQueries.lockedObjects }, 90 | { "orcl_lockedObjects_2", orclDBQueries.lockedObjects_2 }, 91 | { "orcl_resourceLimit", orclDBQueries.resourceLimit }, 92 | { "orcl_sessionByIOType_Reads", string.Format(orclDBQueries.sessionByIOType, "DISK_READS") }, 93 | { "orcl_sessionByIOType_Writes", string.Format(orclDBQueries.sessionByIOType, "DIRECT_WRITES") }, 94 | { "orcl_tk_queriesRunningNow", orclDBQueries.tk_queriesRunningNow }, 95 | { "orcl_sqlTextBySID", orclDBQueries.sqlTextBySID }, 96 | { "orcl_sidInfo", orclDBQueries.sidInfo }, 97 | { "orcl_topCPUSqls", string.Format(orclDBQueries.topCPUSqls, orcl_TopCPU) } 98 | }; 99 | 100 | var connector = new DBConnector.OracleDBConnector(); 101 | OracleConnection connection = connector.OracleOpenConnection(OracleConnectionString); 102 | 103 | using (connection) { 104 | 105 | foreach (KeyValuePair entry in orclQueries) { 106 | 107 | if (!(entry.Key.Equals("orcl_lockedObjects") || (entry.Key.Equals("orcl_sessionByIOType_Writes") || (entry.Key.Equals("orcl_sessionByIOType_Reads") || (entry.Key.Equals("orcl_lockedObjects_2") || 108 | (entry.Key.Equals("orcl_sqlTextBySID") || (entry.Key.Equals("orcl_sidInfo")))))))) { // skip queries that we want to know more about the sessions 109 | 110 | CSVExporter.SQLToCSVExport(dbEngine, entry.Key, outputDestination, configurations.queryTimeout, entry.Value, null, connection); 111 | 112 | } else if (entry.Key.Equals("orcl_lockedObjects") || entry.Key.Equals("orcl_lockedObjects_2") || entry.Key.Equals("orcl_sessionByIOType_Reads") || entry.Key.Equals("orcl_sessionByIOType_Writes")) { 113 | 114 | OracleCommand cmd = new OracleCommand(entry.Value, connection) { 115 | CommandTimeout = configurations.queryTimeout 116 | }; 117 | 118 | OracleDataReader dr = cmd.ExecuteReader(); 119 | 120 | if (dr.HasRows) { 121 | 122 | while (dr.Read()) { 123 | 124 | orclSids.Add(dr.GetValue(0).ToString()); // add Sids to list 125 | 126 | } 127 | 128 | } 129 | 130 | CSVExporter.SQLToCSVExport(dbEngine, entry.Key, outputDestination, configurations.queryTimeout, entry.Value, null, connection); 131 | 132 | } else if (entry.Key.Equals("orcl_sidInfo") || entry.Key.Equals("orcl_sqlTextBySID")) { 133 | 134 | if (!(orclSids.Count.Equals(0))) { 135 | 136 | string allSidsInline = string.Join(",", orclSids.ToArray()); 137 | string sidsSqlTextQuery = string.Format(entry.Value, allSidsInline); 138 | 139 | CSVExporter.SQLToCSVExport(dbEngine, entry.Key, outputDestination, configurations.queryTimeout, sidsSqlTextQuery, null, connection); 140 | 141 | } 142 | 143 | } 144 | 145 | } 146 | 147 | } 148 | 149 | } 150 | 151 | 152 | 153 | 154 | 155 | } 156 | 157 | 158 | 159 | 160 | 161 | } 162 | } 163 | --------------------------------------------------------------------------------