I have created a plugin to display energy consumption and cost.
When the target instance is deployed/redeployed to the agent and monitored using EM console I can see the right data displayed.
If I logout of em console or I try to access the same target Instance from a different machine using the em console I get the following errror.
**2012-05-16 11:45:47 [MpCui] ERROR Unhandled Error [Unexpected Error]: An unexpected error has occurred while processing the page or dialog "MetaDataPageActivityDef[homePg]". The user interface item "mpDefault0...LineChart138" has reported the error: faultCode:DataServiceErr faultString:'An error occurred calling the metric data service.' faultDetail:'MetricDataService:getHistoricalData:SQLException:java.sql.SQLException: Invalid column name'*The UI for monitoring is Implemented using the declarative/Metadata method of MPCUI framework.*
Below I am listing my mpcui ,targettype and default collection files.
I don't see anything clearly wrong in your target type or mpcui meta-data though the error indicates a request for historical data (MetricDataService.getHistoricalData) which does not agree with anything in the mpcui code (all your references are to real-time). Also, in the browser where you see this error, can you go to the Target menu and go to the Monitoring->All Metrics page. On this page please verify that you can view the metric you are referencing from your mpcui meta-data (e.g. the EnergyConsumptionCost metric, the EnergyConsumption and EnergyCost columns) and that you can see data history and also real-time values. You do this by selecting a column and then use the "View Data" dropdown to change the period from Real-Time to any of the historical ranges.
When you go to the homepage where you see the error, please add "&loglevel=ALL,CONSOLE&traceEnabled=true" to the URL in the browser address bar and then reload the page. A small logging window should appear near the bottom of the page. Once the error has occurred please capture the messages logged to this window and either post them here or e-mail them to me (email@example.com).
I am sending u the details of the log message generated and the SOAP Message along with the screen shots for metric collection at the following email id firstname.lastname@example.org.
One more doubt that I want to ask
At present the metric "EnergyConsumptionCost" doesnot have any Key column defined and I am gathering the data is real time,so when my fetchlet is called it returns me the sample data with different values for EnergyCost and EnergyConsumption,i.e fetchlet returns multiple rows for the same deviceName instance Property.
The Agent will try to store this values in repository.
If we donot define the Key column will that effect the working of home page when we logout of the em console.
To check the behaviour I added a column named "SrNo" of type Number and defined it as " IS_TRUE=TRUE" , generated the .opar file and imported.
When I deploy the generated opar file to OMS server my target_type.xml file has my key column missing because of which the sql script generated doenot have any mention of my "SrNo" column. How can this be resolved.
There are a couple of issues that we’ll need to discuss with you. The first is to help you understand metric keys, how to use them and how to version your meta-data. One of us will get back to you on that or have someone else from the EM team respond on that issue.
The second problem relates to your MPCUI meta-data and the error you are seeing. Based on the screenshots and logs you’ve sent (thanks this is very helpful), you’ve created the “EnergyConsumptionCost” metric but have not added anything to the default_collection for it, so there is no historical data saved to the repository. This is confirmed in the All Metrics page where you see no historical data.
In your MPCUI code you have several LineCharts that reference the metric and use the timePeriod=”REALTIME”. You also have the MetricValuesDataService tag below., and it includes the timePeriod=”REAL_TIME”.
There are two things here. The first problem with this tag is “REAL_TIME”. This is a typo and should be “REALTIME” if you needed to keep this. I don’t see any error in the meta-data handling in the TraceLog.txt that indicates this is a problem, so this is something we need to address on our end.
The second issue is that you don’t reference this dataservice (mv1) anywhere in your mpcui meta-data. Because you don’t actually use this you can safely remove this tag from your meta-data. You only need to declare a dataservice (MetricValuesDataService, SqlDataService, etc.) if you are going to use it within a component elsewhere.
A couple of things. Are you now able to see both real-time and historical data in the All Metrics page? Can you please send me updated logs with traceEnabled turned on and the request/response messages for the failed request?
Finally, collecting a metric historically every 2 or 3 minutes is not typical. Given the possible volume of data we don't recommend collecting metrics more frequently than every 5 minutes.
The problem is that the columns to be plotted in the LineChart are "STRING" type and need to be "NUMBER" type. The error is not clear, but is indicating that the rollup tables don't include the metric columns being requested (because STRING columns aren't aggregated). We will file a bug to provide a better error message, but the datatype of the columns needs to be changed if they are going to be shown in a LineChart.
Thanks for your suggestions and now the data on the UI is shown correctly.
I have few queries
1> Can we use the "CompareTarget" feature provided on the history page declaratively on our custom MPCUI page.
2> Can you put some more light on the Key column defined in the Metric defination?When do we define them.
MyUnderstanding is " Key column must be defined when a single call to the fetchlet returns more than one row"
3> If I have to show the data for the user given date range on my line chart what approach I need to take.Declarative /Programmatic