You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(927) |
Apr
(419) |
May
(352) |
Jun
(431) |
Jul
(463) |
Aug
(345) |
Sep
(304) |
Oct
(596) |
Nov
(466) |
Dec
(414) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(348) |
Feb
(313) |
Mar
(665) |
Apr
(688) |
May
(434) |
Jun
(311) |
Jul
(540) |
Aug
(554) |
Sep
(467) |
Oct
(341) |
Nov
(365) |
Dec
(272) |
2009 |
Jan
(386) |
Feb
(293) |
Mar
(279) |
Apr
(239) |
May
(229) |
Jun
(199) |
Jul
(186) |
Aug
(111) |
Sep
(196) |
Oct
(146) |
Nov
(116) |
Dec
(140) |
2010 |
Jan
(170) |
Feb
(159) |
Mar
(151) |
Apr
(161) |
May
(90) |
Jun
(56) |
Jul
(28) |
Aug
(22) |
Sep
(5) |
Oct
|
Nov
(23) |
Dec
(12) |
2011 |
Jan
(8) |
Feb
(8) |
Mar
(22) |
Apr
(24) |
May
(4) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@hy...> - 2010-04-09 07:53:48
|
Author: bob Date: 2010-04-09 00:53:39 -0700 (Fri, 09 Apr 2010) New Revision: 14491 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14491 Modified: trunk/etc/version.properties Log: Release 4.3.0 build #1403 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-04-09 03:54:51 UTC (rev 14490) +++ trunk/etc/version.properties 2010-04-09 07:53:39 UTC (rev 14491) @@ -1,3 +1,3 @@ -#Thu Apr 08 00:17:36 PDT 2010 +#Fri Apr 09 00:17:24 PDT 2010 version=4.3.0 -build=1402 +build=1403 |
From: <no...@gi...> - 2010-04-09 04:50:38
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: 4fb92c47a53f93810321872f56548f250179f760 http://github.com/hyperic/hqapi/commit/4fb92c47a53f93810321872f56548f250179f760 Author: pnguyen <pnguyen@192.168.1.66> Date: 2010-04-08 (Thu, 08 Apr 2010) Changed paths: M ChangeLog M hqu/hqapi1/app/ControlController.groovy M src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlAction_test.java M src/org/hyperic/hq/hqapi1/test/ControlAction_test.java M src/org/hyperic/hq/hqapi1/test/ControlExecute_test.java M src/org/hyperic/hq/hqapi1/test/ControlHistory_test.java M src/org/hyperic/hq/hqapi1/test/ControlTestBase.java M src/org/hyperic/hq/hqapi1/test/GroupControlExecute_test.java M src/org/hyperic/hq/hqapi1/test/GroupControlHistory_test.java M src/org/hyperic/hq/hqapi1/test/HQApiTestBase.java Log Message: ----------- Add support to execute control actions for compatible groups. Functionality added primarily to do integration testing for HQ-2080. |
From: <pn...@hy...> - 2010-04-09 03:55:00
|
Author: pnguyen Date: 2010-04-08 20:54:51 -0700 (Thu, 08 Apr 2010) New Revision: 14490 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14490 Modified: trunk/src/org/hyperic/hq/hqu/rendit/metaclass/ResourceCategory.groovy Log: [HQ-2080] Add HQApi support to execute group control actions. Functionality added primarily for integration testing. Modified: trunk/src/org/hyperic/hq/hqu/rendit/metaclass/ResourceCategory.groovy =================================================================== --- trunk/src/org/hyperic/hq/hqu/rendit/metaclass/ResourceCategory.groovy 2010-04-09 03:46:06 UTC (rev 14489) +++ trunk/src/org/hyperic/hq/hqu/rendit/metaclass/ResourceCategory.groovy 2010-04-09 03:54:51 UTC (rev 14490) @@ -215,7 +215,11 @@ */ static void runAction(Resource r, AuthzSubject user, String action, String arguments) { - cMan.doAction(user, r.entityId, action, arguments) + if (r.entityId.isGroup()) { + cMan.doGroupAction(user, r.entityId, action, arguments, null) + } else { + cMan.doAction(user, r.entityId, action, arguments) + } } static boolean isGroup(Resource r) { |
From: <pn...@hy...> - 2010-04-09 03:46:15
|
Author: pnguyen Date: 2010-04-08 20:46:06 -0700 (Thu, 08 Apr 2010) New Revision: 14489 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14489 Modified: trunk/src/org/hyperic/hq/control/server/session/ControlHistoryDAO.java trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java Log: [HQ-2080] Use get() instead of findById() to improve error handling when the control history record cannot be found Modified: trunk/src/org/hyperic/hq/control/server/session/ControlHistoryDAO.java =================================================================== --- trunk/src/org/hyperic/hq/control/server/session/ControlHistoryDAO.java 2010-04-09 03:41:19 UTC (rev 14488) +++ trunk/src/org/hyperic/hq/control/server/session/ControlHistoryDAO.java 2010-04-09 03:46:06 UTC (rev 14489) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -44,6 +44,10 @@ return (ControlHistory)super.findById(id); } + public ControlHistory get(Integer id) { + return (ControlHistory)super.get(id); + } + void save(ControlHistory entity) { super.save(entity); } Modified: trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java 2010-04-09 03:41:19 UTC (rev 14488) +++ trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java 2010-04-09 03:46:06 UTC (rev 14489) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2009], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -552,13 +552,19 @@ } // Update the control history - try { - ControlHistoryDAO historyLocalHome = getControlHistoryDAO(); - Integer pk = new Integer(id); - cLocal = historyLocalHome.findById(pk); - } catch (ObjectNotFoundException e) { - // We know the ID, this won't happen - throw new SystemException(e); + ControlHistoryDAO historyLocalHome = getControlHistoryDAO(); + Integer pk = new Integer(id); + cLocal = historyLocalHome.get(pk); + + if (cLocal == null) { + // We know the ID, this should not happen + throw new SystemException( + "Failure getting control history id=" + id + + ". Could not update history {status=" + status + + ", startTime=" + startTime + + ", endTime=" + endTime + + ", message=" + msg + + "}"); } cLocal.setStatus(status); |
From: <pn...@hy...> - 2010-04-09 03:41:29
|
Author: pnguyen Date: 2010-04-08 20:41:19 -0700 (Thu, 08 Apr 2010) New Revision: 14488 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14488 Modified: trunk/src/org/hyperic/hq/control/server/session/ControlJob.java trunk/src/org/hyperic/hq/control/server/session/ControlScheduleManagerEJBImpl.java Log: [HQ-2080] Control action for a resource (non-group) intended for immediate execution no longer use the Quartz scheduler. Modified: trunk/src/org/hyperic/hq/control/server/session/ControlJob.java =================================================================== --- trunk/src/org/hyperic/hq/control/server/session/ControlJob.java 2010-04-08 19:15:40 UTC (rev 14487) +++ trunk/src/org/hyperic/hq/control/server/session/ControlJob.java 2010-04-09 03:41:19 UTC (rev 14488) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2008], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -27,24 +27,10 @@ import java.util.Date; -import javax.ejb.CreateException; -import javax.naming.NamingException; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hyperic.hq.agent.AgentConnectionException; -import org.hyperic.hq.agent.AgentRemoteException; -import org.hyperic.hq.appdef.shared.AgentNotFoundException; import org.hyperic.hq.appdef.shared.AppdefEntityID; -import org.hyperic.hq.appdef.shared.AppdefEntityNotFoundException; -import org.hyperic.hq.appdef.shared.PlatformManagerUtil; import org.hyperic.hq.authz.server.session.AuthzSubject; -import org.hyperic.hq.common.SystemException; -import org.hyperic.hq.control.agent.client.ControlCommandsClient; -import org.hyperic.hq.control.agent.client.ControlCommandsClientFactory; -import org.hyperic.hq.control.shared.ControlConstants; -import org.hyperic.hq.control.shared.ControlScheduleManagerLocal; -import org.hyperic.hq.control.shared.ControlScheduleManagerUtil; import org.hyperic.hq.product.PluginException; import org.hyperic.hq.scheduler.server.session.BaseJob; @@ -77,83 +63,10 @@ String args) throws PluginException { - long startTime = System.currentTimeMillis(); - ControlHistory commandHistory = null; - String errorMsg = null; - Integer groupId = (gid != null) ? gid.getId() : null; - - try { - ControlCommandsClient client = - ControlCommandsClientFactory.getInstance().getClient(id); - String pluginName = id.toString(); - String productName = PlatformManagerUtil.getLocalHome().create() - .getPlatformPluginName(id); - - ControlScheduleManagerLocal cLocal = - ControlScheduleManagerUtil.getLocalHome().create(); - - // Regular command - - commandHistory = - cLocal.createHistory(id, groupId, batchId, - subject.getName(), action, args, - scheduled, startTime, startTime, - dateScheduled.getTime(), - ControlConstants.STATUS_INPROGRESS, - description, null); - - client.controlPluginCommand(pluginName, - productName, - commandHistory.getId(), - action, args); - - } catch (AgentNotFoundException e) { - errorMsg = "Agent not found: " + e.getMessage(); - } catch (AgentConnectionException e) { - errorMsg = "Error getting agent connection: " + e.getMessage(); - } catch (AgentRemoteException e) { - errorMsg = "Agent error: " + e.getMessage(); - } catch (SystemException e) { - errorMsg = "System error"; - } catch (NamingException e) { - errorMsg = "System error"; - } catch (CreateException e) { - errorMsg = "System error"; - } catch (AppdefEntityNotFoundException e) { - errorMsg = "System error"; - } finally { - - if (errorMsg != null) { - this.log.error("Unable to execute command: " + errorMsg); - - // Add the failed job to the history - try { - AppdefEntityID aid = (gid != null) ? gid : id; - - ControlScheduleManagerLocal cLocal = - ControlScheduleManagerUtil.getLocalHome().create(); - - // Remove the old history - if (commandHistory != null) - cLocal.removeHistory(commandHistory.getId()); - - // Add the new one - cLocal.createHistory(aid, groupId, batchId, - subject.getName(), action, args, - scheduled, startTime, - System.currentTimeMillis(), - dateScheduled.getTime(), - ControlConstants.STATUS_FAILED, - description, errorMsg); - } catch (Exception exc) { - this.log.error("Unable to create history entry for " + - "failed control action"); - } - - throw new PluginException(errorMsg); - } - } - - return commandHistory.getId(); + return ControlScheduleManagerEJBImpl.getOne() + .doAgentControlCommand(id, gid, batchId, + subject, dateScheduled, + scheduled, description, + action, args); } } Modified: trunk/src/org/hyperic/hq/control/server/session/ControlScheduleManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/control/server/session/ControlScheduleManagerEJBImpl.java 2010-04-08 19:15:40 UTC (rev 14487) +++ trunk/src/org/hyperic/hq/control/server/session/ControlScheduleManagerEJBImpl.java 2010-04-09 03:41:19 UTC (rev 14488) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2009], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -45,7 +45,11 @@ import org.hibernate.ObjectNotFoundException; import org.hyperic.dao.DAOFactory; import org.hyperic.hibernate.Util; +import org.hyperic.hq.agent.AgentConnectionException; +import org.hyperic.hq.agent.AgentRemoteException; import org.hyperic.hq.appdef.server.session.AppdefManagerEJBImpl; +import org.hyperic.hq.appdef.server.session.PlatformManagerEJBImpl; +import org.hyperic.hq.appdef.shared.AgentNotFoundException; import org.hyperic.hq.appdef.shared.AppdefEntityID; import org.hyperic.hq.appdef.shared.AppdefEntityNotFoundException; import org.hyperic.hq.appdef.shared.AppdefEntityValue; @@ -56,6 +60,8 @@ import org.hyperic.hq.authz.shared.PermissionManagerFactory; import org.hyperic.hq.common.ApplicationException; import org.hyperic.hq.common.SystemException; +import org.hyperic.hq.control.agent.client.ControlCommandsClient; +import org.hyperic.hq.control.agent.client.ControlCommandsClientFactory; import org.hyperic.hq.control.shared.ControlConstants; import org.hyperic.hq.control.shared.ControlFrequencyValue; import org.hyperic.hq.control.shared.ControlScheduleManagerLocal; @@ -718,6 +724,116 @@ } /** + * Do a control command on a single appdef entity + * + * @return The control history id + * + * @ejb:interface-method + * @ejb:transaction type="Required" + */ + public Integer doAgentControlCommand(AppdefEntityID id, + AppdefEntityID gid, + Integer batchId, + AuthzSubject subject, + Date dateScheduled, + Boolean scheduled, + String description, + String action, + String args) + throws PluginException + { + final StopWatch watch = new StopWatch(); + final boolean debug = log.isDebugEnabled(); + + long startTime = System.currentTimeMillis(); + ControlHistory commandHistory = null; + String errorMsg = null; + Integer groupId = (gid != null) ? gid.getId() : null; + + try { + ControlCommandsClient client = + ControlCommandsClientFactory.getInstance().getClient(id); + String pluginName = id.toString(); + String productName = PlatformManagerEJBImpl.getOne() + .getPlatformPluginName(id); + + // Regular command + + if (debug) watch.markTimeBegin("createHistory"); + + commandHistory = + createHistory(id, groupId, batchId, + subject.getName(), action, args, + scheduled, startTime, startTime, + dateScheduled.getTime(), + ControlConstants.STATUS_INPROGRESS, + description, null); + + if (debug) { + watch.markTimeEnd("createHistory"); + watch.markTimeBegin("controlPluginCommand"); + } + + client.controlPluginCommand(pluginName, + productName, + commandHistory.getId(), + action, args); + + if (debug) watch.markTimeEnd("controlPluginCommand"); + + } catch (AgentNotFoundException e) { + errorMsg = "Agent not found: " + e.getMessage(); + } catch (AgentConnectionException e) { + errorMsg = "Error getting agent connection: " + e.getMessage(); + } catch (AgentRemoteException e) { + errorMsg = "Agent error: " + e.getMessage(); + } catch (SystemException e) { + errorMsg = "System error"; + } catch (AppdefEntityNotFoundException e) { + errorMsg = "System error"; + } finally { + if (debug) { + log.debug("doAgentControlCommand: " + watch + + " {resource=" + id + + ", action=" + action + + ", dateScheduled=" + dateScheduled + + ", error=" + errorMsg + + "}"); + } + + if (errorMsg != null) { + this.log.error("Unable to execute command: " + errorMsg); + + // Add the failed job to the history + try { + AppdefEntityID aid = (gid != null) ? gid : id; + + // Remove the old history + if (commandHistory != null) { + removeHistory(commandHistory.getId()); + } + + // Add the new one + createHistory(aid, groupId, batchId, + subject.getName(), action, args, + scheduled, startTime, + System.currentTimeMillis(), + dateScheduled.getTime(), + ControlConstants.STATUS_FAILED, + description, errorMsg); + } catch (Exception exc) { + this.log.error("Unable to create history entry for " + + "failed control action"); + } + + throw new PluginException(errorMsg); + } + } + + return commandHistory.getId(); + } + + /** * Execute a single action on an appdef entity * * @ejb:interface-method @@ -726,31 +842,50 @@ String action, String args, int order[]) throws PluginException { - // Even one time actions go through the scheduler, but there - // is no need to keep track of them in the ScheduleEntity + final boolean debug = log.isDebugEnabled(); - String jobName = getJobName(subject, id, action); + // HQ-2080: Control action for a resource (non-group) intended + // for immediate execution no longer use the Quartz scheduler. + // However, group control actions still need to go through the + // Quartz scheduler because we need to wait for each job to complete. + // There is no need to keep track of them in the ScheduleEntity. - // Setup the quartz job class that will handle this control action. - Class jobClass = id.isGroup() ? - ControlActionGroupJob.class : ControlActionJob.class; + if (id.isGroup()) { + String jobName = getJobName(subject, id, action); + + JobDetail jobDetail = new JobDetail(jobName, GROUP, + ControlActionGroupJob.class); + jobDetail.setVolatility(true); - JobDetail jobDetail = new JobDetail(jobName, GROUP, jobClass); - jobDetail.setVolatility(true); + setupJobData(jobDetail, subject, id, action, args, "Single execution", + Boolean.FALSE, null, order); - setupJobData(jobDetail, subject, id, action, args, "Single execution", - Boolean.FALSE, null, order); + // All single actions use cron triggers + SimpleTrigger trigger = + new SimpleTrigger(getTriggerName(subject, id, action), GROUP); + trigger.setVolatility(true); - // All single actions use cron triggers - SimpleTrigger trigger = - new SimpleTrigger(getTriggerName(subject, id, action), GROUP); - trigger.setVolatility(true); + try { + if (debug) log.debug("Scheduling job for immediate execution: " + jobDetail); + _scheduler.scheduleJob(jobDetail, trigger); + } catch (SchedulerException e) { + log.error("Unable to schedule job: " + e.getMessage(), e); + } + } else { + try { + if (debug) { + log.debug("Running control action for immediate execution: " + + " {resource=" + id + + ", action=" + action + + "}"); + } - try { - log.debug("Scheduling job for immediate execution: " + jobDetail); - _scheduler.scheduleJob(jobDetail, trigger); - } catch (SchedulerException e) { - log.error("Unable to schedule job: " + e.getMessage(), e); + doAgentControlCommand(id, null, null, subject, + new Date(), + Boolean.FALSE, "", action, args); + } catch(PluginException e) { + log.error("Unable to execute control action: " + e.getMessage(), e); + } } } |
Author: scottmf Date: 2010-04-08 12:15:40 -0700 (Thu, 08 Apr 2010) New Revision: 14487 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14487 Added: trunk/unittest/data/resourceManagerTests.README trunk/unittest/data/resourceManagerTests.xml.gz trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTest.java trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTestEJBImpl.java Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java trunk/src/org/hyperic/hq/bizapp/server/session/AppdefBossEJBImpl.java Log: [HHQ-3564] optimize code and query around ResourceManager.findViewableSvcResources() Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java 2010-04-08 07:53:36 UTC (rev 14486) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java 2010-04-08 19:15:40 UTC (rev 14487) @@ -29,6 +29,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.TreeSet; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; @@ -231,48 +232,45 @@ .list(); } - public Collection findViewableSvcRes_orderName(Integer user, - Boolean fSystem) - { - // we use join here to produce a single - // join => the strategy here is to rely on - // the database query optimizer to optimize the query - // by feeding it a single query. - // - // The important point is we should first give the - // opportunity to the database to do the "query" optimization - // before we do anything else. - // Note: this should be refactored to use named queries so - // that we can perform "fetch" optimization outside of the code - String sql = - "select r from Resource r join r.resourceType rt " + - "where r.system = :system and exists " + - "(select rg from GroupMember g " + - " join g.group rg " + - " join g.resource rs " + - "where ((rg.resource = r and rg.groupType = 15) or " + - "(rt.name = :resSvcType and r = rs)) " + - " and (r.owner.id = :subjId or exists " + - "(select role from rg.roles role " + - "join role.subjects subj " + - "join role.operations op " + - "where subj.id = :subjId and " + - "op.name = case rt.name " + - "when (:resSvcType) then '" + - AuthzConstants.serviceOpViewService + - "' " + - "else '" + - AuthzConstants.groupOpViewResourceGroup + - "' end))) " + - "order by r.sortName"; + public Collection findViewableSvcRes_orderName(Integer user, Boolean fSystem) { + ResourceTypeDAO rDao = DAOFactory.getDAOFactory().getResourceTypeDAO(); + ResourceType serviceType = rDao.findByName(AuthzConstants.serviceResType); + OperationDAO opDao = getOperationDAO(); + Operation op = opDao.findByTypeAndName(serviceType, AuthzConstants.serviceOpViewService); + final String sql = new StringBuilder(1024) + .append("SELECT {res.*} ") + .append("FROM EAM_SUBJECT subject ") + .append("JOIN EAM_SUBJECT_ROLE_MAP subjrolemap on subject.ID = subjrolemap.SUBJECT_ID ") + .append("JOIN EAM_ROLE role on role.ID = subjrolemap.ROLE_ID ") + .append("JOIN EAM_ROLE_RESOURCE_GROUP_MAP rolegrpmap on rolegrpmap.ROLE_ID = role.ID ") + .append("JOIN EAM_RESOURCE res on res.RESOURCE_TYPE_ID = :resourceTypeId ") + .append("AND res.FSYSTEM = :system ") + .append("JOIN EAM_RES_GRP_RES_MAP grpmap on grpmap.RESOURCE_ID = res.ID ") + .append("JOIN EAM_RESOURCE_GROUP resgrp on resgrp.ID = grpmap.RESOURCE_GROUP_ID ") + .append("AND rolegrpmap.RESOURCE_GROUP_ID = resgrp.ID ") + .append("JOIN EAM_ROLE_OPERATION_MAP opmap on role.id = opmap.ROLE_ID ") + .append("AND opmap.OPERATION_ID = :opId ") + .append("WHERE subject.ID = :subjectId ") + .append("UNION ALL ") + .append("SELECT {res.*} ") + .append("FROM EAM_RESOURCE res ") + .append("WHERE res.SUBJECT_ID = :subjectId AND res.RESOURCE_TYPE_ID = :resourceTypeId ") + .append("AND res.FSYSTEM = :system ") + .toString(); List resources = - getSession().createQuery(sql) + getSession().createSQLQuery(sql) + .addEntity("res", Resource.class) .setBoolean("system", fSystem.booleanValue()) - .setInteger("subjId", user.intValue()) - .setString("resSvcType", AuthzConstants.serviceResType) + .setInteger("opId", op.getId().intValue()) + .setInteger("subjectId", user.intValue()) + .setInteger("resourceTypeId", serviceType.getId().intValue()) .list(); + // use TreeSet to eliminate dups and sort by Resource + return new TreeSet(resources); + } - return resources; + private OperationDAO getOperationDAO() { + return new OperationDAO(DAOFactory.getDAOFactory()); } public Collection findSvcRes_orderName(Boolean fSystem) Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-04-08 07:53:36 UTC (rev 14486) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-04-08 19:15:40 UTC (rev 14487) @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -56,13 +57,11 @@ import org.hyperic.hq.appdef.shared.ApplicationNotFoundException; import org.hyperic.hq.appdef.shared.PlatformManagerLocal; import org.hyperic.hq.appdef.shared.PlatformNotFoundException; +import org.hyperic.hq.appdef.shared.ResourcesCleanupZevent; import org.hyperic.hq.appdef.shared.ServerManagerLocal; import org.hyperic.hq.appdef.shared.ServerNotFoundException; import org.hyperic.hq.appdef.shared.ServiceManagerLocal; import org.hyperic.hq.appdef.shared.ServiceNotFoundException; -import org.hyperic.hq.authz.server.session.AuthzSubject; -import org.hyperic.hq.authz.server.session.Resource; -import org.hyperic.hq.authz.server.session.ResourceType; import org.hyperic.hq.authz.shared.AuthzConstants; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.authz.shared.PermissionManager; @@ -70,11 +69,11 @@ import org.hyperic.hq.authz.shared.ResourceEdgeCreateException; import org.hyperic.hq.authz.shared.ResourceManagerLocal; import org.hyperic.hq.authz.shared.ResourceManagerUtil; +import org.hyperic.hq.bizapp.server.session.AppdefBossEJBImpl; import org.hyperic.hq.common.SystemException; import org.hyperic.hq.common.VetoException; import org.hyperic.hq.common.server.session.ResourceAudit; import org.hyperic.hq.zevents.ZeventManager; -import org.hyperic.util.StringUtil; import org.hyperic.util.pager.PageControl; import org.hyperic.util.pager.PageList; import org.hyperic.util.pager.Pager; @@ -625,39 +624,33 @@ * @return PageList of resource values * @ejb:interface-method */ - public PageList findViewableSvcResources(AuthzSubject subject, - String resourceName, + public PageList findViewableSvcResources(AuthzSubject subject, String nameFilter, PageControl pc) { - Collection resources; - AuthzSubject subj = getSubjectDAO().findById(subject.getId()); pc = PageControl.initDefaults(pc, SortAttribute.RESOURCE_NAME); PermissionManager pm = PermissionManagerFactory.getInstance(); - // Damn I love this code. -- JMT - switch(pc.getSortattribute()) { - case SortAttribute.RESOURCE_NAME: - default: - resources = pm.findServiceResources(subj, Boolean.FALSE); - break; - } + // returns a sorted Collection by resourceName + Collection resources = pm.findServiceResources(subj, Boolean.FALSE); - // TODO: Move filtering into EJBQL - ArrayList ordResources = new ArrayList(resources.size()); - for (Iterator it = resources.iterator(); it.hasNext();) { - Resource res = (Resource) it.next(); - - if (StringUtil.stringDoesNotExist(res.getName(), resourceName)) - continue; - - if (pc.isDescending()) // Add to head of array list - ordResources.add(0, res); - else // Add to tail of array list - ordResources.add(res); + if (nameFilter != null) { + for (Iterator it=resources.iterator(); it.hasNext(); ) { + Resource r = (Resource) it.next(); + if (r == null || r.isInAsyncDeleteState() || + !r.getName().toLowerCase().contains(nameFilter.toLowerCase())) { + it.remove(); + } + } } + Collection ordResources = resources; + if (pc.isDescending()) { + ordResources = new ArrayList(resources); + Collections.reverse((List)ordResources); + } + return new PageList(ordResources, ordResources.size()); } Modified: trunk/src/org/hyperic/hq/bizapp/server/session/AppdefBossEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/server/session/AppdefBossEJBImpl.java 2010-04-08 07:53:36 UTC (rev 14486) +++ trunk/src/org/hyperic/hq/bizapp/server/session/AppdefBossEJBImpl.java 2010-04-08 19:15:40 UTC (rev 14487) @@ -118,7 +118,6 @@ import org.hyperic.hq.appdef.shared.pager.AppdefPagerFilterExclude; import org.hyperic.hq.appdef.shared.pager.AppdefPagerFilterGroupEntityResource; import org.hyperic.hq.appdef.shared.pager.AppdefPagerFilterGroupMemExclude; -import org.hyperic.hq.application.HQApp; import org.hyperic.hq.auth.shared.SessionException; import org.hyperic.hq.auth.shared.SessionManager; import org.hyperic.hq.auth.shared.SessionNotFoundException; @@ -139,7 +138,6 @@ import org.hyperic.hq.authz.shared.ResourceManagerLocal; import org.hyperic.hq.autoinventory.AutoinventoryException; import org.hyperic.hq.autoinventory.ScanConfigurationCore; -import org.hyperic.hq.bizapp.shared.AIBossLocal; import org.hyperic.hq.bizapp.shared.AllConfigResponses; import org.hyperic.hq.bizapp.shared.AppdefBossLocal; import org.hyperic.hq.bizapp.shared.AppdefBossUtil; @@ -186,7 +184,6 @@ import org.hyperic.util.pager.Pager; import org.hyperic.util.pager.SortAttribute; import org.hyperic.util.timer.StopWatch; - import org.quartz.SchedulerException; /** @@ -3219,16 +3216,16 @@ public PageList findAvailableServicesForApplication(int sessionId, Integer appId, AppdefEntityID[] pendingEntities, - String resourceName, PageControl pc) + String nameFilter, PageControl pc) throws AppdefEntityNotFoundException, PermissionException, SessionException { - List toBePaged, filterList, authzResources; + final StopWatch watch = new StopWatch(); + final boolean debug = log.isDebugEnabled(); AuthzSubject subject = manager.getSubject(sessionId); // init our (never-null) page and filter lists - toBePaged = new ArrayList(); - filterList = new ArrayList(); + List filterList = new ArrayList(); // add a pager filter for removing pending appdef entities if (pendingEntities != null) { @@ -3238,48 +3235,52 @@ int oriPageSize = pc.getPagesize(); pc.setPagesize( PageControl.SIZE_UNLIMITED ); - authzResources = getResourceManager() - .findViewableSvcResources(subject, resourceName, pc); + if (debug) watch.markTimeBegin("findViewableSvcResources"); + Set authzResources = + new TreeSet(getResourceManager().findViewableSvcResources(subject, nameFilter, pc)); + if (debug) watch.markTimeEnd("findViewableSvcResources"); + int authzResourcesSize = authzResources.size(); + pc.setPagesize( oriPageSize ); // Remove existing application assigned inventory - List assigned = findServiceInventoryByApplication(sessionId, appId, - PageControl.PAGE_ALL); - for (int x = 0; x < assigned.size(); x++) { - assigned.set(x, ((AppdefResourceValue) assigned.get(x)) - .getEntityId()); + if (debug) watch.markTimeBegin("findServiceInventoryByApplication"); + List assigned = findServiceInventoryByApplication(sessionId, appId, PageControl.PAGE_ALL); + if (debug) watch.markTimeEnd("findServiceInventoryByApplication"); + if (debug) watch.markTimeBegin("loop1"); + ResourceManagerLocal rMan = getResourceManager(); + for (Iterator it=assigned.iterator(); it.hasNext(); ) { + AppdefResourceValue val = (AppdefResourceValue) it.next(); + authzResources.remove(rMan.findResource(val.getEntityId())); } + if (debug) watch.markTimeEnd("loop1"); - for (Iterator i = authzResources.iterator(); i.hasNext();) { - Resource rv = (Resource) i.next(); - AppdefEntityID id = new AppdefEntityID(rv); - if (!assigned.contains(id)) { - toBePaged.add(id); - } + List toBePaged = new ArrayList(authzResources.size()); + for (Iterator it=authzResources.iterator(); it.hasNext(); ) { + Resource r = (Resource) it.next(); + toBePaged.add(new AppdefEntityID(r)); } // Page it, then convert to AppdefResourceValue - List finalList = new ArrayList(); + List finalList = new ArrayList(authzResources.size()); PageList pl = getPageList (toBePaged, pc, filterList); - for (Iterator itr = pl.iterator();itr.hasNext();){ - AppdefEntityID ent = (AppdefEntityID) itr.next(); + for (Iterator it=pl.iterator(); it.hasNext();){ + AppdefEntityID ent = (AppdefEntityID) it.next(); try { finalList.add( findById(subject,ent) ); } catch (AppdefEntityNotFoundException e) { // XXX - hack to ignore the error. This must have occurred when // we created the resource, and rolled back the AppdefEntity // but not the Resource - log.error("Invalid entity still in resource table: " + ent); + log.error("Invalid entity still in resource table: " + ent, e); } } - - int pendingSize = 0; - if (pendingEntities != null) - pendingSize = pendingEntities.length; - - int adjustedSize = authzResources.size() - pendingSize; - return new PageList(finalList,adjustedSize); + int pendingSize = (pendingEntities != null) ? pendingEntities.length : 0; + int adjustedSize = authzResourcesSize - pendingSize; + PageList rtn = new PageList(finalList,adjustedSize); + if (debug) log.debug(watch); + return rtn; } private PageList getPageList (Collection coll, PageControl pc) { Added: trunk/unittest/data/resourceManagerTests.README =================================================================== --- trunk/unittest/data/resourceManagerTests.README (rev 0) +++ trunk/unittest/data/resourceManagerTests.README 2010-04-08 19:15:40 UTC (rev 14487) @@ -0,0 +1,2 @@ +../../bin/exportTable.sh -l jdbc:mysql://localhost:3306/hqdb -u hqadmin -p hqadmin -d /home/scottmf/sts-workspace/hq_trunk/unittest/data/resourceManagerTests -t EAM_AGENT,EAM_AUDIT,EAM_CONFIG_RESPONSE,EAM_CRISPO,EAM_CRISPO_OPT,EAM_CRITERIA,EAM_DASH_CONFIG,EAM_MEASUREMENT,EAM_MEASUREMENT_CAT,EAM_MEASUREMENT_TEMPL,EAM_MONITORABLE_TYPE,EAM_OPERATION,EAM_PLATFORM,EAM_PLATFORM_SERVER_TYPE_MAP,EAM_PLATFORM_TYPE,EAM_RES_GRP_RES_MAP,EAM_RESOURCE,EAM_RESOURCE_EDGE,EAM_RESOURCE_GROUP,EAM_RESOURCE_RELATION,EAM_RESOURCE_TYPE,EAM_ROLE,EAM_ROLE_OPERATION_MAP,EAM_ROLE_RESOURCE_GROUP_MAP,EAM_SERVER,EAM_SERVER_TYPE,EAM_SERVICE,EAM_SERVICE_TYPE,EAM_SUBJECT,EAM_SUBJECT_ROLE_MAP,EAM_CONFIG_PROPS +# may want to think about exporting HQ_SEQUENCE as well when the testdb moves to mysql Added: trunk/unittest/data/resourceManagerTests.xml.gz =================================================================== (Binary files differ) Property changes on: trunk/unittest/data/resourceManagerTests.xml.gz ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTest.java =================================================================== --- trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTest.java (rev 0) +++ trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTest.java 2010-04-08 19:15:40 UTC (rev 14487) @@ -0,0 +1,30 @@ +package org.hyperic.hq.authz.server.session; + +import org.hyperic.hq.authz.shared.ResourceManagerTestLocal; +import org.hyperic.util.unittest.server.BaseServerTestCase; +import org.hyperic.util.unittest.server.LocalInterfaceRegistry; + +public class ResourceManagerTest extends BaseServerTestCase { + + private static final String FILENAME = "resourceManagerTests.xml.gz"; + private LocalInterfaceRegistry _registry; + + public ResourceManagerTest(String name) { + super(name, true); + } + + public void setUp() throws Exception { + super.setUp(); + super.insertSchemaData(FILENAME); + _registry = deployHQ(); + } + + public void testFindViewableSvcResources() throws Exception { + ResourceManagerTestLocal resMan = (ResourceManagerTestLocal) + _registry.getLocalInterface( + ResourceManagerTestEJBImpl.class, + ResourceManagerTestLocal.class); + resMan.testFindViewableSvcResources(); + } + +} Added: trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTestEJBImpl.java =================================================================== --- trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTestEJBImpl.java (rev 0) +++ trunk/unittest/src/org/hyperic/hq/authz/server/session/ResourceManagerTestEJBImpl.java 2010-04-08 19:15:40 UTC (rev 14487) @@ -0,0 +1,80 @@ +package org.hyperic.hq.authz.server.session; + +import java.rmi.RemoteException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import javax.ejb.CreateException; +import javax.ejb.EJBException; +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; + +import junit.framework.Assert; + +import org.hyperic.dao.DAOFactory; +import org.hyperic.hq.authz.shared.AuthzSubjectManagerLocal; +import org.hyperic.hq.authz.shared.ResourceManagerLocal; +import org.hyperic.hq.authz.shared.ResourceManagerTestLocal; +import org.hyperic.hq.authz.shared.ResourceManagerTestUtil; +import org.hyperic.hq.common.SystemException; + +/** + * The session bean implementing the in-container unit tests for the + * AuthzSubjectManager. + * + * @ejb:bean name="ResourceManagerTest" + * jndi-name="ejb/authz/ResourceManagerTest" + * local-jndi-name="LocalResourceManagerTest" + * view-type="local" + * type="Stateless" + * + * @ejb:util generate="physical" + * @ejb:transaction type="NotSupported" + */ +public class ResourceManagerTestEJBImpl implements SessionBean { + /** + * @ejb:interface-method + */ + public void testFindViewableSvcResources() throws Exception { + testFindViewableSvcResources("joe", 15); + testFindViewableSvcResources("hqadmin", 1264); + testFindViewableSvcResources("nipuna11", 901); + testFindViewableSvcResources("nipuna2", 901); + testFindViewableSvcResources("nipuna3", 901); + testFindViewableSvcResources("guest", 15); + } + + private void testFindViewableSvcResources(String user, int expectedResources) { + AuthzSubjectManagerLocal authMan = AuthzSubjectManagerEJBImpl.getOne(); + AuthzSubject subj = authMan.findSubjectByName(user); + // it would be nice to test the Manager method rather than the DAO, but since it is an + // ee feature, it makes that a big more difficult. The Manager calls + // findViewableSvcRes_orderName() eventually anyway. + Collection list = getResourceDAO().findViewableSvcRes_orderName(subj.getId(), Boolean.FALSE); + // List list = getResourceMan().findViewableSvcResources(subj, null, PageControl.PAGE_ALL); + Set toTest = new HashSet(list); + Assert.assertEquals( + "There are duplicate service resources returned from findViewableSvcResources()", + list.size(), toTest.size()); + Assert.assertEquals(expectedResources, toTest.size()); + } + + private ResourceDAO getResourceDAO() { + return new ResourceDAO(DAOFactory.getDAOFactory()); + } + + public static ResourceManagerTestLocal getOne() { + try { + return ResourceManagerTestUtil.getLocalHome().create(); + } catch (Exception e) { + throw new SystemException(e); + } + } + + public void ejbCreate() throws CreateException {} + public void ejbActivate() throws EJBException, RemoteException {} + public void ejbPassivate() throws EJBException, RemoteException {} + public void ejbRemove() throws EJBException, RemoteException {} + public void setSessionContext(SessionContext arg0) {} +} |
From: <bo...@hy...> - 2010-04-08 07:53:45
|
Author: bob Date: 2010-04-08 00:53:36 -0700 (Thu, 08 Apr 2010) New Revision: 14486 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14486 Modified: trunk/etc/version.properties Log: Release 4.3.0 build #1402 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-04-07 22:09:54 UTC (rev 14485) +++ trunk/etc/version.properties 2010-04-08 07:53:36 UTC (rev 14486) @@ -1,3 +1,3 @@ -#Wed Apr 07 00:16:27 PDT 2010 +#Thu Apr 08 00:17:36 PDT 2010 version=4.3.0 -build=1401 +build=1402 |
From: <sc...@hy...> - 2010-04-07 22:10:03
|
Author: scottmf Date: 2010-04-07 15:09:54 -0700 (Wed, 07 Apr 2010) New Revision: 14485 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14485 Modified: trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java Log: [HHQ-3845] TimeUnit.DAYS does not exist in jdk 1.5 Modified: trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java =================================================================== --- trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java 2010-04-07 21:42:04 UTC (rev 14484) +++ trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java 2010-04-07 22:09:54 UTC (rev 14485) @@ -91,7 +91,7 @@ // backport apis but don't think this is a good idea) // 3 threads to service requests _executor = - new ThreadPoolExecutor(3, 3, Long.MAX_VALUE, TimeUnit.DAYS, new LinkedBlockingQueue()); + new ThreadPoolExecutor(3, 3, Long.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue()); _esclMan = EscalationManagerEJBImpl.getOne(); } |
From: <sc...@hy...> - 2010-04-07 21:42:14
|
Author: scottmf Date: 2010-04-07 14:42:04 -0700 (Wed, 07 Apr 2010) New Revision: 14484 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14484 Modified: trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java Log: [HHQ-3845] remove backport libs Modified: trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java =================================================================== --- trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java 2010-04-07 18:54:50 UTC (rev 14483) +++ trunk/src/org/hyperic/hq/escalation/server/session/EscalationRuntime.java 2010-04-07 21:42:04 UTC (rev 14484) @@ -32,6 +32,13 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.Executor; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.Semaphore; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -40,12 +47,6 @@ import org.hyperic.hq.application.TransactionListener; import org.hyperic.hq.escalation.shared.EscalationManagerLocal; -import EDU.oswego.cs.dl.util.concurrent.ClockDaemon; -import EDU.oswego.cs.dl.util.concurrent.Executor; -import EDU.oswego.cs.dl.util.concurrent.LinkedQueue; -import EDU.oswego.cs.dl.util.concurrent.PooledExecutor; -import EDU.oswego.cs.dl.util.concurrent.Semaphore; - /** * This class manages the runtime execution of escalation chains. The * persistence part of the escalation engine lives within @@ -74,7 +75,7 @@ private final ThreadLocal _batchUnscheduleTxnListeners = new ThreadLocal(); private final Log _log = LogFactory.getLog(EscalationRuntime.class); - private final ClockDaemon _schedule = new ClockDaemon(); + private final Timer _schedule = new Timer("EscalationRuntime", true); private final Map _stateIdsToTasks = new HashMap(); private final Map _esclEntityIdsToStateIds = new HashMap(); @@ -82,14 +83,15 @@ private final Set _uncomittedEscalatingEntities = Collections.synchronizedSet(new HashSet()); - private final PooledExecutor _executor; + private final ThreadPoolExecutor _executor; private final EscalationManagerLocal _esclMan; private EscalationRuntime() { - _executor = new PooledExecutor(new LinkedQueue()); - _executor.setKeepAliveTime(-1); // Threads never die off - _executor.createThreads(3); // # of threads to service requests - + // Want threads to never die (XXX, scottmf, keeping current functionality to get rid of + // backport apis but don't think this is a good idea) + // 3 threads to service requests + _executor = + new ThreadPoolExecutor(3, 3, Long.MAX_VALUE, TimeUnit.DAYS, new LinkedBlockingQueue()); _esclMan = EscalationManagerEJBImpl.getOne(); } @@ -128,7 +130,7 @@ * This class is invoked when the clock daemon wakes up and decides that * it is time to look at an escalation. */ - private class ScheduleWatcher implements Runnable { + private class ScheduleWatcher extends TimerTask { private Integer _stateId; private Executor _executor; @@ -140,9 +142,8 @@ public void run() { try { _executor.execute(new EscalationRunner(_stateId)); - } catch(InterruptedException e) { - _log.warn("Interrupted while trying to execute state [" + - _stateId + "]"); + } catch(Throwable t) { + _log.error(t,t); } } } @@ -210,7 +211,8 @@ public void afterCommit(boolean success) { try { - _log.debug("Transaction committed: success=" + success); + final boolean debug = _log.isDebugEnabled(); + if (debug) _log.debug("Transaction committed: success=" + success); if (success) { unscheduleAllEscalations_((EscalatingEntityIdentifier[]) _escalationsToUnschedule.toArray( @@ -270,14 +272,13 @@ private void doUnscheduleEscalation_(Integer stateId) { if (stateId != null) { - Object task = _stateIdsToTasks.remove(stateId); - + TimerTask task = (TimerTask) _stateIdsToTasks.remove(stateId); + final boolean debug = _log.isDebugEnabled(); if (task != null) { - ClockDaemon.cancel(task); - _log.debug("Canceled state[" + stateId + "]"); + task.cancel(); + if (debug) _log.debug("Canceled state[" + stateId + "]"); } else { - _log.debug("Canceling state[" + stateId + "] but was " + - "not found"); + if (debug) _log.debug("Canceling state[" + stateId + "] but was not found"); } } } @@ -361,7 +362,8 @@ HQApp.getInstance().addTransactionListener(new TransactionListener() { public void afterCommit(boolean success) { - _log.debug("Transaction committed: success=" + success); + final boolean debug = _log.isDebugEnabled(); + if (debug) _log.debug("Transaction committed: success=" + success); if (success) { scheduleEscalation_(state, schedTime); @@ -382,18 +384,19 @@ } synchronized (_stateIdsToTasks) { - Object task = _stateIdsToTasks.get(stateId); + ScheduleWatcher task = (ScheduleWatcher) _stateIdsToTasks.get(stateId); + final boolean debug = _log.isDebugEnabled(); if (task != null) { // Previously scheduled. Unschedule - ClockDaemon.cancel(task); - _log.debug("Rescheduling state[" + stateId + "]"); + task.cancel(); + if (debug) _log.debug("Rescheduling state[" + stateId + "]"); } else { - _log.debug("Scheduling state[" + stateId + "]"); + if (debug) _log.debug("Scheduling state[" + stateId + "]"); } - task = _schedule.executeAt(new Date(schedTime), - new ScheduleWatcher(stateId, _executor)); + task = new ScheduleWatcher(stateId, _executor); + _schedule.schedule(task, new Date(schedTime)); _stateIdsToTasks.put(stateId, task); _esclEntityIdsToStateIds.put(new EscalatingEntityIdentifier(state), @@ -402,7 +405,8 @@ } private void runEscalation(Integer stateId) { - _log.debug("Running escalation state [" + stateId + "]"); + final boolean debug = _log.isDebugEnabled(); + if (debug) _log.debug("Running escalation state [" + stateId + "]"); _esclMan.executeState(stateId); } |
From: Generic G. <nt...@gm...> - 2010-04-07 21:23:46
|
This is quite strange, when I try to execute sigar.jar I get a linker error: server-4.2.0-EE]$ java -jar lib/sigar.jar no libsigar-amd64-linux.so in java.library.path org.hyperic.sigar.SigarException: no libsigar-amd64-linux.so in java.library.path at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:174) at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:102) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.hyperic.sigar.SigarLoader.class$(SigarLoader.java:79) at org.hyperic.sigar.SigarLoader.getLocation(SigarLoader.java:79) at org.hyperic.sigar.cmd.Runner.main(Runner.java:161) java.lang.UnsatisfiedLinkError: org.hyperic.sigar.util.Getline.isatty()Z at org.hyperic.sigar.util.Getline.isatty(Native Method) at org.hyperic.sigar.util.Getline.<clinit>(Getline.java:36) at org.hyperic.sigar.shell.ShellBase.init(ShellBase.java:93) at org.hyperic.sigar.cmd.Shell.main(Shell.java:212) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.hyperic.sigar.cmd.Runner.main(Runner.java:214) |
From: Alex Ma <al...@hy...> - 2010-04-07 21:23:45
|
Are you running the java command with the WebLogic jvm or a standard system JVM? I would add a -Dlog=debug to your command. It may give you a bit more visibility into why its failing. >From there, open up sigar to see what the process looks like. Make sure to run it as the same UID. java -jar sigar.jar > ps State.Name.eq=java Identify the Weblogic server, and grab its pid >pargs <pid> That will display the command line args that sigar has visibility into for the process that helps it identify the app server. The plugin by default looks for a process query like this: State.Name.eq=java,Args.-1.eq=weblogic.Server For 9.1 specifically(possibly 10 as well) it also looks for this: -Dweblogic.management.server You can try this in Sigar to see if a match shows up. If your process arguments are different than this, than it can explain why auto discovery is failing. |
From: <dcr...@hy...> - 2010-04-07 18:54:58
|
Author: dcrutchf Date: 2010-04-07 11:54:50 -0700 (Wed, 07 Apr 2010) New Revision: 14483 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14483 Modified: trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/AddPortletAction.java trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/ViewAction.java Log: [HHQ-3212] - Multiple users update GAS portlet at the same time causes error Modified: trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/AddPortletAction.java =================================================================== --- trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/AddPortletAction.java 2010-04-07 07:50:43 UTC (rev 14482) +++ trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/AddPortletAction.java 2010-04-07 18:54:50 UTC (rev 14483) @@ -26,6 +26,7 @@ package org.hyperic.hq.ui.action.portlet.addcontent; import java.text.NumberFormat; +import java.util.List; import java.util.Random; import javax.servlet.ServletContext; @@ -77,64 +78,68 @@ AuthzBoss boss = ContextUtils.getAuthzBoss(ctx); HttpSession session = request.getSession(); WebUser user = RequestUtils.getWebUser(request); - DashboardConfig dashConfig = DashboardUtils.findDashboard( - (Integer)session.getAttribute(Constants.SELECTED_DASHBOARD_ID), - user, boss); + DashboardConfig dashConfig = DashboardUtils.findDashboard((Integer) session.getAttribute(Constants.SELECTED_DASHBOARD_ID), user, boss); ConfigResponse dashPrefs = dashConfig.getConfig(); PropertiesForm pForm = (PropertiesForm) form; - - if( pForm.getPortlet() == null || "bad".equals( pForm.getPortlet() ) ) { + String portlet = pForm.getPortlet(); + + if (portlet == null || portlet.equals("bad")) { return mapping.findForward(Constants.SUCCESS_URL); } String prefKey; + List<String> multi; + if (pForm.isWide()) { prefKey = Constants.USER_PORTLETS_SECOND; - } - else{ + multi = (List<String>) session.getAttribute("multi.wide"); + } else { prefKey = Constants.USER_PORTLETS_FIRST; + multi = (List<String>) session.getAttribute("multi.narrow"); } String userPrefs = dashPrefs.getValue(prefKey); - String portlet = pForm.getPortlet(); + // Check to see if this portlet is permitted to be rendered multiple times + if (multi != null && multi.contains(portlet)) { + while (userPrefs != null && userPrefs.indexOf(portlet) > -1) { + // We need to add a multi portlet + StringBuffer portletName = new StringBuffer(pForm.getPortlet()); - while (userPrefs != null && userPrefs.indexOf(portlet) > -1) { - // We need to add a multi portlet - StringBuffer portletName = new StringBuffer(pForm.getPortlet()); - // 1. Generate random token - NumberFormat nf = NumberFormat.getIntegerInstance(); - nf.setMinimumIntegerDigits(3); // Exactly 3 digits - nf.setMaximumIntegerDigits(3); - portletName.append(DashboardUtils.MULTI_PORTLET_TOKEN) - .append(nf.format(new Random().nextInt(1000))); - // 2. Create unique portlet name based on the new random token - portlet = portletName.toString(); + // 1. Generate random token + NumberFormat nf = NumberFormat.getIntegerInstance(); + + nf.setMinimumIntegerDigits(3); // Exactly 3 digits + nf.setMaximumIntegerDigits(3); + portletName.append(DashboardUtils.MULTI_PORTLET_TOKEN).append(nf.format(new Random().nextInt(1000))); + + // 2. Create unique portlet name based on the new random token + portlet = portletName.toString(); + } } - - String preferences = Constants.DASHBOARD_DELIMITER + portlet + - Constants.DASHBOARD_DELIMITER; - // Clean up the delimiters - preferences = StringUtil.replace(preferences, - Constants.EMPTY_DELIMITER, Constants.DASHBOARD_DELIMITER); + + // if list of active portlets empty or the portlet name is not in the list, add it + if (userPrefs == null || userPrefs.indexOf(portlet) == -1) { + String preferences = Constants.DASHBOARD_DELIMITER + portlet + Constants.DASHBOARD_DELIMITER; + + // Clean up the delimiters + preferences = StringUtil.replace(preferences, Constants.EMPTY_DELIMITER, Constants.DASHBOARD_DELIMITER); + + LogFactory.getLog("user.preferences").trace("Invoking setUserPrefs in AddPortletAction for " + + user.getId() + " at " + System.currentTimeMillis() + + " user.prefs = " + userPrefs); + + // If there are existing userprefs, prepend it to the string of preferences + // otherwise, this is the first preference in the list + if (userPrefs != null) { + preferences = userPrefs + preferences; + } + + ConfigurationProxy.getInstance().setPreference(session, user, boss, prefKey, preferences); + + session.removeAttribute(Constants.USERS_SES_PORTAL); + } - LogFactory.getLog("user.preferences").trace( - "Invoking setUserPrefs" + " in AddPortletAction " + " for " - + user.getId() + " at " + System.currentTimeMillis() - + " user.prefs = " + userPrefs); - - // If there are existing userprefs, prepend it to the string of preferences - // otherwise, this is the first preference in the list - if (userPrefs != null) { - preferences = userPrefs + preferences; - } - - ConfigurationProxy.getInstance().setPreference(session, user, boss, - prefKey, preferences); - - - session.removeAttribute(Constants.USERS_SES_PORTAL); - return mapping.findForward(Constants.SUCCESS_URL); } } Modified: trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/ViewAction.java =================================================================== --- trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/ViewAction.java 2010-04-07 07:50:43 UTC (rev 14482) +++ trunk/src/org/hyperic/hq/ui/action/portlet/addcontent/ViewAction.java 2010-04-07 18:54:50 UTC (rev 14483) @@ -78,9 +78,11 @@ if (wide.booleanValue()) { userPortlets = dashPrefs.getValue( Constants.USER_PORTLETS_SECOND ); multi = (List<String>) context.getAttribute("multi.wide"); + session.setAttribute("multi.wide", multi); } else { userPortlets = dashPrefs.getValue( Constants.USER_PORTLETS_FIRST ); multi = (List<String>) context.getAttribute("multi.narrow"); + session.setAttribute("multi.narrow", multi); } // Populate available portlets list... |
From: Doug M. <do...@hy...> - 2010-04-07 17:21:35
|
Hi, terracotta-3.1.1 includes the sigar-1.6.3 release version, you can verify the files have not been tampered with by checking the md5. They should match the following values: % md5 lib/sigar-x86-winnt.dll MD5 (lib/sigar-x86-winnt.dll) = ed36c8473ea1479eb8439472b3274b68 % md5 lib/libsigar-x86-linux.so MD5 (lib/libsigar-x86-linux.so) = 67a4237ee6ad087f88caae0957247741 The 'Adore' worm is 9 years old and according to http://www.symantec.com/security_response/writeup.jsp?docid=2001-040516-0452-99 "Target of Infection: Linux systems with vulnerable wuftpd, bind, lprng, or statd" Certainly sounds like a false alert. |
From: <bo...@hy...> - 2010-04-07 07:50:52
|
Author: bob Date: 2010-04-07 00:50:43 -0700 (Wed, 07 Apr 2010) New Revision: 14482 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14482 Modified: trunk/etc/version.properties Log: Release 4.3.0 build #1401 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-04-06 08:00:29 UTC (rev 14481) +++ trunk/etc/version.properties 2010-04-07 07:50:43 UTC (rev 14482) @@ -1,3 +1,3 @@ -#Tue Apr 06 00:19:11 PDT 2010 +#Wed Apr 07 00:16:27 PDT 2010 version=4.3.0 -build=1400 +build=1401 |
From: Irene <ire...@na...> - 2010-04-06 17:11:41
|
Why do you say false alert? Are you associated with sigar developers? I think it is a false alert too, but I am trying to get data for our customer. |
From: <bo...@hy...> - 2010-04-06 08:00:42
|
Author: bob Date: 2010-04-06 01:00:29 -0700 (Tue, 06 Apr 2010) New Revision: 14481 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14481 Modified: trunk/etc/version.properties Log: Release 4.3.0 build #1400 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-04-05 23:21:31 UTC (rev 14480) +++ trunk/etc/version.properties 2010-04-06 08:00:29 UTC (rev 14481) @@ -1,3 +1,3 @@ -#Mon Apr 05 00:19:39 PDT 2010 +#Tue Apr 06 00:19:11 PDT 2010 version=4.3.0 -build=1399 +build=1400 |
From: Mirko P. <m.p...@gm...> - 2010-04-06 06:46:31
|
Hi, I think this is a false alert. Does your virus scanner include the latest updates ? Have you tried to scan the files with another scanner ? Cheers, Mirko |
From: Irene <ire...@na...> - 2010-04-06 06:46:28
|
Our product includes Terracotta DSO which uses sigar for its dev-console. We recently attempted to install to our NASA customer site and underwend a routine security scan. The scan indicated the Adore.worm virus in two libraries, as below. We do not today deply on winnt, however, we do deploy on linux and would like to know if sigar is aware of this report and if so, will it be addressed in a future release? Thank you, ## VIRUS POSSIBLE IN FILE: ".//terracotta.tar.gz" ## VIRUS ID: CVDL linux/Adore.worm ## VIRUS END OFFSET: 34730142, matched;D__\x00__DTOR_END_ ## Number of possible virus infections: 2 Here are the files: /terracotta/terracotta-3.1.1/lib/libsigar-x86-linux.so /terracotta/terracotta-3.1.1/lib/sigar-amd64-winnt.dll [irsmith@otf7 lib]$ ldd libsigar-x86-linux.so libc.so.6 => /lib/tls/libc.so.6 (0x00856000) /lib/ld-linux.so.2 (0x00445000) [irsmith@otf7 lib]$ uname -a Linux otf7.ndc.nasa.gov 2.6.9-89.0.19.ELsmp #1 SMP Wed Dec 30 12:53:30 EST 2009 i686 i686 i386 GNU/Linux [irsmith@otf7 lib]$ cd ../../ [irsmith@otf7 objectSharing]$ cd . [irsmith@otf7 objectSharing]$ ls -lt terracotta-3.1.1/lib/libsigar-x86-linux.so -rwxrwxrwx 1 irsmith MCT 232969 Oct 9 14:34 terracotta-3.1.1/lib/libsigar-x86-linux.so Irene Smith SGT, Inc. for NASA Ames Moffett Field, CA |
From: <dcr...@hy...> - 2010-04-05 23:21:39
|
Author: dcrutchf Date: 2010-04-05 16:21:31 -0700 (Mon, 05 Apr 2010) New Revision: 14480 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14480 Modified: trunk/src/org/hyperic/hq/events/Resources.properties trunk/web/WEB-INF/classes/ApplicationResources.properties trunk/web/common/Error.jsp trunk/web/common/GenericError.jsp Log: [HHQ-3799] - Remove For Help message from stack traces Modified: trunk/src/org/hyperic/hq/events/Resources.properties =================================================================== --- trunk/src/org/hyperic/hq/events/Resources.properties 2010-04-05 23:01:58 UTC (rev 14479) +++ trunk/src/org/hyperic/hq/events/Resources.properties 2010-04-05 23:21:31 UTC (rev 14480) @@ -49,4 +49,4 @@ event.clone.platform.message.end=Cloning ended. {1} platforms cloned from master platform [{0}] event.hqdbhealth.email.subject=Hyperic HQ Shutdown Notification -event.hqdbhealth.email.message=Hyperic HQ initiated an automatic application shutdown at {0} due to a loss of database connectivity. Please verify that your HQ database is up and functioning prior to restarting HQ.\n\nHQ server.log information at the time of shutdown contained the following information, which may be useful for database diagnostic purposes:\n\n{1}\n\nPlease contact Hyperic Support with any questions, or for guidance on steps to system recovery. +event.hqdbhealth.email.message=Hyperic HQ initiated an automatic application shutdown at {0} due to a loss of database connectivity. Please verify that your HQ database is up and functioning prior to restarting HQ.\n\nHQ server.log information at the time of shutdown contained the following information, which may be useful for database diagnostic purposes:\n\n{1} Modified: trunk/web/WEB-INF/classes/ApplicationResources.properties =================================================================== --- trunk/web/WEB-INF/classes/ApplicationResources.properties 2010-04-05 23:01:58 UTC (rev 14479) +++ trunk/web/WEB-INF/classes/ApplicationResources.properties 2010-04-05 23:21:31 UTC (rev 14480) @@ -185,8 +185,8 @@ error.Error.Tab=Error error.Error.ThePageRequestedEtc=The page requested cannot be displayed due to some error. error.Error.YouCan=You can -error.Error.StackTraceHereLink= view the stack trace, -error.Error.HideStackTraceLink= hide the stack trace, +error.Error.StackTraceHereLink= view the stack trace. +error.Error.HideStackTraceLink= hide the stack trace. error.Error.ReturnTo=Return to the error.Error.PreviousPageLink=previous page, error.Error.DashboardLink=Dashboard, @@ -243,8 +243,6 @@ errors.jsp.problem=There was a problem generating your page. errors.jsp.ClickHere=Click here errors.jsp.ToSee=to see the complete stack trace. -errors.jsp.contactsupport=For help on this issue contact Hyperic Support: -errors.jsp.callhyperic=Call <b>1-888-4Hyperic</b> (1-888-449-7374) # errors.cam.general=An unknown application error occurred. error.input.badchars=Input should not contain any of the following characters: |, ?, &, <, >, ', " Modified: trunk/web/common/Error.jsp =================================================================== --- trunk/web/common/Error.jsp 2010-04-05 23:01:58 UTC (rev 14479) +++ trunk/web/common/Error.jsp 2010-04-05 23:21:31 UTC (rev 14480) @@ -129,7 +129,7 @@ "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" + " <tr>\n" + " <td class=\"ErrorBlock\"><img src=\"<html:rewrite page="/images/"/>tt_error.gif\" width=\"10\" height=\"11\" hspace=\"5\" border=\"0\"/></td>\n" + -" <td class=\"ErrorBlock\" width=\"100%\"><fmt:message key="errors.jsp.problem"/> <a href=\"javascript:displayStackTrace<%= randomNum %>()\"><fmt:message key="errors.jsp.ClickHere"/></a> <fmt:message key="errors.jsp.ToSee"/><br><fmt:message key="errors.jsp.contactsupport"/> - <fmt:message key="errors.jsp.callhyperic"/></td>\n" + +" <td class=\"ErrorBlock\" width=\"100%\"><fmt:message key="errors.jsp.problem"/> <a href=\"javascript:displayStackTrace<%= randomNum %>()\"><fmt:message key="errors.jsp.ClickHere"/></a> <fmt:message key="errors.jsp.ToSee"/></td>\n" + " </tr>\n" + "</table>\n" + "</td>\n" + Modified: trunk/web/common/GenericError.jsp =================================================================== --- trunk/web/common/GenericError.jsp 2010-04-05 23:01:58 UTC (rev 14479) +++ trunk/web/common/GenericError.jsp 2010-04-05 23:21:31 UTC (rev 14480) @@ -70,7 +70,6 @@ <fmt:message key="error.Error.YouCan"/> <span id="stacktrace_link"> <html:link href="javascript:displayStackTrace()"><fmt:message key="error.Error.StackTraceHereLink"/></html:link> - <fmt:message key="errors.jsp.contactsupport"/> - <fmt:message key="errors.jsp.callhyperic"/><br/><br/> </span> <fmt:message key="error.Error.ReturnTo"/> <html:link href="javascript:history.back(1)"><fmt:message key="error.Error.PreviousPageLink"/></html:link> |
From: <dcr...@hy...> - 2010-04-05 23:02:06
|
Author: dcrutchf Date: 2010-04-05 16:01:58 -0700 (Mon, 05 Apr 2010) New Revision: 14479 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14479 Modified: trunk/build.xml Log: Removed junit dependencies from agent pdk build Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-04-05 22:42:34 UTC (rev 14478) +++ trunk/build.xml 2010-04-05 23:01:58 UTC (rev 14479) @@ -987,8 +987,6 @@ <include name="oro-2.0.8.jar" /> <!-- RT --> <include name="snmp4j-1.11.jar" /> <!-- All SNMP monitoring --> <include name="ant.jar" /> <!-- AI scans + util.TokenReplacer --> - <include name="junit-3.8.jar" /> <!-- test to help with support issues --> - <include name="junit-4.4.jar" /> <include name="commons-httpclient-3.1.jar" /> <!-- Lather --> <include name="commons-codec-1.3.jar" /> <!-- HTTPClient dep --> <!-- WebSphere: must be in the main classloader for reasons unknown --> |
From: <dcr...@hy...> - 2010-04-05 22:42:41
|
Author: dcrutchf Date: 2010-04-05 15:42:34 -0700 (Mon, 05 Apr 2010) New Revision: 14478 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14478 Modified: trunk/web/portal/PortletLayout.jsp Log: Added requires Modified: trunk/web/portal/PortletLayout.jsp =================================================================== --- trunk/web/portal/PortletLayout.jsp 2010-04-05 22:41:39 UTC (rev 14477) +++ trunk/web/portal/PortletLayout.jsp 2010-04-05 22:42:34 UTC (rev 14478) @@ -64,6 +64,8 @@ <script type="text/javascript"> var imagePath = "<html:rewrite page="/images/"/>"; dojo11.require('dojo.date'); + dojo.require('dojo.event.*'); + dojo.require('dojo.widget.*'); </script> <script src="<html:rewrite page='/js/prototype.js'/>" type="text/javascript"></script> <script src="<html:rewrite page='/js/popup.js'/>" type="text/javascript"></script> |
From: <dcr...@hy...> - 2010-04-05 22:41:49
|
Author: dcrutchf Date: 2010-04-05 15:41:39 -0700 (Mon, 05 Apr 2010) New Revision: 14477 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14477 Modified: trunk/plugins/sybase/etc/hq-plugin.xml trunk/plugins/sybase/src/org/hyperic/hq/plugin/sybase/SybaseSysmonCollector.java Log: Updated instructional text Removed unused import Modified: trunk/plugins/sybase/etc/hq-plugin.xml =================================================================== --- trunk/plugins/sybase/etc/hq-plugin.xml 2010-04-05 18:12:00 UTC (rev 14476) +++ trunk/plugins/sybase/etc/hq-plugin.xml 2010-04-05 22:41:39 UTC (rev 14477) @@ -227,7 +227,7 @@ <config type="measurement"> <option name="jdbcUrl" - description="JDBC Url (NOTE: localhost may not work)" + description="JDBC Url (NOTE: Use fqdn or IP, localhost is invalid)" default="jdbc:sybase:Tds:localhost:4100"/> <option name="jdbcUser" description="JDBC User" Modified: trunk/plugins/sybase/src/org/hyperic/hq/plugin/sybase/SybaseSysmonCollector.java =================================================================== --- trunk/plugins/sybase/src/org/hyperic/hq/plugin/sybase/SybaseSysmonCollector.java 2010-04-05 18:12:00 UTC (rev 14476) +++ trunk/plugins/sybase/src/org/hyperic/hq/plugin/sybase/SybaseSysmonCollector.java 2010-04-05 22:41:39 UTC (rev 14477) @@ -19,7 +19,6 @@ import org.hyperic.hq.product.CollectorResult; import org.hyperic.hq.product.JDBCMeasurementPlugin; import org.hyperic.hq.product.Metric; -import org.hyperic.hq.product.MetricUnreachableException; import org.hyperic.hq.product.MetricValue; import org.hyperic.hq.product.PluginException; import org.hyperic.util.jdbc.DBUtil; |
From: Thiago F. de M. <sig...@hy...> - 2010-04-05 19:52:57
|
Hi, Part of discussion is occurring at debian-mentors list [1], the rest by email. [1] - http://lists.debian.org/debian-mentors/2010/03/msg00438.html |
From: <rm...@hy...> - 2010-04-05 18:12:08
|
Author: rmorgan Date: 2010-04-05 11:12:00 -0700 (Mon, 05 Apr 2010) New Revision: 14476 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14476 Modified: trunk/src/org/hyperic/hq/product/jmx/MxNotificationListener.java trunk/src/org/hyperic/hq/product/jmx/MxNotificationPlugin.java Log: [HHQ-2933] Allow notification.getType() to set the event log level. Modified: trunk/src/org/hyperic/hq/product/jmx/MxNotificationListener.java =================================================================== --- trunk/src/org/hyperic/hq/product/jmx/MxNotificationListener.java 2010-04-05 17:14:41 UTC (rev 14475) +++ trunk/src/org/hyperic/hq/product/jmx/MxNotificationListener.java 2010-04-05 18:12:00 UTC (rev 14476) @@ -199,7 +199,22 @@ } long time = notification.getTimeStamp(); + + // Default level to INFO int level = LogTrackPlugin.LOGLEVEL_INFO; + + // Check notification.getType() for Error, Warn, Info, Debug (case insensitive) + String typeString = notification.getType(); + if(typeString != null) { + if(typeString.equalsIgnoreCase(LogTrackPlugin.LOGLEVEL_ERROR_LABEL)) { + level = LogTrackPlugin.LOGLEVEL_ERROR; + } else if(typeString.equals(LogTrackPlugin.LOGLEVEL_WARN_LABEL)) { + level = LogTrackPlugin.LOGLEVEL_WARN; + } else if(typeString.equals(LogTrackPlugin.LOGLEVEL_DEBUG_LABEL)) { + level = LogTrackPlugin.LOGLEVEL_DEBUG; + } + } + String source = notification.getSource().toString(); if (isAttrChange) { Modified: trunk/src/org/hyperic/hq/product/jmx/MxNotificationPlugin.java =================================================================== --- trunk/src/org/hyperic/hq/product/jmx/MxNotificationPlugin.java 2010-04-05 17:14:41 UTC (rev 14475) +++ trunk/src/org/hyperic/hq/product/jmx/MxNotificationPlugin.java 2010-04-05 18:12:00 UTC (rev 14476) @@ -44,9 +44,6 @@ super.configure(config); - //no concept of log levels in JMX notifications - setLogLevel(LOGLEVEL_INFO); - this.listener = MxNotificationListener.getInstance(this); @@ -88,6 +85,6 @@ } protected boolean supportsLogLevels() { - return false; + return true; } } |
From: <dcr...@hy...> - 2010-04-05 17:14:52
|
Author: dcrutchf Date: 2010-04-05 10:14:41 -0700 (Mon, 05 Apr 2010) New Revision: 14475 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14475 Removed: trunk/plugins/sybase/scripts/get_sysmon_stats.pl Modified: trunk/plugins/sybase/etc/hq-plugin.xml Log: Updating code based on code review feedback Removed unused perl script and references to it Modified: trunk/plugins/sybase/etc/hq-plugin.xml =================================================================== --- trunk/plugins/sybase/etc/hq-plugin.xml 2010-04-05 17:10:34 UTC (rev 14474) +++ trunk/plugins/sybase/etc/hq-plugin.xml 2010-04-05 17:14:41 UTC (rev 14475) @@ -44,9 +44,6 @@ <property name="template-config" value="jdbcUrl=%jdbcUrl%,jdbcUser=%jdbcUser%,jdbcPassword=%jdbcPassword%"/> - <filter name="sysmon_script" - value="pdk/work/scripts/sybase/get_sysmon_stats.pl"/> - <filter name="template" value="${domain}:Type=Server:${alias}"/> <metrics name="ServerMetrics"> @@ -404,7 +401,6 @@ <b>NOTES:</b> <ul> <li>To configure the jdbcUrl, specifiy the fully qualified domain name or IP address of the host machine. The use of localhost is invalid.</li> - <li>On Windows install <a href="http://www.activestate.com/activeperl">ActivePerl</a> and bind the extension .pl to automatically execute perl when the file type is invoked.</li> </ul> </p> ]]> Deleted: trunk/plugins/sybase/scripts/get_sysmon_stats.pl =================================================================== --- trunk/plugins/sybase/scripts/get_sysmon_stats.pl 2010-04-05 17:10:34 UTC (rev 14474) +++ trunk/plugins/sybase/scripts/get_sysmon_stats.pl 2010-04-05 17:14:41 UTC (rev 14475) @@ -1,242 +0,0 @@ -#!/usr/bin/perl -w - -use Getopt::Long; -use File::Basename; -use Sys::Hostname; -use FileHandle; -use IPC::Open2; -use strict; - -my $debug = 0; - -my (@Output); - -my $Interval = "00:05:00"; -my $Username = "sa"; -my $Passwd = ""; -my $Server = uc(hostname()); - -sub main -{ - getArgs(); - @Output = getSysmonOutput(); - printDeadLocks(); - printAvgLockContention(); - printTotalLockReqs(); - printCacheStats(); - printNetworkStats(); - printEngineStats(); -} - -main(); - -sub printEngineStats -{ - for (my $i=0; $i<@Output; $i++) - { - my $line = $Output[$i]; - chomp($line); - if ($line !~ /^\s+Engine Busy Utilization/) { - next; - } - $i+=2; - while ($Output[$i] =~ /^\s+Engine\s[0-9]+/) - { - my $line = $Output[$i++]; - chomp($line); - my (undef, undef, $engine_num, $cpu_busy, undef, $io_busy, undef) = - split /\s+/, $line, 6; - print "engine$engine_num.EngineUtilization=$cpu_busy\n"; - } - last; - } -} - -sub printCacheStats -{ - my $bool = 0; - for (my $i=0; $i<@Output; $i++) - { - my $line = $Output[$i]; - chomp($line); - if ($line =~ /^\s+Cache Search Summary/) { - $bool = 1; - printSummaryStats(\$i); - - } elsif ($line =~ /^\s+Cache:/) { - $bool = 1; - printNamedCacheStats(\$i); - - } elsif ($line !~ /^\s+Cache:/) { - next; - - } elsif ($bool && $line =~ /^=+/) { - last; - - } else { - next; - } - } -} - -sub printNamedCacheStats -{ - my ($i) = @_; - my $line = $Output[$$i]; - my (undef, undef, $cache_name) = split /\s+/, $line, 3; - $cache_name =~ s/\s+$//; - $cache_name =~ s/\s+/_/g; - print "$cache_name\n" if $debug; - if ($Output[$$i+=8] !~ /Cache Hits/) { - return; - } - my @array = split /\s+/, $Output[$$i]; - print "$cache_name.CacheHitsRatio=".($array[6]/100)."\n"; - @array = split /\s+/, $Output[$$i+=2]; - print "$cache_name.CacheMissesRatio=".($array[6]/100)."\n"; -} - -sub printSummaryStats -{ - my ($i) = @_; - my $line = $Output[++$$i]; - my @array = split /\s+/, $line; - print "TotalCacheHitsRatio=".($array[7]/100)."\n"; - $line = $Output[++$$i]; - @array = split /\s+/, $line; - print "TotalCacheMissesRatio=".($array[7]/100)."\n"; -} - -sub printNetworkStats -{ - my $buf = ""; - my $num = 0; - for (my $i=0; $i<@Output; $i++) - { - my $line = $Output[$i]; - chomp($line); - if ($line =~ /^\s+Total TDS Packets Received/) { - $num++; - $buf = "TDSPacketsReceived"; - - } elsif ($line =~ /^\s+Total TDS Packets Sent/) { - $num++; - $buf = "TDSPacketsSent"; - - } elsif ($num == 2) { - last; - - } else { - next; - } - while ($Output[++$i] !~ /^\s+Total/) { - last if ($i>=@Output); - } - my @array = split /\s+/, $Output[$i]; - print "$buf=".$array[7]."\n"; - } -} - -sub printDeadLocks -{ - my @array = grep /Deadlock Percentage/, @Output; - @array = split /\s+/, join("", @array); - print "Deadlocks=".$array[5]."\n"; -} - -sub printTotalLockReqs -{ - my @array = grep /Total Lock Requests/, @Output; - @array = split /\s+/, join("", @array); - print "TotalLockReqs=".$array[6]."\n"; -} - -sub printAvgLockContention -{ - my @array = grep /Avg Lock Contention/, @Output; - @array = split /\s+/, join("", @array); - print "AvgLockContention=".$array[6]."\n"; -} - -sub printOutput -{ - open(FILE, ">./sysmon.output"); - foreach my $line (@Output) - { - chomp($line); - print FILE "$line\n"; - } - close(FILE); -} - -sub getSysmonOutput -{ - my $cmd = "isql -Usa -P $Passwd -S $Server"; - print "$cmd\n" if $debug; - my $pid = open2(*READER, *WRITER, "$cmd") or die $!; - print WRITER "use master\n"; - print WRITER "go\n"; - print WRITER "sp_sysmon '$Interval'\n"; - print WRITER "go\n"; - print WRITER "quit\n"; - my @lines; - while (<READER>) { - push @lines, $_; - } - close(READER); - close(WRITER); - return @lines; -} - -sub execCmd -{ - my ($Cmd) = @_; - print "$Cmd\n" if $debug; - return `$Cmd`; -} - -######################### -# name: getArgs -# gets: nothing -# returns: nothing -# function: gets and sets the command line args -######################### -sub getArgs -{ - my ($bool_help, $arg_count); - $arg_count = @ARGV; - $Getopt::Long::ignorecase = 1; - - GetOptions("interval=s" => \$Interval, - "i=s" => \$Interval, - "username=s" => \$Username, - "u=s" => \$Username, - "passwd" => \$Passwd, - "p:s" => \$Passwd, - "server" => \$Server, - "s=s" => \$Server, - "help" => \$bool_help, - "h" => \$bool_help) || printUsage() && exit(1); - - if ($bool_help) { - printUsage(); - exit(0); - } - if ($Passwd eq "''") { - $Passwd = ""; - } -} - -######################### -# name: printUsage -# gets: nothing -# returns: nothing -# function: prints synopsis -######################### -sub printUsage -{ - my $thisprog = basename($0); - print "$thisprog [--help]\n"; - print "$thisprog:\n"; - print " -h, --help\n\n"; -} |