Hello Foglight Folks,
Robert Statsinger here. Here’s a brief note for folks who are migrating from Foglight 4 to Foglight 5 and who have script agents coming along for the ride.
Geoff Vona has written some excellent blog articles on Foglight 5 script agents – you should read them as prerequisites. They can be found here:
Custom Agents – Introduction to Script Agents
Custom Agents – Script Agent Data Modeling and Units
This article is a short addition intended specifically to help you port your existing Foglight 4 script agents so that they’ll run on Foglight 5. All you’ll have to do is modify some of the echoed outputs in your agent so that they’ll be understood inside Foglight 5’s models - you’ll find this to be a simple process. Before we start though I want to quickly review the data types that you can send up to Foglight 5 in your script agents:
Geoff has covered this information in detail in his blogs – what we need to remember here is:
- Properties are pieces of data that are not expected to frequently change
- Identity Properties are Properties that serve as unique identifiers for an instance of the data you’re sending
- Observations are pieces of data that are expected to frequently change, and they can be either StringObservations or Metrics
- In Foglight 5, Metrics can have units. If you don’t specify one, the default unit for a Metric is ‘count’
Given these, here’s our simple recipe for porting a Foglight 4 script agent:
- Required: For entries that return a string, such as myStringValue = somestring, decide if myStringValue should be a Property, an Identity Property, or a String Observation. So change this to:
myStringValue.String.Id = somestring if myStringValue is going to be an Identity Property myStringValue.String = somestring if myStringValue is going to be a non-identity Property myStringValue.StringObservation.Obs = somestring if myStringValue is going to be a StringObservation
- Recommended: For entries that return numerical values, such as CpuUtilization = 50, add a unit name to the metric, so you could have:
CpuUtilization:percent = 50
Geoff lists all the possible unit names in his second blog article cited above so I won’t repeat them here.
That should do it - your script agent should now be ready to rock in Foglight 5.