Importing KPI history
Using the ImportKpiHistory script, you can create or update key performance indicator (KPI) history for one or more KPIs. The model version and KPI must have previously been deployed on the monitor server.
Purpose
The ImportKpiHistory script creates or updates the KPI history for one or more KPIs
Location
monitor_root/scripts.wbm/kpi/importKpiHistory.jyImport KPI History file format
KPI History files are imported using the Jython script described in the next section. The KPI History files must be copied to the Monitor server before uploading. If records in the KPI History Import file do not exist in the KPI History table, the rows are added. If the record already exists, the History Value, History Update Time, Prediction Basis Time, and Prediction Basis Value are updated. The KPI History Import utility uses a tab delimited file in the following format:
| Field | Example | Description |
|---|---|---|
| MODEL_ID | OrderItem | The Monitor model ID. Create only, cannot be updated. |
| KPI_ID | avgPriceToday | Key performance indicator (KPI) ID. Duration KPIs are specified in milliseconds. Create only, cannot be updated. |
| VERSION | 20080918060000 | Version of the Monitor model. Create only, cannot be updated. |
| PERIOD_TIMESTAMP | 2009-01-01T04:00:00 | Reference timestamp for the KPI history. Create only, cannot be updated. |
| OBSERVED_TIME | 2009-01-01T04:04:21 | Actual time the KPI History was recorded. Create only, cannot be updated. |
| OBSERVED_VALUE | 556.23 | Actual value of the KPI when observed. Import only, cannot be updated. |
| TARGET | 1000 | Target value of the KPI. Create only, cannot be updated. |
| HISTORY_UPDATE_TIME | 2009-01-01T04:04:21 | Time the KPI History value was last updated. This value can be updated by the import. |
| HISTORY_VALUE | 556.23 | Value used for KPI history when retrieved by REST. This is the value that is actually presented for graphing by the KPI History REST service. This value can be updated by the import. |
| PREDICTION_BASIS_TIME | 2009-01-01T04:04:21 | Time the KPI Prediction Basis value was last updated. This value can be updated by the import. |
| PREDICTION_BASIS_VALUE | 556.23 | Value used for KPI prediction utility. This value can be updated to smooth out inconsistent data that might cause KPI predictions to be erroneous. This value can be updated by the import. |
Import KPI History Results
The KPI History Import utility generates a file with .discard attached to the end. This file contains records that were not imported. For example, if the import file is named importdata.csv, the discard file is generated as importdata.csv.discard.
Parameters
| Parameter | Description | Comments |
|---|---|---|
| import_filename | The name of the file being imported. | |
| host_name | The name of the host where IBM® Business Monitor is installed. This can be localhost. | |
| port_number | The SOAP connector port of the WebSphere® Application Server server. Using the WebSphere Application Server administrative console, you can find this information by clicking |
Windows usage
- For a stand-alone IBM Business Monitor environment:
profile_root\bin> wsadmin -wsadmin_classpath "..\..\..\plugins\com.ibm.wbimonitor.lifecycle.spi.jar;..\..\..\plugins\com.ibm.wbimonitor.repository.jar" -lang jython -f "..\..\..\scripts.wbm\kpi\importKpiHistory.jy" import_filename.csv -conntype SOAP -host host_name -port port_number
- For Rational® Application Developer development toolkit:
profile_root\bin> wsadmin -wsadmin_classpath "..\..\..\plugins\com.ibm.wbimonitor.lifecycle.spi.jar;..\..\..\plugins\com.ibm.wbimonitor.repository.jar" -lang jython -f "..\..\..\scripts.wbm\kpi\importKpiHistory.jy" import_filename.csv -conntype SOAP -host host_name -port port_number
- For Integration Designer development toolkit:
profile_rootbin> wsadmin -wsadmin_classpath "..\..\..\plugins\com.ibm.wbimonitor.lifecycle.spi.jar;..\..\..\plugins\com.ibm.wbimonitor.repository.jar" -lang jython -f "..\..\..\scripts.wbm\kpi\importKpiHistory.jy" import_filename.csv -conntype SOAP -host host_name -port port_number
importKpiHistory.jy "c:\kpiHistoryExport.xml" -conntype SOAP -host localhost -port 8880
Linux and UNIX usage
- For a stand-alone IBM Business Monitor environment:
profile_root/bin> ./wsadmin.sh -wsadmin_classpath "../../../plugins/com.ibm.wbimonitor.lifecycle.spi.jar:../../../plugins/com.ibm.wbimonitor.repository.jar" -lang jython -f "../../../scripts.wbm/kpi/importKpiHistory.jy" import_filename.csv -conntype SOAP -host host_name -port port_number
importKpiHistory.jy "/kpiHistoryExport.xml" -conntype SOAP -host localhost -port 8880