A.2 Agent_CreateData

This function creates an AppManager data point. If this is the first data point for this datastream, AppManager automatically creates the datastream header. The arguments to this function are listed below in the order they should be passed to the function.

Required arguments:

  • $stream_name identifies the datastream. This name must be unique among all of the datastreams generated by the job. The stream name is not exposed to users, so it does not need to be easily readable. The stream name is used solely to tie all data points representing the same measurement (one during each iteration of the job) together into a single stream.

  • $am_legend describes what this datastream measures. AppManager uses this legend, but not Analysis Center. The legend should be a single line of text that describes the resource with which the datastream is associated, as well as the measurement the datastream represents, such as Number of restarts for service X. For data points that have associated units, add "^^<units>" to the end of the string, such as "CPU usage^^%".

  • $ac_legend defines the Analysis Center (AC) dynamic legend XML, or $null if no AC legend is included. Analysis Center uses this legend, but AppManager does not. If Analysis Center will not be used to report on this datastream, pass $null for this argument. Otherwise pass a legend produced by the Agent_BuildDynamicLegendXML function.

  • $resource defines the type and name of the resource object with which this event is associated. For scripts or commands executed using the PowerShell_RunCommand job, specify this value as "NT_PowerShellFolder = $NT_PowerShellFolder".

  • $value defines the numeric (integer or floating point) value of the data point to be created.

  • $detail_msg defines the text of the data detail message. This can be either plain text or an XML string that describes how the message should be formatted into a table (see Agent_BuildDetailTableXML). Pass $null if no detail message is to be associated with the data point.

Returns:

  • This function returns no value.

Example usage:

  • To create a data point for CPU usage, with no Analysis Center legend and no detail message:

    Agent_CreateData "CPU usage" "CPU usage^^%" $null "NT_PowerShellFolder = $NT_PowerShellFolder" 93.5 $null