Skip to content

Commit 282feed

Browse files
authored
Merge pull request #12 from newrelic/bm-dev
Blue Medora Delivery
2 parents 389130e + b8a5598 commit 282feed

120 files changed

Lines changed: 79812 additions & 317 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
bin
10+
11+
# Architecture specific extensions/prefixes
12+
*.[568vq]
13+
[568vq].out
14+
15+
*.cgo1.go
16+
*.cgo2.c
17+
_cgo_defun.c
18+
_cgo_gotypes.go
19+
_cgo_export.*
20+
21+
_testmain.go
22+
23+
*.exe
24+
*.test
25+
*.prof
26+
*.DS_STORE
27+
28+
/integrations/*/bin/
29+
coverage.xml
30+
target/
31+
# Vim swap
32+
[._]*.s[a-w][a-z]
33+
[._]s[a-w][a-z]
34+
35+
# Vim session
36+
Session.vim
37+
38+
# VSCode
39+
.vscode
40+
debug

CHANGELOG.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
9-
### Added
10-
- X
11-
12-
### Changed
13-
- X
14-
15-
### Removed
16-
- X
17-
18-
## 0.1.0 - 2018-08-13
8+
## 0.1.0 - 2018-09-20
199
### Added
2010
- Initial version: Includes Metrics and Inventory data

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2018, Blue Medora Inc.
2+
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
6+
Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
11+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
12+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
13+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ validate-all: deps
4646

4747
compile: deps
4848
@echo "=== $(INTEGRATION) === [ compile ]: Building $(BINARY_NAME)..."
49-
@go build -o bin/$(BINARY_NAME) $(GO_FILE)
49+
@go build -o bin/$(BINARY_NAME) $(GO_FILES)
5050

5151
compile-only: deps-only
5252
@echo "=== $(INTEGRATION) === [ compile ]: Building $(BINARY_NAME)..."
53-
@go build -o bin/$(BINARY_NAME) $(GO_FILE)
53+
@go build -o bin/$(BINARY_NAME) $(GO_FILES)
5454

5555
test: deps
5656
@echo "=== $(INTEGRATION) === [ test ]: Running unit tests..."
57-
@gocov test $(GO_FILES)... | gocov-xml > coverage.xml
57+
@gocov test -race $(GO_FILES)... | gocov-xml > coverage.xml
5858

5959
# Include thematic Makefiles
6060
include Makefile-*.mk

Makefile-docker.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
DOCKER_IMAGE := golang:1.9
2+
INTEGRATION_DIR := nri-$(INTEGRATION)
3+
4+
docker-fmt:
5+
@echo "=== $(INTEGRATION) === [ docker-fmt ]: Running gofmt in Docker..."
6+
@echo "Using Docker image $(DOCKER_IMAGE)"
7+
@docker run -it --rm -v $(PWD):/go/src/github.com/newrelic/$(INTEGRATION_DIR) -w /go/src/github.com/newrelic/$(INTEGRATION_DIR) $(DOCKER_IMAGE) "gofmt" "-s" "-w" "."
8+
9+
docker-make:
10+
@echo "=== $(INTEGRATION) === [ docker-fmt ]: Running make in Docker..."
11+
@echo "Using Docker image $(DOCKER_IMAGE)"
12+
@docker run -it --rm -v $(PWD):/go/src/github.com/newrelic/$(INTEGRATION_DIR) -w /go/src/github.com/newrelic/$(INTEGRATION_DIR) $(DOCKER_IMAGE) "make"
13+
14+
.PHONY: docker-fmt docker-make

README.md

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,75 @@
11
# New Relic Infrastructure Integration for Microsoft SQL Server
22

3-
Reports status and metrics for nri-mssql service
3+
The New Relic Infrastructure Integration for MS SQL Server captures critical performance metrics and inventory reported by a SQL Server Instance. Data on the SQL Server Instance and Databases is collected.
4+
5+
Inventory and metric data is collected via SQL queries to the Instance.
46

57
## Requirements
68

7-
Document if the Integration has some special requirement. Ex: Installing an
8-
extra module, permissions to execute a binary, etc.
9+
No additional requirements to monitor.
910

1011
## Configuration
1112

12-
Document if the Integration needs some configuration for running. Ex: Set
13-
up permissions, add a special user, etc.
13+
A user with the necessary permissions to collect all the metrics and inventory can be configured as follows
14+
15+
```
16+
USE master;
17+
CREATE LOGIN newrelic WITH PASSWORD = 'tmppassword';
18+
CREATE USER newrelic FOR LOGIN newrelic;
19+
GRANT CONNECT SQL TO newrelic;
20+
GRANT VIEW SERVER STATE TO newrelic;
21+
22+
-- Goes through each user database and adds public permissions
23+
DECLARE @name NVARCHAR(max)
24+
DECLARE db_cursor CURSOR FOR
25+
SELECT NAME
26+
FROM master.dbo.sysdatabases
27+
WHERE NAME NOT IN ('master','msdb','tempdb','model')
28+
OPEN db_cursor
29+
FETCH NEXT FROM db_cursor INTO @name WHILE @@FETCH_STATUS = 0
30+
BEGIN
31+
EXECUTE('USE "' + @name + '"; CREATE USER newrelic FOR LOGIN newrelic;' );
32+
FETCH next FROM db_cursor INTO @name
33+
END
34+
CLOSE db_cursor
35+
DEALLOCATE db_cursor
36+
```
1437

1538
## Installation
1639

17-
Describe the installation process for the Integration.
40+
- download an archive file for the `MSSQL` Integration
41+
- extract `mssql-definition.yml` and `/bin` directory into `/var/db/newrelic-infra/newrelic-integrations`
42+
- add execute permissions for the binary file `nr-mssql` (if required)
43+
- extract `mssql-config.yml.sample` into `/etc/newrelic-infra/integrations.d`
1844

1945
## Usage
2046

21-
Document mandatory and optional arguments for running the Integration, and how to execute it.
47+
This is the description about how to run the MSSQL Integration with New Relic Infrastructure agent, so it is required to have the agent installed (see [agent installation](https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/installation/install-infrastructure-linux)).
48+
49+
In order to use the MSSQL Integration it is required to configure `mssql-config.yml.sample` file. Firstly, rename the file to `mssql-config.yml`. Then, depending on your needs, specify all instances that you want to monitor. Once this is done, restart the Infrastructure agent.
50+
51+
You can view your data in Insights by creating your own custom NRQL queries. To do so use the **MssqlDatabaseSample**, **MssqlInstanceSample** event type.
2252

2353
## Compatibility
2454

25-
* Supported OS:
26-
* nri-mssql versions:
27-
* Edition:
55+
* Supported OS: No Limitations
56+
* MS SQL Server versions: SQL Server 2008 R2+
2857

2958
## Integration Development usage
3059

31-
Describe the development workflow for this Integration.
60+
Assuming that you have source code you can build and run the MSSQL Integration locally.
61+
62+
* Go to directory of the MSSQL Integration and build it
63+
```bash
64+
$ make
65+
```
66+
* The command above will execute tests for the MSSQL Integration and build an executable file called `nr-mssql` in `bin` directory.
67+
```bash
68+
$ ./bin/nr-mssql
69+
```
70+
* If you want to know more about usage of `./nr-mssql` check
71+
```bash
72+
$ ./bin/nr-mssql -help
73+
```
74+
75+
For managing external dependencies [govendor tool](https://github.com/kardianos/govendor) is used. It is required to lock all external dependencies to specific version (if possible) into vendor directory.

bin/nr-mssql

-2.94 MB
Binary file not shown.

coverage.xml

Lines changed: 0 additions & 92 deletions
This file was deleted.

mssql-config.yml.sample

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
integration_name: com.newrelic.mssql
2+
3+
instances:
4+
- name: mssql-server
5+
command: all_data
6+
arguments:
7+
hostname: <Host name or IP address of the SQl Server>
8+
username: <Microsoft SQL Server connection user name>
9+
password: <Microsoft SQL Server connection password>
10+
instance: <The Microsoft SQL Server instance to connect to. Use do not supply port if this is specified>
11+
port: <Microsoft SQL Server port to connect to. Only needed when instance not specified>
12+
enable_ssl: <true or false. Indicates if SSL encryption should be used>
13+
trust_server_certificate: <true or false. If true server certificate is not verified for SSL. If false certificate will be verified against supplied certificate>
14+
certificate_location: <Location of the SSL Certificate. Do not specify if trust_server_certificate is set to true>
15+
timeout: <Timeout in seconds for a single SQL Query Execution. Set 0 for no timeout>
16+
labels:
17+
env: production
18+
role: mssql
Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,14 @@
66
# refer to the Integrations SDK documentation:
77
# https://docs.newrelic.com/docs/integrations/integrations-sdk/file-specifications
88

9-
name: com.newrelic.nri-mssql
10-
description: Reports status and metrics for nri-mssql service
9+
name: com.newrelic.mssql
10+
description: Reports status and metrics for MSSQL service
1111
protocol_version: 1
1212
os: linux
1313

1414
commands:
1515
all_data:
1616
command:
17-
- ./bin/nr-nri-mssql
18-
interval: 15
19-
metrics:
20-
command:
21-
- ./bin/nr-nri-mssql
22-
- --metrics
23-
interval: 15
24-
inventory:
25-
command:
26-
- ./bin/nr-nri-mssql
27-
- --inventory
28-
prefix: config/nr-nri-mssql
29-
interval: 15
30-
events:
31-
command:
32-
- ./bin/nr-nri-mssql
33-
- --events
17+
- ./bin/nr-mssql
18+
prefix: config/mssql
3419
interval: 15

0 commit comments

Comments
 (0)