Home      
  
   *Discussion Forum      
  
   Blog      
  
   www.quest.com      
  
Welcome Register | Login
Welcome Guest Search | Active Topics | Members

Can't find data collected by the custom agent Options
xchang
Posted: Thursday, March 04, 2010 8:58:51 AM
Rank: Contributing Member
Groups: Member

Joined: 1/21/2010
Posts: 16
Location: N/A

We are on 5.5.4 and we are trying to build a custom agent using fglam dev kit. Based on the TimeAgent example, I created a TestFglAMAgent to basically collects current time (time) and a random number (testfield). It compiled and the car file was installed successfully, the agent is running, but I can't find the data it collected.

Here are the files that I created. i.e. agent-definication.xml, testagent-topology.xml and TestFglAMAgentImpl.java file. Can someone please help me identify the problem? Thanks.

1. agent-definition.xml
<agent-definition xmlns="urn:X-quest.com:glue/agent/definition/1.5"
name="TestFglAMAgent" ver="1.2.0">
<topology-types filename="testagent-topology.xml"/>

<agent name="TestFglAMAgent" package="com.amfam.foglight.test" class-name="TestFglAMAgentImpl">
<data-collection>
<collector name="Normal Collection" method-name="normalCollection" value="5" unit="minutes"/>
</data-collection>
<properties>
<group id="base" label="Configuration">
<string id="TestASP" size="16" default="test" label="Test ASP"/>
</group>
</properties>
<topology-sample name="TestFglAMAgent_Table"/>
</agent>
</agent-definition>

2. testagent-topology.xml (I don't want the data to show up under "All Data", I want the data to show up under Host/Agent, so I did not extend "CollectionModelRoot")
<types>
<type name="TestFglAMAgent_Table" extends="TopologyObject">
<property name="host" type="Host" is-containment="true" is-identity="true"/>
<property name="agent" type="Agent" is-containment="true" is-identity="true"/>
<property name="time" type="StringObservation" is-containment="true"/>
<property name="testfield" type="Metric" is-containment="true"/>
</type>
</types>

3. TestFglAMAgentImpl.java
public class TestFglAMAgentImpl implements com.quest.glue.api.agent.Agent, /* name conflicts with topology type 'Agent' */
ASPService2.Listener,
TestFglAMAgentCollectors {

private final LogService.Logger mLogger;
private final RegistrationService mRegistrationService;
private final TopologyDataSubmissionService.TopologySubmitter mSubmitter;
private final UnitService mUnits;
private final TimestampService mTimestamp;
private final AgentMetadataService mAgentInfo;

private final TestFglAMAgentPropertyWrapper mProperties;
private TestFglAMAgent_Table mSample;

/**
* Called by Glue to create a new instance of this agent.
*/
public TestFglAMAgentImpl(ServiceFactory serviceFactory)
throws ServiceFactory.ServiceNotAvailableException {

LogService logService = serviceFactory.getService(LogService.class);
mLogger = logService.getLogger(TestFglAMAgentImpl.class);

ASPService2 aspService = serviceFactory.getService(ASPService2.class);
// TimeAgentPropertyWrapper is automatically generated by the tooling based
// on the sample type definitions in the agent-definition.xml file.
mProperties = new TestFglAMAgentPropertyWrapper(aspService);

mRegistrationService = serviceFactory.getService(RegistrationService.class);
// This will automatically register all the service-related listeners
// implemented by this class.
mRegistrationService.registerAllListeners(this);

mTimestamp = serviceFactory.getService(TimestampService.class);
mAgentInfo = serviceFactory.getService(AgentMetadataService.class);

//
// Set up the objects we use to track the data we are collecting
// and the services needed to submit that data to the server.
//
mUnits = serviceFactory.getService(UnitService.class);
final TopologyDataSubmissionService subService =
serviceFactory.getService(TopologyDataSubmissionService.class);
mSubmitter = subService.getTopologySubmitter();

}

/**
* Called by Glue at the end of the agent's life
*/
public void destroy() {
mRegistrationService.unregisterAllListeners(this);
}

/**
* Called by Glue to begin data collection.
* <p/>
* Because this agent submits metrics at a regular interval it uses the timer
* service to make callbacks according to the configured period. It sets the
* expected rate of submission for the CurrentTime sample on the data service
* so that gaps in the data can be detected by the server.
* <p/>
* Both these steps are optional. Agents are free to implement whatever data
* collection strategy they desire and can submit samples at any arbitrary
* time.
*/
public void startDataCollection() {
mLogger.debug("Starting data collection");
final Host h = new Host(mSubmitter.getHost());

// we could fill in other information about the host here, but
// the name is the only required identity field.
//
// For example, we could add OS info to the host.
OperatingSystem os = new OperatingSystem(h);
h.setOs(os);

os.setName(mSubmitter.getHostOsName());
os.setArchitecture(mSubmitter.getHostArchitecture());
os.setVersion(mSubmitter.getHostOsVersion());

// Or we can add an IP address
IPAddress ip = new IPAddress(mSubmitter.getHostAddress().getHostAddress());
h.setPrimaryIpAddress(ip);

// the agent id is the only required identity property for agent
// topology types and the server fills that in automatically for us.
final Agent agent = new Agent();
// These are all optional. Having them might make your dashboards easier
// to write, but any or all can be omitted if you don't need them.
agent.setAgentVersion(mAgentInfo.getPackageVersion());
agent.setBuild(mAgentInfo.getPackageVersion());
agent.setHostName(h.getName());
agent.setType(mAgentInfo.getUnqualifiedTypeName());
agent.setMonitoredHost(h);

agent.setAgentName(mAgentInfo.getUnqualifiedInstanceName());
// This is the value that will be displayed in the data browser on the
// server. setAgentName() is specific to the Agent topology object,
// but setName() is a common property and it is what the data browser
// looks for. It does not have to be the same as the value passed to
// setAgentName()
agent.setName(mAgentInfo.getUnqualifiedInstanceName());
String an = mAgentInfo.getUnqualifiedInstanceName();
mLogger.log("Agent name=" + an);
// name is a required identity property when subclassing CollectionModelRoot
mSample = new TestFglAMAgent_Table(h, agent);
}

/**
* Called by Glue when data collection should be stopped.
*/
public void stopDataCollection() {
mLogger.debug("Stopping data collection");
}

/**
* Respond to property changes.
* <p/>
* This method is part of the ASPService2.Listener interface and is not required
* by agents that do not implement it.
* <p/>
* Agents can receive property changes while they are running, and it is up to
* the agent developer to ensure that modifications do not break the agent.
* <p/>
* In this case the only property to change is the scheduled sample period,
* so the data collection is stopped and restarted with the new setting.
*/
public void propertiesChanged(boolean primaryChanged, Set<String> secondariesChanged) {
if (primaryChanged) {
mLogger.log("update ASP", "changed");
}

}

/**
* Normal Collection Data Collector
*
* @param collectionFreqInMs the collection frequency for this collector, in ms.
*/
public void normalCollection(long collectionFreqInMs) {
final long now = System.currentTimeMillis();
final Date dateNow = new Date(now);
mSample.setTime(dateNow.toString());
mSample.setTestfield(new SampleMetric(new Double(Math.random())));

mLogger.log("Submitting standard data sample.");

// Submit the data, remember that the frequency in the ASP is in seconds,
// and the data submission code expects it in milliseconds.
//
// Because this agent submits metrics at a regular interval it sets the
// expected rate of submission for the TimeAgentCurrentTime sample on the
// data service so that gaps in the data can be detected by the server.
try {
mSample.submit(mSubmitter, mUnits, collectionFreqInMs, now);
}
catch ( TopologyDataSubmissionService.InvalidArgumentException ive ) {
mLogger.log("couldNotSubmitData", ive);
}
}

}
BrianW
Posted: Thursday, March 04, 2010 1:59:16 PM

Rank: Guru Member
Groups: Member

Joined: 7/16/2008
Posts: 138
Location: New York
In general, you will find the data by opening the Data Browser (Configuration/Data), then open Foglight/All Agents.
You should find the metrics in the same place if you create a Drag and Drop dashboard, open the Data Tab in the Action Pane, then open Foglight/All Agents/<your_agent_name>.

Regards,
Brian Wheeldon
xchang
Posted: Thursday, March 04, 2010 2:38:03 PM
Rank: Contributing Member
Groups: Member

Joined: 1/21/2010
Posts: 16
Location: N/A

Thanks Brian. The problem is that I can find my agent under Foglight/All Agents, but there is no metrics under my agent, I defined 2 properties (time and testfield), and none of them shows up under the agent. But if I use Tooling/Script Editor, I can find the Topology Type, and I can query the data that way, so I am sure the data (time and testfield) got collected, but I just cannot view the data other than using the Script Editor.

Thanks,
Xchang
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

SoClean Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under DotNetNuke.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.

Disclaimer: The posts on this forum are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are those of the individual and the individual alone, and do not necessarily represent those of Quest Software.

 

 News

 

Gartner Positions Quest
as a Leader
in Magic Quadrant for
Application Performance
Monitoring

Get your copy of the report 

 

 Latest Release

 

Foglight v5.5.5
Download Product

 

  

 Related Communities
 Related Quest Tools

 

Home | Discussion Forum | Blog | www.quest.com

@ 2008 Quest Software, Inc. All rights reserved. | Terms of Use | Trademarks | Privacy | Contact Us