Jump to content
Sign in to follow this  
DarrenWhite99

Remote Monitors - PMI Encoded strings

Recommended Posts

If you have enabled Internationalization or Trending for a remote monitor, the DataIn field may look something like this:
PMI:MwB8AC0AMAAuADAAMgB8AFQAcgB1AGUAfAA4ADAAfAAwAHwALQB8ADMA

What?

These strings are Base64 Encoded Unicode Characters.
Here is some SQL Code to Decode/Encode these Advanced Monitors:

SELECT AgentID,GroupID,`Name`,DataIn,CONVERT(CONVERT(CAST(FROM_BASE64(SUBSTRING_INDEX(`DataIn`,':',-1)) AS BINARY) USING utf16le) USING utf8) AS DecodedDataIn,
CONVERT(TO_BASE64(CAST(CONVERT(CONVERT(CONVERT(CAST(BASE64_DECODE(SUBSTRING_INDEX(`DataIn`,':',-1)) AS BINARY) USING utf16le) USING utf8) USING utf16le) AS BINARY)) USING utf8) AS ReEncodedDataIn
FROM groupagents WHERE `DataIn` LIKE 'PMI:%';

Example:
SET @MonitorString='3|0.2|True|85|1|-|3'; SET @EncodedMonitor='PMI:MwB8ADAALgAyAHwAVAByAHUAZQB8ADgANQB8ADEAfAAtAHwAMwA=';
SELECT @MonitorString,CONVERT(CONVERT(CAST(FROM_BASE64(SUBSTRING_INDEX(@EncodedMonitor,':',-1)) AS BINARY) USING utf16le) USING utf8) AS DecodedDataIn;
SELECT @EncodedMonitor,CONVERT(CONCAT('PMI:',TO_BASE64(CAST(CONVERT(@MonitorString USING utf16le) AS BINARY))) USING utf8) AS ReEncodedDataIn;

When decoded, the data consists of 7 parameters, separated by "|".

Format for the parameters: 
1 - UNKNOWN meaning. A Version number? Example: 3
2 - Trending K-value - A decimal between 0.01 and 0.99. Can also have these special values: 2=Use Template, -1=No Trending
3 - Use Expressions. Value can be True or False
4 - Criteria from RESULT text field - When the criteria is State Based this value is specially formatted, and then the string is URI Encoded.
The State Based Criteria Format (before URI encoding) has 6 parameters separated by "|".
These are  'NormalComparisonOp|NormalResult|WarningComparisonOp|WarningResult|ErrorComparisonOp|ErrorResult'
5 - Smoothing values - 0=Sample,1=Smoothed,2=DailySmoothed,3=DOWSmoothed
6 - Internationalization Override. '-' if not defined. Otherwise is Base64 Encoded Unicode string. See below
7 - Result Type for comparison. 0=Numeric, 3=String

Internationalization Formatting (Language Overrides):
This value is stored in the 6th field of the "PMI:" style monitor.  Each language definition has two parameters separated by "|". Multiple language overrides can be defined, they are separated by "||". The entire resulting string is stored as a Unicode String that is Base64 Encoded.
1 - Language Code - 'en-GB'
2 - Criteria for Result Field. This uses the same string format (URI Encoded) as the 4th field in the PMI monitor.

Some example monitors and the decoded values:

Criteria: State Based - Unchecked the "Expression" checkbox. Trending factor=No Trending. Normal <=15, warning between 5 and 80, error >70
With Language Override: en-GB: Normal - 20, Warning - 10 and 85, Error - 75
Comparor=16,DataIn='PMI:3|-1|False|13%7C15%7C8%7C5 and 80%7C3%7C70|0|ZQBuAC0ARwBCAHwAMQAzACUANwBDADIAMAAlADcAQwA4ACUANwBDADEAMAAgAGEAbgBkACAAOAA1ACUANwBDADMAJQA3AEMANwA1AA==|3'
Criteria: State Based - Unchecked the "Expression" checkbox. Trending factor=Use Template Multiplier. Normal <=15, warning between 5 and 80, error >70
Comparor=16,DataIn='PMI:3|2|False|13%7C15%7C8%7C5 and 80%7C3%7C70|0|ZQBuAC0ARwBCAHwAMQAzACUANwBDADIAMAAlADcAQwA4ACUANwBDADEAMAAgAGEAbgBkACAAOAA1ACUANwBDADMAJQA3AEMANwA1AA==|3'
Criteria: State Based - Unchecked the "Expression" checkbox. Trending factor .25. Normal <=15, warning between 5 and 80, error >70
With Language Override: en-GB: Normal - 20, Warning - 10 and 85, Error - 75
Comparor=16,DataIn='PMI:3|0.25|False|13%7C15%7C8%7C5 and 80%7C3%7C70|0|ZQBuAC0ARwBCAHwAMQAzACUANwBDADIAMAAlADcAQwA4ACUANwBDADEAMAAgAGEAbgBkACAAOAA1ACUANwBDADMAJQA3AEMANwA1AA==|3'
Criteria: State Based - Trending factor .25. Normal <=15, warning between 5 and 80, error >70
With Language Override: en-GB: Normal - 20, Warning - 10 and 85, Error - 75
Comparor=16,DataIn='PMI:3|0.25|True|13%7C15%7C8%7C5 and 80%7C3%7C70|0|ZQBuAC0ARwBCAHwAMQAzACUANwBDADIAMAAlADcAQwA4ACUANwBDADEAMAAgAGEAbgBkACAAOAA1ACUANwBDADMAJQA3AEMANwA1AA==|3'
Criteria: State Based - Trending factor .25. Normal <=15, warning between 5 and 80, error >70
Comparor=16,DataIn='PMI:3|0.25|True|13%7C15%7C8%7C5 and 80%7C3%7C70|0|-|3'
Criteria: Threshold Less than 50 - Trending factor .25 - Using DOW Smoothed instead of sample.
Comparor=4,DataIn='PMI:3|0.25|True|50|3|-|3'
Criteria: Threshold Less than 50 - Trending factor .25 - Using Daily Smoothed instead of sample.
Comparor=4,DataIn='PMI:3|0.25|True|50|2|-|3'
Criteria: Threshold Less than 50 - Trending factor .25 - Using Smoothed instead of Sample.
Comparor=4,DataIn='PMI:3|0.25|True|50|1|-|3'
Criteria: Threshold Less than 50 - Trending factor .25 - Changed from "string" to "numeric"
Comparor=4,DataIn='PMI:3|0.25|True|50|0|-|0'
Criteria: Threshold Less than 50 - Trending factor .25
Comparor=4,DataIn='PMI:3|0.25|True|50|0|-|3'
Criteria: Threshold Less than 50 - Trending factor  .75
Comparor=4,DataIn='PMI:3|0.75|True|50|0|-|3'
Criteria: Threshold Less than 80 - Trending factor  .75
Comparor=4,DataIn='PMI:3|0.75|True|80|0|-|3'
Criteria: Threshold Greater than 80 - Trending not specified.
Comparor=3,DataIn='PMI:3|-0.02|True|80|0|-|3'
Criteria: State Based - Trending factor .25. Normal <=15, warning between 5 and 80, error >70
With Language Override: en-GB: Normal - 20, Warning - 10 and 85, Error - 75
Raw value: ZQBuAC0ARwBCAHwAMQAzACUANwBDADIAMAAlADcAQwA4ACUANwBDADEAMAAgAGEAbgBkACAAOAA1ACUANwBDADMAJQA3AEMANwA1AA==
Decoded Value: en-GB|13%7C20%7C8%7C10 and 85%7C3%7C75

Hope this helps!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×