cmd/scollector: mssql.agent.* for monitoring SQL Agent jobs #1855

Merged
merged 1 commit into from Aug 11, 2016

Conversation

Projects
None yet
2 participants
@gbrayut
Contributor

gbrayut commented Aug 8, 2016

No description provided.

@gbrayut

This comment has been minimized.

Show comment
Hide comment
@gbrayut

gbrayut Aug 8, 2016

Contributor

Ready for code review. Testing on ny-devbosun (see http://goo.gl/5GPH57 )

Contributor

gbrayut commented Aug 8, 2016

Ready for code review. Testing on ny-devbosun (see http://goo.gl/5GPH57 )

@gbrayut

This comment has been minimized.

Show comment
Hide comment
@gbrayut

gbrayut Aug 10, 2016

Contributor

one of the metrics had a wrong type (WMI said it was a counter but really was a gauge). Testing again overnight and should be ready to merge tomorrow if there are no issues.

Contributor

gbrayut commented Aug 10, 2016

one of the metrics had a wrong type (WMI said it was a counter but really was a gauge). Testing again overnight and should be ready to merge tomorrow if there are no issues.

+ label := "mssqlserver"
+ if w.Name != `SQLSERVERAGENT` {
+ q = instanceAgentWMIQuery(w.Name, q)
+ label = strings.ToLower(w.Name[8:len(w.Name)])

This comment has been minimized.

@kylebrandt

kylebrandt Aug 11, 2016

Member

Do you know that w.Name can not be shorter than 8?

@kylebrandt

kylebrandt Aug 11, 2016

Member

Do you know that w.Name can not be shorter than 8?

This comment has been minimized.

@gbrayut

gbrayut Aug 11, 2016

Contributor

yes, it is either SQLSERVERAGENT or SQLAgent$+Instance Name

@gbrayut

gbrayut Aug 11, 2016

Contributor

yes, it is either SQLSERVERAGENT or SQLAgent$+Instance Name

This comment has been minimized.

@gbrayut

gbrayut Aug 11, 2016

Contributor

ah does look like there is an off by one error though... should be 9. I'll wrap it in a length check too, since WMI sometimes goes crazy and returns default values like 0 / ""

@gbrayut

gbrayut Aug 11, 2016

Contributor

ah does look like there is an off by one error though... should be 9. I'll wrap it in a length check too, since WMI sometimes goes crazy and returns default values like 0 / ""

+}
+
+func instanceAgentWMIQuery(instancename string, wmiquery string) string {
+ var newname = strings.Replace(strings.Replace(instancename, `$`, "", 1), `_`, "", -1)

This comment has been minimized.

This comment has been minimized.

@gbrayut

gbrayut Aug 11, 2016

Contributor

These can't be cleaned here, as they are used to generate the WMI query. They should already be cleaned when they are used in the instance tag.

@gbrayut

gbrayut Aug 11, 2016

Contributor

These can't be cleaned here, as they are used to generate the WMI query. They should already be cleaned when they are used in the instance tag.

@gbrayut gbrayut changed the title from cmd/scollector: mssql.agent.jobs for monitoring SQL Agent jobs to cmd/scollector: mssql.agent.* for monitoring SQL Agent jobs Aug 11, 2016

@gbrayut gbrayut merged commit 895405b into master Aug 11, 2016

2 checks passed

bosun All checks Passed!
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gbrayut gbrayut deleted the mssql_agent_jobs branch Aug 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment