{"action":"created","comment":{"url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/comments/27254711","id":27254711,"diff_hunk":"@@ -15,35 +15,65 @@ func init() {\n \n func c_cpu_windows() (opentsdb.MultiDataPoint, error) {\n \tvar dst []Win32_PerfRawData_PerfOS_Processor\n-\tvar q = wmi.CreateQuery(&dst, `WHERE Name <> '_Total'`)\n+\tvar q = wmi.CreateQuery(&dst, \"\")\n \terr := queryWmi(q, &dst)\n \tif err != nil {\n \t\treturn nil, err\n \t}\n \tvar md opentsdb.MultiDataPoint\n \tvar used, num uint64\n+\tvar winCPUTotal *Win32_PerfRawData_PerfOS_Processor\n \tfor _, v := range dst {\n+\t\tif v.Name == \"_Total\" {\n+\t\t\twinCPUTotal = &v\n+\t\t\tcontinue\n+\t\t}\n \t\tts := TSys100NStoEpoch(v.Timestamp_Sys100NS)\n+\t\tmetricName := \"win.cpu\"\n \t\tnum++\n \t\t//Divide by 1e5 because: 1 seconds / 100 Nanoseconds = 1e7. This is the percent time as a decimal, so divide by two less zeros to make it the same as the result * 100.\n \t\tused += (v.PercentUserTime + v.PercentPrivilegedTime + v.PercentInterruptTime) / 1e5\n-\t\tAddTS(&md, \"win.cpu\", ts, v.PercentPrivilegedTime/1e5, opentsdb.TagSet{\"cpu\": v.Name, \"type\": \"privileged\"}, metadata.Counter, metadata.Pct, \"Percentage of non-idle processor time spent in privileged mode.\")\n-\t\tAddTS(&md, \"win.cpu\", ts, v.PercentInterruptTime/1e5, opentsdb.TagSet{\"cpu\": v.Name, \"type\": \"interrupt\"}, metadata.Counter, metadata.Pct, \"Percentage of time that the processor spent receiving and servicing hardware interrupts during the sample interval.\")\n-\t\tAddTS(&md, \"win.cpu\", ts, v.PercentUserTime/1e5, opentsdb.TagSet{\"cpu\": v.Name, \"type\": \"user\"}, metadata.Counter, metadata.Pct, \"Percentage of non-idle processor time spent in user mode.\")\n-\t\tAddTS(&md, \"win.cpu\", ts, v.PercentIdleTime/1e5, opentsdb.TagSet{\"cpu\": v.Name, \"type\": \"idle\"}, metadata.Counter, metadata.Pct, \"Percentage of time during the sample interval that the processor was idle.\")\n-\t\tAddTS(&md, \"win.cpu.interrupts\", ts, v.InterruptsPersec/1e5, opentsdb.TagSet{\"cpu\": v.Name}, metadata.Counter, metadata.Event, \"Average number of hardware interrupts that the processor is receiving and servicing in each second.\")\n-\t\tAdd(&md, \"win.cpu.dpcs\", v.DPCRate, opentsdb.TagSet{\"cpu\": v.Name}, metadata.Counter, metadata.Event, \"Rate at which deferred procedure calls (DPCs) are added to the processor DPC queue between the timer tics of the processor clock.\")\n-\t\tAddTS(&md, \"win.cpu.time_cstate\", ts, v.PercentC1Time/1e5, opentsdb.TagSet{\"cpu\": v.Name, \"type\": \"c1\"}, metadata.Counter, metadata.Pct, \"Percentage of time that the processor spends in the C1 low-power idle state, which is a subset of the total processor idle time.\")","path":"cmd/scollector/collectors/cpu_windows.go","position":29,"original_position":29,"commit_id":"9d79f255b4d799cd4a6721f59831748130fa0dd2","original_commit_id":"9d79f255b4d799cd4a6721f59831748130fa0dd2","user":{"login":"gbrayut","id":304401,"avatar_url":"https://avatars.githubusercontent.com/u/304401?v=3","gravatar_id":"","url":"https://api.github.com/users/gbrayut","html_url":"https://github.com/gbrayut","followers_url":"https://api.github.com/users/gbrayut/followers","following_url":"https://api.github.com/users/gbrayut/following{/other_user}","gists_url":"https://api.github.com/users/gbrayut/gists{/gist_id}","starred_url":"https://api.github.com/users/gbrayut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbrayut/subscriptions","organizations_url":"https://api.github.com/users/gbrayut/orgs","repos_url":"https://api.github.com/users/gbrayut/repos","events_url":"https://api.github.com/users/gbrayut/events{/privacy}","received_events_url":"https://api.github.com/users/gbrayut/received_events","type":"User","site_admin":false},"body":"Also there are actually like 7 CState levels, so we really just have a high level view anyway. If you  see something strange in the totals you would need to use a more detailed tool to troubleshoot further (or you just turn them off globally like we did)","created_at":"2015-03-26T20:52:24Z","updated_at":"2015-03-26T20:52:24Z","html_url":"https://github.com/bosun-monitor/bosun/pull/848#discussion_r27254711","pull_request_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848","_links":{"self":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/comments/27254711"},"html":{"href":"https://github.com/bosun-monitor/bosun/pull/848#discussion_r27254711"},"pull_request":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848"}}},"pull_request":{"url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848","id":32058609,"html_url":"https://github.com/bosun-monitor/bosun/pull/848","diff_url":"https://github.com/bosun-monitor/bosun/pull/848.diff","patch_url":"https://github.com/bosun-monitor/bosun/pull/848.patch","issue_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/848","number":848,"state":"open","locked":false,"title":"cmd/scollector: Add win.cpu_total metrics with pre-aggregated values.","user":{"login":"gbrayut","id":304401,"avatar_url":"https://avatars.githubusercontent.com/u/304401?v=3","gravatar_id":"","url":"https://api.github.com/users/gbrayut","html_url":"https://github.com/gbrayut","followers_url":"https://api.github.com/users/gbrayut/followers","following_url":"https://api.github.com/users/gbrayut/following{/other_user}","gists_url":"https://api.github.com/users/gbrayut/gists{/gist_id}","starred_url":"https://api.github.com/users/gbrayut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbrayut/subscriptions","organizations_url":"https://api.github.com/users/gbrayut/orgs","repos_url":"https://api.github.com/users/gbrayut/repos","events_url":"https://api.github.com/users/gbrayut/events{/privacy}","received_events_url":"https://api.github.com/users/gbrayut/received_events","type":"User","site_admin":false},"body":"Also move CState metrics to just _total since it is usually configured at a global level.\r\n\r\nFixes potential opentsdb aggregation issues #844 ","created_at":"2015-03-26T20:44:47Z","updated_at":"2015-03-26T20:52:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"672f2a9bffb1a7bff4f7f0225eca1971f9e5a35e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848/commits","review_comments_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848/comments","review_comment_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/848/comments","statuses_url":"https://api.github.com/repos/bosun-monitor/bosun/statuses/9d79f255b4d799cd4a6721f59831748130fa0dd2","head":{"label":"bosun-monitor:win_cpu_total","ref":"win_cpu_total","sha":"9d79f255b4d799cd4a6721f59831748130fa0dd2","user":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"repo":{"id":14410778,"name":"bosun","full_name":"bosun-monitor/bosun","owner":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bosun-monitor/bosun","description":"Time Series Alerting Framework","fork":false,"url":"https://api.github.com/repos/bosun-monitor/bosun","forks_url":"https://api.github.com/repos/bosun-monitor/bosun/forks","keys_url":"https://api.github.com/repos/bosun-monitor/bosun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosun-monitor/bosun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosun-monitor/bosun/teams","hooks_url":"https://api.github.com/repos/bosun-monitor/bosun/hooks","issue_events_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/events{/number}","events_url":"https://api.github.com/repos/bosun-monitor/bosun/events","assignees_url":"https://api.github.com/repos/bosun-monitor/bosun/assignees{/user}","branches_url":"https://api.github.com/repos/bosun-monitor/bosun/branches{/branch}","tags_url":"https://api.github.com/repos/bosun-monitor/bosun/tags","blobs_url":"https://api.github.com/repos/bosun-monitor/bosun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosun-monitor/bosun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosun-monitor/bosun/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosun-monitor/bosun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosun-monitor/bosun/statuses/{sha}","languages_url":"https://api.github.com/repos/bosun-monitor/bosun/languages","stargazers_url":"https://api.github.com/repos/bosun-monitor/bosun/stargazers","contributors_url":"https://api.github.com/repos/bosun-monitor/bosun/contributors","subscribers_url":"https://api.github.com/repos/bosun-monitor/bosun/subscribers","subscription_url":"https://api.github.com/repos/bosun-monitor/bosun/subscription","commits_url":"https://api.github.com/repos/bosun-monitor/bosun/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosun-monitor/bosun/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosun-monitor/bosun/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/comments{/number}","contents_url":"https://api.github.com/repos/bosun-monitor/bosun/contents/{+path}","compare_url":"https://api.github.com/repos/bosun-monitor/bosun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosun-monitor/bosun/merges","archive_url":"https://api.github.com/repos/bosun-monitor/bosun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosun-monitor/bosun/downloads","issues_url":"https://api.github.com/repos/bosun-monitor/bosun/issues{/number}","pulls_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls{/number}","milestones_url":"https://api.github.com/repos/bosun-monitor/bosun/milestones{/number}","notifications_url":"https://api.github.com/repos/bosun-monitor/bosun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosun-monitor/bosun/labels{/name}","releases_url":"https://api.github.com/repos/bosun-monitor/bosun/releases{/id}","created_at":"2013-11-15T00:12:27Z","updated_at":"2015-03-26T19:40:05Z","pushed_at":"2015-03-26T20:44:47Z","git_url":"git://github.com/bosun-monitor/bosun.git","ssh_url":"git@github.com:bosun-monitor/bosun.git","clone_url":"https://github.com/bosun-monitor/bosun.git","svn_url":"https://github.com/bosun-monitor/bosun","homepage":"http://bosun.org","size":24572,"stargazers_count":848,"watchers_count":848,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":157,"forks":93,"open_issues":157,"watchers":848,"default_branch":"master"}},"base":{"label":"bosun-monitor:master","ref":"master","sha":"ff10540da80125b344ce64c60db6b1cfda47d15a","user":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"repo":{"id":14410778,"name":"bosun","full_name":"bosun-monitor/bosun","owner":{"login":"bosun-monitor","id":9555242,"avatar_url":"https://avatars.githubusercontent.com/u/9555242?v=3","gravatar_id":"","url":"https://api.github.com/users/bosun-monitor","html_url":"https://github.com/bosun-monitor","followers_url":"https://api.github.com/users/bosun-monitor/followers","following_url":"https://api.github.com/users/bosun-monitor/following{/other_user}","gists_url":"https://api.github.com/users/bosun-monitor/gists{/gist_id}","starred_url":"https://api.github.com/users/bosun-monitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosun-monitor/subscriptions","organizations_url":"https://api.github.com/users/bosun-monitor/orgs","repos_url":"https://api.github.com/users/bosun-monitor/repos","events_url":"https://api.github.com/users/bosun-monitor/events{/privacy}","received_events_url":"https://api.github.com/users/bosun-monitor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bosun-monitor/bosun","description":"Time Series Alerting Framework","fork":false,"url":"https://api.github.com/repos/bosun-monitor/bosun","forks_url":"https://api.github.com/repos/bosun-monitor/bosun/forks","keys_url":"https://api.github.com/repos/bosun-monitor/bosun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosun-monitor/bosun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosun-monitor/bosun/teams","hooks_url":"https://api.github.com/repos/bosun-monitor/bosun/hooks","issue_events_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/events{/number}","events_url":"https://api.github.com/repos/bosun-monitor/bosun/events","assignees_url":"https://api.github.com/repos/bosun-monitor/bosun/assignees{/user}","branches_url":"https://api.github.com/repos/bosun-monitor/bosun/branches{/branch}","tags_url":"https://api.github.com/repos/bosun-monitor/bosun/tags","blobs_url":"https://api.github.com/repos/bosun-monitor/bosun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosun-monitor/bosun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosun-monitor/bosun/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosun-monitor/bosun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosun-monitor/bosun/statuses/{sha}","languages_url":"https://api.github.com/repos/bosun-monitor/bosun/languages","stargazers_url":"https://api.github.com/repos/bosun-monitor/bosun/stargazers","contributors_url":"https://api.github.com/repos/bosun-monitor/bosun/contributors","subscribers_url":"https://api.github.com/repos/bosun-monitor/bosun/subscribers","subscription_url":"https://api.github.com/repos/bosun-monitor/bosun/subscription","commits_url":"https://api.github.com/repos/bosun-monitor/bosun/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosun-monitor/bosun/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosun-monitor/bosun/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosun-monitor/bosun/issues/comments{/number}","contents_url":"https://api.github.com/repos/bosun-monitor/bosun/contents/{+path}","compare_url":"https://api.github.com/repos/bosun-monitor/bosun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosun-monitor/bosun/merges","archive_url":"https://api.github.com/repos/bosun-monitor/bosun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosun-monitor/bosun/downloads","issues_url":"https://api.github.com/repos/bosun-monitor/bosun/issues{/number}","pulls_url":"https://api.github.com/repos/bosun-monitor/bosun/pulls{/number}","milestones_url":"https://api.github.com/repos/bosun-monitor/bosun/milestones{/number}","notifications_url":"https://api.github.com/repos/bosun-monitor/bosun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosun-monitor/bosun/labels{/name}","releases_url":"https://api.github.com/repos/bosun-monitor/bosun/releases{/id}","created_at":"2013-11-15T00:12:27Z","updated_at":"2015-03-26T19:40:05Z","pushed_at":"2015-03-26T20:44:47Z","git_url":"git://github.com/bosun-monitor/bosun.git","ssh_url":"git@github.com:bosun-monitor/bosun.git","clone_url":"https://github.com/bosun-monitor/bosun.git","svn_url":"https://github.com/bosun-monitor/bosun","homepage":"http://bosun.org","size":24572,"stargazers_count":848,"watchers_count":848,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":157,"forks":93,"open_issues":157,"watchers":848,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848"},"html":{"href":"https://github.com/bosun-monitor/bosun/pull/848"},"issue":{"href":"https://api.github.com/repos/bosun-monitor/bosun/issues/848"},"comments":{"href":"https://api.github.com/repos/bosun-monitor/bosun/issues/848/comments"},"review_comments":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848/comments"},"review_comment":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bosun-monitor/bosun/pulls/848/commits"},"statuses":{"href":"https://api.github.com/repos/bosun-monitor/bosun/statuses/9d79f255b4d799cd4a6721f59831748130fa0dd2"}}}}