From: <do...@hy...> - 2008-05-13 19:14:26
|
Author: dougm Date: 2008-05-13 12:14:18 -0700 (Tue, 13 May 2008) New Revision: 9497 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=9497 Modified: trunk/plugins/vim/etc/vim-plugin.xml trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimCollector.java trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimUtil.java Log: refactor config options Modified: trunk/plugins/vim/etc/vim-plugin.xml =================================================================== --- trunk/plugins/vim/etc/vim-plugin.xml 2008-05-13 19:13:31 UTC (rev 9496) +++ trunk/plugins/vim/etc/vim-plugin.xml 2008-05-13 19:14:18 UTC (rev 9497) @@ -1,15 +1,27 @@ <plugin> - <!-- from netservices-plugin --> - <property name="hostname" value="esxhost"/> - <property name="port" value="443"/> - <config name="vi" include="sockaddr,credentials"/> + <config name="vi"> + <option name="url" + description="VI sdk url" + default="https://esx/sdk"/> + + <option name="user" + description="Username"/> + + <option name="pass" + type="secret" + description="Password"/> + + <option name="hostname" + description="ESX host name"/> + </config> + <platform name="VI Host"> <plugin type="measurement" class="org.hyperic.hq.product.MeasurementPlugin"/> <plugin type="collector" class="org.hyperic.hq.plugin.vim.VimHostCollector"/> - <property name="template" value="vim:${vi.config},Type=VIHost:${alias}"/> + <property name="template" value="${vi.template}:${alias}"/> <metric name="Availability" indicator="true"/> </platform> Modified: trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimCollector.java =================================================================== --- trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimCollector.java 2008-05-13 19:13:31 UTC (rev 9496) +++ trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimCollector.java 2008-05-13 19:14:18 UTC (rev 9497) @@ -30,6 +30,8 @@ public abstract class VimCollector extends Collector { + public static final String PROP_URL = "url"; + protected abstract void collect(VimServiceConnection conn) throws Exception; Modified: trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimUtil.java =================================================================== --- trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimUtil.java 2008-05-13 19:13:31 UTC (rev 9496) +++ trunk/plugins/vim/src/org/hyperic/hq/plugin/vim/VimUtil.java 2008-05-13 19:14:18 UTC (rev 9497) @@ -27,22 +27,18 @@ import java.util.Properties; -import org.hyperic.hq.product.Collector; - public class VimUtil { public static String getURL(Properties props) { - String host = props.getProperty(Collector.PROP_HOSTNAME); - String port = props.getProperty(Collector.PROP_PORT); - return "https://" + host + ":" + port + "/sdk"; + return props.getProperty(VimCollector.PROP_URL); } public static VimServiceConnection getServiceConnection(Properties props) throws Exception { String url = getURL(props); - String username = props.getProperty(Collector.PROP_USERNAME); - String password = props.getProperty(Collector.PROP_PASSWORD); + String username = props.getProperty(VimCollector.PROP_USERNAME); + String password = props.getProperty(VimCollector.PROP_PASSWORD); VimServiceConnection conn = new VimServiceConnection(); conn.connect(url, username, password); return conn; |