Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
edchapel committed Sep 9, 2013
2 parents 79204df + 2c88e57 commit 60bb61e
Show file tree
Hide file tree
Showing 11 changed files with 295 additions and 63 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,58 @@ In a new connection to each individual Azure SQL Database:
GRANT VIEW DATABASE STATE TO NewRelicUser
GO

## Proxy Support ##

When the plugin is installed behind a proxy, there are a few configuration options.

**Default Proxy**

Assuming the proxy is configured at the system level (Internet Options in Control Panel), just uncomment the default configuration so that it reads as follows:

<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="True" bypassonlocal="True" />
</defaultProxy>
</system.net>

This configuration may be used with the username and password in the next section.

If you are upgrading from version 1.0.8 or earlier, you'll need to add that snippet to the config.

**Authenticated Proxy**

Ensure the above `defaultProxy` configuration is in place before setting the credentials. The New Relic .NET SDK requires that you uncomment the default configuration and set the username and password as below:

<appSettings>
<add key="proxyUsername" value="OFFICE\jdoe"/>
<add key="proxyPassword" value="p@ssw0rd"/>
</appSettings>

When specifying the username and password, you *must* configure the default proxy seen immediately above. The domain name before the user is optional.

If you are upgrading from version 1.0.8 or earlier, you'll need to add that snippet to the config.

**Authenticated Proxy with Proxy URL**

The authenticated proxy with specified URL is a bit of a mix of the previous two settings. It is also mutually exclusive to the previous proxy setting. First, ensure the `<appSettings>` contain the proxy URL, username, and password:

<appSettings>
<!-- The proxyAddress can be a url or an IP address. The port is required after the colon. -->
<add key="proxyAddress" value="http://www.urlOrIpAddress.com:5503"/>
<add key="proxyUsername" value="jdoe"/>
<add key="proxyPassword" value="p@ssw0rd"/>
</appSettings>

Then the proxy handler must be configured. This is *similar* to the previous proxy config above:

<system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type="NewRelic.Platform.Binding.DotNET.Proxy, NewRelic.Platform.Binding.DotNET"/>
</defaultProxy>
</system.net>

If you have any questions regarding the expected look of the config file, please review the [latest source on GitHub](https://github.com/newrelic-platform/newrelic_microsoft_sqlserver_plugin/blob/develop/src/NewRelic.Microsoft.SqlServer.Plugin/app.config).


## Logging

Expand Down
2 changes: 1 addition & 1 deletion build/versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<MajorVersion>1</MajorVersion>
<MinorVersion>0</MinorVersion>
<PatchVersion>8</PatchVersion>
<PatchVersion>9</PatchVersion>

<BuildQuality></BuildQuality>
</PropertyGroup>
Expand Down
Binary file modified lib/NewRelic.Platform.Binding.DotNET.dll
Binary file not shown.
Binary file modified lib/NewRelic.Platform.Binding.DotNET.pdb
Binary file not shown.
6 changes: 3 additions & 3 deletions src/Common/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.8")]
[assembly: AssemblyFileVersion("1.0.8")]
[assembly: AssemblyInformationalVersion("1.0.8")]
[assembly: AssemblyVersion("1.0.9")]
[assembly: AssemblyFileVersion("1.0.9")]
[assembly: AssemblyInformationalVersion("1.0.9")]
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
using NUnit.Framework;
using log4net;

using NewRelic.Microsoft.SqlServer.Plugin.Properties;

using log4net;
using NUnit.Framework;

namespace NewRelic.Microsoft.SqlServer.Plugin.Configuration
{
[TestFixture]
public class Log4NetTests
{
[Test]
public void AssertCanFindLog4NetConfig()
{
Program.SetUpLogConfig();
var logger = LogManager.Exists(Constants.SqlMonitorLogger);
Assert.That(logger, Is.Not.Null, "Couldn't Find Logger with name '{0}'", Constants.SqlMonitorLogger);
}
}
[TestFixture]
public class Log4NetTests
{
[Test]
public void AssertCanFindLog4NetConfig()
{
Program.SetUpLogConfig();
ILog logger = LogManager.Exists(Constants.SqlMonitorLogger);
Assert.That(logger, Is.Not.Null, "Couldn't Find Logger with name '{0}'", Constants.SqlMonitorLogger);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@
<Compile Include="TestHelper.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Configuration\app.config" />
<None Include="app.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<EmbeddedResource Include="Configuration\Configuration.app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
36 changes: 36 additions & 0 deletions src/NewRelic.Microsoft.SqlServer.Plugin.Tests/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>

<configuration>
<configSections>
<section name="newRelic" type="NewRelic.Microsoft.SqlServer.Plugin.Configuration.NewRelicConfigurationSection, NewRelic.Microsoft.SqlServer.Plugin" />
</configSections>
<appSettings>
<add key="proxyUsername" value="user1"/>
<add key="proxyPassword" value="p@ssword"/>
</appSettings>
<newRelic>
<service licenseKey="FooGuid" pollIntervalSeconds="45" serviceName="NewRelicSqlPlugin" />
<sqlServers>
<sqlServer name="Local" connectionString="Server=.;Database=master;Trusted_Connection=True;" includeSystemDatabases="true">
<includes>
<database name="Northwind" displayName="Southbreeze"/>
</includes>
</sqlServer>
<sqlServer name="Important Server" connectionString="Server=192.168.10.123,1234;Database=master;User Id=foo;Password=bar;">
<excludes>
<database name="foo"/>
<database name="bar"/>
</excludes>
</sqlServer>
</sqlServers>
<azure>
<database name="CloudFtw" connectionString="Server=zzz,1433;Database=CloudFtw;User ID=NewRelic;Password=aaa;Trusted_Connection=false;Encrypt=true;Connection Timeout=30;" />
</azure>
</newRelic>

<system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type="NewRelic.Platform.Binding.DotNET.Proxy, NewRelic.Platform.Binding.DotNET"/>
</defaultProxy>
</system.net>
</configuration>
159 changes: 116 additions & 43 deletions src/NewRelic.Microsoft.SqlServer.Plugin/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,76 @@
<configSections>
<section name="newRelic" type="NewRelic.Microsoft.SqlServer.Plugin.Configuration.NewRelicConfigurationSection, NewRelic.Microsoft.SqlServer.Plugin" />
</configSections>

<appSettings>
<!--
Proxy Settings [Optional] - See Network Settings below for further explaination
proxyAddress [Optional when using proxy with default credentials off]
Defines the address of the target proxy
proxyUsername [Required when using proxy with default credentials off]
Defines the username to log onto the proxy. This name can be prefixed with the
appropriate domain for example "OFFICE\jsmith"
proxyPassword [Required when using proxy with default credentials off]
Defines the password for the above account, used when initiating a request through the proxy
-->
<!--
<add key="proxyAddress" value="http://www.proxyaddress:5503"/>
<add key="proxyUsername" value="OFFICE\jdoe"/>
<add key="proxyPassword" value="p@ssw0rd"/>
-->
</appSettings>
<newRelic>
<!--
licenseKey [Required]
==========
Specify your New Relic license key.
######
licenseKey [Required]
==========
Specify your New Relic license key.
######
pollIntervalSeconds [Default: 60]
======
Specify the frequency of the polling in seconds.
######
-->
pollIntervalSeconds [Default: 60]
======
Specify the frequency of the polling in seconds.
######
-->
<service licenseKey="YOUR_KEY_HERE" pollIntervalSeconds="60" />
<!-- List of SQL Server instances. Server 2008, 2008 R2, and 2012 supported. -->
<sqlServers>
<!--
name [Required]
==========
Unique (within this set) name of the SQL Server to be monitored. This name appears on the New Relic dashboard.
##########
name [Required]
==========
Unique (within this set) name of the SQL Server to be monitored. This name appears on the New Relic dashboard.
##########
connectionString [Required]
======
Connection string to the SQL Server.
######
connectionString [Required]
======
Connection string to the SQL Server.
######
includeSystemDatabases [Optional]
======
Indicates if the system databases (tempdb, master, model, msdb) should be included in metric gathering.
Defaults to false
######
-->
includeSystemDatabases [Optional]
======
Indicates if the system databases (tempdb, master, model, msdb) should be included in metric gathering.
Defaults to false
######
sqlServer can contain the following elements:
Include OR Exclude database from metric gathering reporting
includes [Optional]
==========
Contains a set of database elements that define explicitly which databases will be included in metric gathering.
excludes [Optional]
==========
Contains a set of database elements that define explicitly which databases will be excluded from metric gathering.
########
includes or excludes should contain a collection of database elements in the following format
<database name="fooDB"/>
-->
<sqlServer name="Production Database" connectionString="Server=.\SQLExpress;Database=master;Trusted_Connection=True;" includeSystemDatabases="false">
<!-- Include OR exclude database from metric gathering reporting.-->
<!-- includes [Optional]: Contains a set of database elements that define explicitly which databases will be included in metric gathering. -->
Expand All @@ -53,30 +91,65 @@
<!-- List of Azure SQL databases. One per Azure SQL Database, not per Azure SQL Server. -->
<azure>
<!--
name [Required]
==========
Unique (within this set) name of the Azure SQL Databases to be monitored. This name appears on the New Relic dashboard.
##########
name [Required]
==========
Unique (within this set) name of the Azure SQL Databases to be monitored. This name appears on the New Relic dashboard.
##########
connectionString [Required]
======
Connection string to the Azure SQL Database.
######
-->
connectionString [Required]
======
Connection string to the Azure SQL Database.
######
-->
<database name="Azure Cloud Database"
connectionString="Server=tcp:{Azure SQL Server Name}.database.windows.net,1433;Database={Azure SQL Database Name};User ID={Azure SQL User Name}@{Azure SQL Server Name};Password={Password for User Name};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" />
</azure>
</newRelic>
<!-- When behind a proxy, use the following configuration to allow the agent to report metrics to New Relic. -->
<!-- <system.net>-->
<!-- <defaultProxy enabled="true" useDefaultCredentials="true">-->
<!-- Use only one of the following settings as appropriate for your proxy. -->

<!--
Network Settings
================
These settings are optional, but necessary to make the plugin work in environments that use a proxy server to communicate with the outside world.
Example 1 - default credentials
If the host machine is already configured to use the proxy and the credentials under which the plugin Windows Service is running can access the proxy,
Then all you have to do is tell the app to use the default proxy settings like so:
-->
<!--
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="True" bypassonlocal="True" />
</defaultProxy>
</system.net>
-->
<!--
Example 2 - alternate credentials
If the proxy requires login credentials different from those under which the plugin Windows Service is running, you will need to the following configuration.
The configuration below, tells the app to use our custom Proxy provider that will get its credential information from the "proxyUsername" and "proxyPassword" appSettings
-->
<!--
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type="NewRelic.Platform.Binding.DotNET.Proxy, NewRelic.Platform.Binding.DotNET"/>
</defaultProxy>
</system.net>
-->
<!--
Which will also require that you add proxyUsername and proxyPassword to <appSettings> at the top of the file.
In addition you can optionally specify to use any proxy address by setting proxyAddress (leaving this off, the plugin will use the proxy address used configured in Windows internet options)
For example these values could be:
<add key="proxyUsername" value="OFFICE\jdoe"/>
<add key="proxyPassword" value="p@ssw0rd"/>
And if you so desire:
<add key="proxyAddress" value="http://www.proxyaddress:5503"/>
-->

<!-- Uses the system default, as configured in 'Internet Options'. -->
<!-- <proxy usesystemdefault="true" />-->

<!-- Use a specific proxy. -->
<!-- <proxy proxyaddress="http://111.222.333.444:8080"/>-->
<!-- </defaultProxy>-->
<!-- </system.net>-->
</configuration>
Loading

0 comments on commit 60bb61e

Please sign in to comment.