Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9e8a043
Added option to periodically check for new instances
andrewpaine Sep 1, 2015
ec5808b
PHX-3831 - don't send empty payload when no events
andrewpaine Feb 24, 2016
b0476d7
PHX-3836. Add IP address to common attributes
andrewpaine Feb 24, 2016
892911e
Update app.config
Mar 11, 2016
e94c263
Merge pull request #1 from Createor/patch-1
bspindler Mar 15, 2016
07931c2
Merge branch 'develop'
andrewpaine Mar 17, 2016
f100a9b
PHX-3997 Corrected typo in default sql metric name
andrewpaine Mar 17, 2016
be76b97
Merge remote-tracking branch 'origin/master'
andrewpaine Mar 18, 2016
00a5941
PHX-4221 - combine events of the same type into one event. PHX-4222, …
andrewpaine Mar 31, 2016
098c4c0
PHX-4108 Added initial read of all performance counters on every refr…
andrewpaine Apr 4, 2016
7b4ba9f
PHX-4283 Added IIS/.Net metrics
andrewpaine Apr 7, 2016
ad61b8c
PHX-4282 Added shutdown code support
andrewpaine Apr 8, 2016
2446032
Adding CONTRIBUTING.md
Apr 12, 2016
9c473f7
Merge pull request #2 from Netuitive/add-contributing
Apr 12, 2016
7a1819e
Merge remote-tracking branch 'refs/remotes/origin/master' into update…
Apr 28, 2016
6bbbb06
Updating README.md
Apr 28, 2016
6d3d03e
PHX-4221 increase detail recorded in aggregated event
andrewpaine May 2, 2016
8ae9b7f
Merge branch 'master' of ssh://github.com/Netuitive/collectdwin
andrewpaine May 2, 2016
d3ee9c7
Readme update, contributing.md format update
May 3, 2016
6161a29
Merge pull request #3 from Netuitive/update-docs
May 10, 2016
41d157a
Reduced log level for missing metrics and attributes from error to wa…
andrewpaine May 12, 2016
f03c1de
Added interval multiplier to ReadWindowsEventsPlugin to allow longer …
andrewpaine May 12, 2016
abbc5e6
Made regex Instance expressions require an exact match where given
andrewpaine May 12, 2016
d93562f
Merge pull request #4 from Netuitive/PHX-4560
andrewpaine May 12, 2016
4a93d9f
PHX-5183 catch parse exception when getting EC2 metadata in case behi…
andrewpaine Jul 19, 2016
986f83d
Merge pull request #5 from Netuitive/feature/PHX-5183
andrewpaine Jul 19, 2016
eb42676
PHX-5202 corrected logging of write time
andrewpaine Jul 19, 2016
a878351
Typo
andrewpaine Jul 19, 2016
e6569de
Merge pull request #6 from Netuitive/feature/PHX-5202
andrewpaine Jul 19, 2016
133bc59
PHX-3009 added human readably ram attribute
andrewpaine Jul 19, 2016
d918f69
Made ram suffix consistent with server element
andrewpaine Jul 19, 2016
40130a6
Merge pull request #7 from Netuitive/feature/PHX-3009
andrewpaine Jul 19, 2016
b16cf46
PHX-5224 Added configuration option to disable IP address attribute
andrewpaine Jul 19, 2016
84b6edc
PHX-5226 initialise event tags with empty array
andrewpaine Jul 19, 2016
2b27026
Merge pull request #9 from Netuitive/bugfix/PHX-5226
andrewpaine Jul 19, 2016
c9358c6
Merge pull request #8 from Netuitive/feature/PHX-5224
andrewpaine Jul 19, 2016
6a01a7f
Upped build version
andrewpaine Jul 20, 2016
970f602
Another version numbering test
andrewpaine Jul 20, 2016
c9944ef
Added Event IDs to error logs for visibility in EventViewer
andrewpaine Jul 20, 2016
be54999
PHX-5032 sanitise metric FQNs
andrewpaine Jul 21, 2016
b6e019f
Merge pull request #10 from Netuitive/feature/PHX-5032
andrewpaine Jul 21, 2016
23b36a2
PHX-5032 replace spaces with underscores
andrewpaine Jul 21, 2016
7148e7f
Update README.md
rbellary-vi Feb 9, 2021
f3d9af3
Update README.md
rbellary-vi Feb 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Contributing to the Netuitive Windows Agent
==========================================
Contributions are welcome and can be represented in many different ways as noted below. Help is
greatly appreciated and credit will always be given.


Types of Contributions
------------------------------

### Reporting Bugs
Report bugs on [the issues page](https://github.com/Netuitive/collectdwin/issues).
With your bug report, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting the issue.
- Detailed steps to reproduce the bug.

### Fixing bugs
Find bugs at [the issues page](https://github.com/Netuitive/collectdwin/issues). Anything tagged with
"bug" is open to be fixed.
With your fix, please include:
- The issue number
- A detailed commit message

### Implementing Features
Find features at [the issues page](https://github.com/Netuitive/collectdwin/issues). Anything tagged
with "feature" is open to be implemented.
With your feature, please include:
- The issue number
- A detailed commit message

### Writing Documentation
The Netuitive Windows Agent can always use documentation (more documentation is always better!).
Please document your features or usage as part of the official docs/wiki, in docstrings,
in blog posts, articles, or wherever you see fit.

### Submitting Feedback
File an issue at [the issues page](https://github.com/Netuitive/collectdwin/issues).
If you are proposing a feature:
- Explain how it would work in detail
- Keep the scope as narrow as possible to make it easier to implement

Workflow
------------------------------

1. Create a branch directly in this repo or a fork (if you don't have push access). Please name
branches within this repository `feature/<description>` or `fix/description`. For example,
something like `feature/upgrade_agent_0.2.3-70`.

1. Create an issue or open a pull request (PR). If you aren't sure your PR will solve the issue
or may be controversial, we're okay with you opening an issue separately and linking to it in
your PR. That way, if the PR is not accepted, the issue will remain and be tracked.

1. Clone the fork/branch locally.

1. Close (and reference) issues by the `closes #XXX` or `fixes #XXX` notation in the commit
message. Please use a descriptive, useful commit message that could be used to understand why a
particular change was made.

1. Keep pushing commits to the initial branch using `--amend`/`--rebase` as necessary. Don't mix
unrelated issues in a single branch.

1. Clean up the branch (rebase with master to synchronize, squash, edit commits, test, etc.) to
prepare for it to be merged.

1. If you didn't open a pull request already, do so now.

1. After reviewing your commits for documentation, passed continuous integration (CI) tests,
version bumps, changelogs, and good, descriptive commit messages, a project maintainer can merge your request.

1. Create/update the changelog if necessary.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#Netuitive-CollectdWin
CloudWisdom Windows Agent
========================

CollectdWin is a MS Windows service which collects, aggregates and publishes windows performance counters and attributes. CollectdWin is similar in concept and design to Collectd (https://collectd.org).
The CloudWisdom Windows Agent leverages CollectdWin to collect, aggregate, and publish windows performance counters and attributes to CloudWisdom. It is designed to expose crucial metrics from your Windows machines and display them in a meaningful way in [CloudWisdom](https://www.virtana.com/products/cloudwisdom/).

This version was forked to add Write Netuitive and other plugins.
See the [Virtana Windows agent docs](https://docs.virtana.com/en/windows-agent.html) or the [wiki](../../wiki) for more information, or contact Netuitive support at [cloudwisdom.support@virtana.com](mailto:cloudwisdom.support@virtana.com).

Changes to CollectdWin
-----------------------

The base functionality of CollectdWin remains in our fork: exposing windows performance counters for collection and monitoring. The CloudWisdom Windows Agent diverges from CollectdWin by extending the collection to non-numeric values such as attributes, events, and relationships. Netuitive created plugins to read Windows events and attributes as well as plugins to write to [CloudWisdom](https://www.virtana.com/products/cloudwisdom/) and [StatsD](https://github.com/etsy/statsd). Netuitive also changed the underlying framework to support collection and representation of elements of different types and metrics from remote sources.

For more info, see the [wiki](../../wiki)
29 changes: 5 additions & 24 deletions src/CollectdWinService/CollectableValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ internal class EventValue : CollectableValue
public long Id { get; set; }
public string Message { get; set; }
public string Level { get; set; }
public string Title { get; set; }
public long Timestamp { get; set; }
private const string JSON_FORMAT = @"{{""level"": ""{0}"", ""source"":""{1}"", ""message"":""{2}"", ""timestamp"": {3} }}";
private const string JSON_FORMAT = @"{{""level"": ""{0}"", ""source"":""{1}"", ""title"":""{2}"", ""message"":""{3}"", ""timestamp"": {4} }}";

public EventValue(string hostname, long timestamp, int nLevel, string message, long id)
public EventValue(string hostname, long timestamp, int nLevel, string title, string message, long id)
{
Level = EventValue.levelToString(nLevel);
Timestamp = timestamp;
Title = title;
Message = message;
HostName = hostname;
Id = id;
Expand All @@ -154,27 +156,6 @@ public EventValue(string hostname, long timestamp, int nLevel, string message, l
TypeInstanceName = "";
}

public static int levelToInt(string level)
{
switch (level)
{
case "CRITICAL":
return 1;
case "ERROR":
return 2;
case "WARN":
return 3;
case "WARNING":
return 3;
case "INFO":
return 4;
case "DEBUG":
return 5;
default: // not specified
return -1;
}
}

public static string levelToString(int level)
{
switch (level)
Expand Down Expand Up @@ -210,7 +191,7 @@ public override bool Equals(object obj)

public override string getJSON()
{
return string.Format(JSON_FORMAT, Level, HostName, Message, Timestamp*1000);
return string.Format(JSON_FORMAT, Level, HostName, Title, Message, Timestamp*1000);
}

}
Expand Down
3 changes: 3 additions & 0 deletions src/CollectdWinService/CollectdWinService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public CollectdWinService()

protected override void OnStart(string[] args)
{
// Request additional service startup time. Configuring the metrics can take a little while
RequestAdditionalTime(30000);

StartService(args);
}

Expand Down
1 change: 1 addition & 0 deletions src/CollectdWinService/CollectdWinService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Aggregator.cs" />
<Compile Include="ErrorCodes.cs" />
<Compile Include="WriteAmqpPlugin.cs" />
<Compile Include="CollectableValue.cs" />
<Compile Include="config\WriteAmqpPluginConfig.cs" />
Expand Down
16 changes: 16 additions & 0 deletions src/CollectdWinService/ErrorCodes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BloombergFLP.CollectdWin
{
public static class ErrorCodes
{
public static readonly int ERROR_READ_EXCEEDED_CYCLE_TIME = 1;
public static readonly int ERROR_WRITE_EXCEEDED_CYCLE_TIME = 2;
public static readonly int ERROR_EXCEEDED_MAX_QUEUE_LENGTH = 3;
public static readonly int ERROR_UNHANDLED_EXCEPTION = 4;
public static readonly int ERROR_CONFIGURATION_EXCEPTION = 5;
}
}
48 changes: 37 additions & 11 deletions src/CollectdWinService/MetricsCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public MetricsCollector()
var config = ConfigurationManager.GetSection("CollectdWinConfig") as CollectdWinConfig;
if (config == null)
{
Logger.Error("Cannot get configuration section");
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Cannot get configuration section");
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_CONFIGURATION_EXCEPTION);
Logger.Log(logEvent);
return;
}

Expand Down Expand Up @@ -140,7 +142,10 @@ private void ReadThreadProc()
_collectedValueQueue.Dequeue();
if ((++numMetricsDropped%1000) == 0)
{
Logger.Error("Number of metrics dropped : {0}", numMetricsDropped);
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Exceeded max queue length");
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_EXCEEDED_MAX_QUEUE_LENGTH);
Logger.Log(logEvent);
Logger.Warn("Number of metrics dropped : {0}", numMetricsDropped);
}
}
}
Expand All @@ -151,18 +156,28 @@ private void ReadThreadProc()
double revisedInterval = (_interval - elapsed) * 1000;
if (revisedInterval / _interval < 0.1)
{
Logger.Error("Read thread took {0} seconds out of {1} second cycle", elapsed, _interval);
Logger.Warn("Read thread took {0} seconds out of {1} second cycle", elapsed, _interval);
}
if (revisedInterval > 0)
Thread.Sleep((int)revisedInterval);
else
{
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Read thread exceeded cycle time");
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_READ_EXCEEDED_CYCLE_TIME);
Logger.Log(logEvent);
}

}
catch (ThreadInterruptedException)
{
Logger.Info("Read thread interrupted");
}
catch (Exception exp)
{
Logger.Error("ReadThreadProc() got exception : ", exp);
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Exception in ReadThreadProc()");
logEvent.Exception = exp;
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_UNHANDLED_EXCEPTION);
Logger.Log(logEvent);
Thread.Sleep(_interval * 1000);
}
}
Expand Down Expand Up @@ -216,17 +231,22 @@ private void WriteThreadProc()
}
}
}
double writeEnd = Util.GetNow();
Logger.Info("Written {0} values in {1:0.00}s", numValues, (writeEnd - writeStart));

double writeEnd = Util.GetNow();
double elapsed = writeEnd - writeStart;
double revisedInterval = (_interval - elapsed) * 1000;

if (revisedInterval / _interval < 0.1)
{
Logger.Error("Write thread took {0} seconds out of {1} second cycle", elapsed, _interval);
Logger.Warn("Write thread took {0} seconds out of {1} second cycle", elapsed, _interval);
}
if (revisedInterval > 0)
if (revisedInterval >= 0)
Thread.Sleep((int)revisedInterval);
else
{
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Write thread exceeded cycle time");
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_WRITE_EXCEEDED_CYCLE_TIME);
Logger.Log(logEvent);
}

}
catch (ThreadInterruptedException)
Expand All @@ -235,7 +255,10 @@ private void WriteThreadProc()
}
catch (Exception exp)
{
Logger.Error("WriteThreadProc() got exception : ", exp);
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Exception in WriteThreadProc()");
logEvent.Exception = exp;
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_UNHANDLED_EXCEPTION);
Logger.Log(logEvent);
Thread.Sleep(_interval * 1000);
}
}
Expand All @@ -258,7 +281,10 @@ private void AggregatorThreadProc()
}
catch (Exception exp)
{
Logger.Error("AggregatorThreadProc() got exception : ", exp);
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Exception in AggregatorThreadProc()");
logEvent.Exception = exp;
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_UNHANDLED_EXCEPTION);
Logger.Log(logEvent);
}
}
Logger.Trace("AggregatorThreadProc() return");
Expand Down
8 changes: 6 additions & 2 deletions src/CollectdWinService/PluginRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public PluginRegistry()
var config = ConfigurationManager.GetSection("CollectdWinConfig") as CollectdWinConfig;
if (config == null)
{
Logger.Error("Cannot get configuration section");
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Cannot get configuration section");
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_CONFIGURATION_EXCEPTION);
Logger.Log(logEvent);
return;
}
foreach (PluginConfig pluginConfig in
Expand All @@ -37,7 +39,9 @@ public IList<ICollectdPlugin> CreatePlugins()
Type classType = Type.GetType(entry.Value);
if (classType == null)
{
Logger.Error("Cannot create plugin:{0}, class:{1}", entry.Key, entry.Value);
LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, String.Format("Cannot create plugin:{0}, class:{1}", entry.Key, entry.Value));
logEvent.Properties.Add("EventID", ErrorCodes.ERROR_CONFIGURATION_EXCEPTION);
Logger.Log(logEvent);
continue;
}
var plugin = (ICollectdPlugin) Activator.CreateInstance(classType);
Expand Down
2 changes: 1 addition & 1 deletion src/CollectdWinService/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("0.6.*")]
[assembly: AssemblyVersion("0.7.1.*")]
Loading