You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/04/28 11:17:32 UTC

[1/5] brooklyn-server git commit: WinRM feed (entity initialisers): add rebind tests

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 33abb3060 -> b7f13c147


WinRM feed (entity initialisers): add rebind tests

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b09c97f6
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b09c97f6
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b09c97f6

Branch: refs/heads/master
Commit: b09c97f697a8f707f36e6072a359ebdd2bcdb472
Parents: a6457a6
Author: Aled Sage <al...@gmail.com>
Authored: Thu Apr 27 13:02:45 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Apr 27 13:03:23 2017 +0100

----------------------------------------------------------------------
 .../feed/windows/WinRmCommandSensorTest.java    |  81 +++++++++++++++
 .../WindowsPerformanceCounterSensorsTest.java   | 102 +++++++++++++++++++
 2 files changed, 183 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b09c97f6/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmCommandSensorTest.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmCommandSensorTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmCommandSensorTest.java
new file mode 100644
index 0000000..dcadca0
--- /dev/null
+++ b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmCommandSensorTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.feed.windows;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.core.sensor.windows.WinRmCommandSensor;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class WinRmCommandSensorTest extends RebindTestFixtureWithApp {
+
+    private Location loc;
+    
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        loc = mgmt().getLocationManager().createLocation(LocationSpec.create(WinRmMachineLocation.class)
+                .configure("address", "1.2.3.4")
+                .configure(WinRmMachineLocation.WINRM_TOOL_CLASS, RecordingWinRmTool.class.getName()));
+        
+        RecordingWinRmTool.clear();
+    }
+
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        RecordingWinRmTool.clear();
+    }
+
+    @Test
+    public void testRebind() throws Exception {
+        RecordingWinRmTool.setCustomResponse(".*mycommand.*", new RecordingWinRmTool.CustomResponse(0, "myval", ""));
+        
+        Entity entity = app().createAndManageChild(EntitySpec.create(TestEntity.class)
+                .addInitializer(new WinRmCommandSensor<String>(ConfigBag.newInstance(ImmutableMap.of(
+                        WinRmCommandSensor.SENSOR_PERIOD, "1ms",
+                        WinRmCommandSensor.SENSOR_COMMAND, "mycommand",
+                        WinRmCommandSensor.SENSOR_NAME, "mysensor")))));
+        
+        app().start(ImmutableList.of(loc));
+
+        EntityAsserts.assertAttributeEqualsEventually(entity, Sensors.newStringSensor("mysensor"), "myval");
+        
+        rebind();
+        
+        RecordingWinRmTool.setCustomResponse(".*mycommand.*", new RecordingWinRmTool.CustomResponse(0, "myval2", ""));
+        EntityAsserts.assertAttributeEqualsEventually(entity, Sensors.newStringSensor("mysensor"), "myval2");
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b09c97f6/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterSensorsTest.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterSensorsTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterSensorsTest.java
new file mode 100644
index 0000000..5df4f5c
--- /dev/null
+++ b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterSensorsTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.feed.windows;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.core.sensor.windows.WindowsPerformanceCounterSensors;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+public class WindowsPerformanceCounterSensorsTest extends RebindTestFixtureWithApp {
+
+    @SuppressWarnings("unused")
+    private static final Logger log = LoggerFactory.getLogger(WindowsPerformanceCounterFeedTest.class);
+
+    private Location loc;
+    
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        loc = mgmt().getLocationManager().createLocation(LocationSpec.create(WinRmMachineLocation.class)
+                .configure("address", "1.2.3.4")
+                .configure(WinRmMachineLocation.WINRM_TOOL_CLASS, RecordingWinRmTool.class.getName()));
+        
+        RecordingWinRmTool.clear();
+    }
+
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        RecordingWinRmTool.clear();
+    }
+
+    @Test
+    public void testRebind() throws Exception {
+        String response = generateCounterReponse("mycounter", "myval");
+        RecordingWinRmTool.setCustomResponse(".*mycounter.*", new RecordingWinRmTool.CustomResponse(0, response, ""));
+                
+        Entity entity = app().createAndManageChild(EntitySpec.create(TestEntity.class)
+                .addInitializer(new WindowsPerformanceCounterSensors(ConfigBag.newInstance(ImmutableMap.of(
+                        WindowsPerformanceCounterSensors.PERIOD, "1ms",
+                        WindowsPerformanceCounterSensors.PERFORMANCE_COUNTERS, ImmutableSet.of(
+                                ImmutableMap.of(
+                                        "name", "mysensor",
+                                        "sensorType", java.lang.String.class.getName(), //FIXME
+                                        "counter", "\\mycounter")))))));
+        
+        app().start(ImmutableList.of(loc));
+        
+        EntityAsserts.assertAttributeEqualsEventually(entity, Sensors.newStringSensor("mysensor"), "myval");
+        
+        rebind();
+        
+        String response2 = generateCounterReponse("mycounter", "myval2");
+        RecordingWinRmTool.setCustomResponse(".*mycounter.*", new RecordingWinRmTool.CustomResponse(0, response2, ""));
+        EntityAsserts.assertAttributeEqualsEventually(entity, Sensors.newStringSensor("mysensor"), "myval2");
+    }
+    
+    private String generateCounterReponse(String counterName, String val) {
+        String firstPart = "\\\\machine.name\\" + counterName;
+        return new StringBuilder()
+                .append(firstPart)
+                .append(Strings.repeat(" ", 200 - (firstPart.length() + val.length())))
+                .append(val)
+                .toString();
+    }
+}


[5/5] brooklyn-server git commit: This closes #655

Posted by dr...@apache.org.
This closes #655


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b7f13c14
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b7f13c14
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b7f13c14

Branch: refs/heads/master
Commit: b7f13c147ce0eda5c5b66ff73056bcab26c60561
Parents: 33abb30 b09c97f
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Fri Apr 28 12:16:57 2017 +0100
Committer: Duncan Godwin <dr...@googlemail.com>
Committed: Fri Apr 28 12:16:57 2017 +0100

----------------------------------------------------------------------
 .../WindowsPerformanceCounterSensors.java       |  15 ++-
 .../feed/windows/RebinWinrmCmdFeedTest.java     |  38 -------
 .../feed/windows/RebindWinrmCmdFeedTest.java    |  38 +++++++
 .../feed/windows/WinRmCommandSensorTest.java    |  81 +++++++++++++++
 .../WindowsPerformanceCounterFeedTest.java      |  15 +--
 .../WindowsPerformanceCounterSensorsTest.java   | 102 +++++++++++++++++++
 6 files changed, 243 insertions(+), 46 deletions(-)
----------------------------------------------------------------------



[2/5] brooklyn-server git commit: WindowsPerformanceCounterFeedTest: code tidy

Posted by dr...@apache.org.
WindowsPerformanceCounterFeedTest: code tidy

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a6457a6f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a6457a6f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a6457a6f

Branch: refs/heads/master
Commit: a6457a6f7afec0e1bb60a08582b001b0599cacfb
Parents: 9f8163f
Author: Aled Sage <al...@gmail.com>
Authored: Thu Apr 27 13:01:48 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Apr 27 13:03:23 2017 +0100

----------------------------------------------------------------------
 .../windows/WindowsPerformanceCounterFeedTest.java   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6457a6f/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterFeedTest.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterFeedTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterFeedTest.java
index f77727e..5607a32 100644
--- a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterFeedTest.java
+++ b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WindowsPerformanceCounterFeedTest.java
@@ -26,7 +26,7 @@ import static org.testng.Assert.assertTrue;
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.EntitySpec;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
@@ -48,8 +48,11 @@ import com.google.common.collect.ImmutableSet;
 
 public class WindowsPerformanceCounterFeedTest extends BrooklynAppUnitTestSupport {
 
+    @SuppressWarnings("unused")
+    private static final Logger log = LoggerFactory.getLogger(WindowsPerformanceCounterFeedTest.class);
+
     private Location loc;
-    private EntityLocal entity;
+    private Entity entity;
 
     @BeforeMethod(alwaysRun=true)
     @Override
@@ -66,8 +69,6 @@ public class WindowsPerformanceCounterFeedTest extends BrooklynAppUnitTestSuppor
         super.tearDown();
     }
 
-    private static final Logger log = LoggerFactory.getLogger(WindowsPerformanceCounterFeedTest.class);
-
     @Test
     public void testIteratorWithSingleValue() {
         Iterator<?> iterator = new WindowsPerformanceCounterFeed
@@ -95,9 +96,9 @@ public class WindowsPerformanceCounterFeedTest extends BrooklynAppUnitTestSuppor
         AttributeSensor<Double> doubleSensor = Sensors.newDoubleSensor("baz.quux");
 
         Collection<WindowsPerformanceCounterPollConfig<?>> polls = ImmutableSet.<WindowsPerformanceCounterPollConfig<?>>of(
-                new WindowsPerformanceCounterPollConfig(stringSensor).performanceCounterName("\\processor information(_total)\\% processor time"),
-                new WindowsPerformanceCounterPollConfig(integerSensor).performanceCounterName("\\integer.sensor"),
-                new WindowsPerformanceCounterPollConfig(doubleSensor).performanceCounterName("\\double\\sensor\\with\\multiple\\sub\\paths")
+                new WindowsPerformanceCounterPollConfig<>(stringSensor).performanceCounterName("\\processor information(_total)\\% processor time"),
+                new WindowsPerformanceCounterPollConfig<>(integerSensor).performanceCounterName("\\integer.sensor"),
+                new WindowsPerformanceCounterPollConfig<>(doubleSensor).performanceCounterName("\\double\\sensor\\with\\multiple\\sub\\paths")
         );
 
         WindowsPerformanceCounterFeed.SendPerfCountersToSensors sendPerfCountersToSensors = new WindowsPerformanceCounterFeed.SendPerfCountersToSensors(entity, polls);


[3/5] brooklyn-server git commit: Rename RebinWinrmCmdFeedTest

Posted by dr...@apache.org.
Rename RebinWinrmCmdFeedTest


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0bcea04b
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0bcea04b
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0bcea04b

Branch: refs/heads/master
Commit: 0bcea04be47f8910c2fee9c0a725e9d0f2766258
Parents: accdf94
Author: Aled Sage <al...@gmail.com>
Authored: Thu Apr 27 13:00:53 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Apr 27 13:03:23 2017 +0100

----------------------------------------------------------------------
 .../feed/windows/RebinWinrmCmdFeedTest.java     | 38 --------------------
 .../feed/windows/RebindWinrmCmdFeedTest.java    | 38 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0bcea04b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebinWinrmCmdFeedTest.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebinWinrmCmdFeedTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebinWinrmCmdFeedTest.java
deleted file mode 100644
index dca9c01..0000000
--- a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebinWinrmCmdFeedTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.feed.windows;
-
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-import org.apache.brooklyn.core.mgmt.rebind.RebindAbstractCommandFeedTest;
-import org.testng.annotations.Test;
-
-public class RebinWinrmCmdFeedTest extends RebindAbstractCommandFeedTest {
-
-    @Test
-    public void testSshFeed_2017_04() throws Exception {
-        addMemento(BrooklynObjectType.FEED, "winrm-cmd-feed", "a8pno3muco");
-        rebind();
-    }
-
-    @Test
-    public void testSshFeed_2017_04_withoutBundlePrefixes() throws Exception {
-        addMemento(BrooklynObjectType.FEED, "winrm-cmd-feed-no-bundle-prefixes", "akc24nlh2k");
-        rebind();
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0bcea04b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebindWinrmCmdFeedTest.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebindWinrmCmdFeedTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebindWinrmCmdFeedTest.java
new file mode 100644
index 0000000..cb63b39
--- /dev/null
+++ b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/RebindWinrmCmdFeedTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.feed.windows;
+
+import org.apache.brooklyn.api.objs.BrooklynObjectType;
+import org.apache.brooklyn.core.mgmt.rebind.RebindAbstractCommandFeedTest;
+import org.testng.annotations.Test;
+
+public class RebindWinrmCmdFeedTest extends RebindAbstractCommandFeedTest {
+
+    @Test
+    public void testSshFeed_2017_04() throws Exception {
+        addMemento(BrooklynObjectType.FEED, "winrm-cmd-feed", "a8pno3muco");
+        rebind();
+    }
+
+    @Test
+    public void testSshFeed_2017_04_withoutBundlePrefixes() throws Exception {
+        addMemento(BrooklynObjectType.FEED, "winrm-cmd-feed-no-bundle-prefixes", "akc24nlh2k");
+        rebind();
+    }
+}


[4/5] brooklyn-server git commit: Adds WindowsPerformanceCounterSensors.period

Posted by dr...@apache.org.
Adds WindowsPerformanceCounterSensors.period

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9f8163f9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9f8163f9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9f8163f9

Branch: refs/heads/master
Commit: 9f8163f9f7ff3d753d2212733d3b353a29a893af
Parents: 0bcea04
Author: Aled Sage <al...@gmail.com>
Authored: Thu Apr 27 13:01:25 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Apr 27 13:03:23 2017 +0100

----------------------------------------------------------------------
 .../windows/WindowsPerformanceCounterSensors.java    | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9f8163f9/software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WindowsPerformanceCounterSensors.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WindowsPerformanceCounterSensors.java b/software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WindowsPerformanceCounterSensors.java
index f5c2271..1d59796 100644
--- a/software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WindowsPerformanceCounterSensors.java
+++ b/software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WindowsPerformanceCounterSensors.java
@@ -30,6 +30,7 @@ import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.feed.windows.WindowsPerformanceCounterFeed;
 import org.apache.brooklyn.util.core.config.ConfigBag;
 import org.apache.brooklyn.util.text.Strings;
+import org.apache.brooklyn.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,12 +40,23 @@ public class WindowsPerformanceCounterSensors implements EntityInitializer {
 
     private static final Logger LOG = LoggerFactory.getLogger(WindowsPerformanceCounterSensors.class);
 
-    public final static ConfigKey<Set<Map<String, String>>> PERFORMANCE_COUNTERS = ConfigKeys.newConfigKey(new TypeToken<Set<Map<String, String>>>(){}, "performance.counters");
+    @SuppressWarnings("serial")
+    public final static ConfigKey<Set<Map<String, String>>> PERFORMANCE_COUNTERS = ConfigKeys.newConfigKey(
+            new TypeToken<Set<Map<String, String>>>(){}, 
+            "performance.counters");
+
+    public final static ConfigKey<Duration> PERIOD = ConfigKeys.newConfigKey(
+            Duration.class, 
+            "period",
+            "poll period",
+            Duration.seconds(30));
 
     protected final Set<Map<String, String>> sensors;
+    protected final Duration period;
 
     public WindowsPerformanceCounterSensors(ConfigBag params) {
         sensors = params.get(PERFORMANCE_COUNTERS);
+        period = params.get(PERIOD);
     }
 
     public WindowsPerformanceCounterSensors(Map<String, String> params) {
@@ -54,6 +66,7 @@ public class WindowsPerformanceCounterSensors implements EntityInitializer {
     @Override
     public void apply(EntityLocal entity) {
         WindowsPerformanceCounterFeed.Builder builder = WindowsPerformanceCounterFeed.builder()
+                .period(period)
                 .entity(entity);
         for (Map<String, String> sensorConfig : sensors) {
             String name = sensorConfig.get("name");