ideri / IDERInote

Various tools for IDERI note.
1 stars 0 forks source link

PRTG notify - Error: Input string was not in a correct format when using %message placeholder of PRTG #3

Open B4DschK4Pp opened 2 years ago

B4DschK4Pp commented 2 years ago

Error sending "EXE": Error1. C:\Program Files (x86)\PRTG Network Monitor\Notifications\exe\notify-via-IDERInote.ps1 : Failed to create a connection to the IDERI note server. Exception calling "Parse" with "1" argument(s): "Input string was not in a correct format." At line:1 char:[...] (Sensor ID: 2080 | Trigger Source ID: 2080 | Trigger ID: 3)

This error appears sometimes. Maybe because the strings passed are not escaped properly (see screenshot) 7227C80F-505C-45C4-80B8-C3B6188B6157

B4DschK4Pp commented 2 years ago

Message passed by PRTG: 'Warning caused by lookup value 'Unable to check revocation status' in channel 'Revoked' - -119 # (Days to Expiration) is below the error limit of 7 # in Days to Expiration. Certificate will expire in less than 7 days. (OK. Certificate Common Name: note-srv01.note.dev - Certificate Thumbprint: AA2FA080D931F6F890EB65DBDD7475F63E646E3A)'

B4DschK4Pp commented 2 years ago

Test showed that it will work when you pass the %message with double quotes (“) instead of single quotes (‘). Should be investigated more on how to pass correctly and escape correctly.

B4DschK4Pp commented 2 years ago

This seems to be a known issue and others have requested to access the placeholders via environment variables aswell, as this would make it possible to access the placeholders from within the script directly and deal with them internally, instead of passing them as parameters.

https://kb.paessler.com/en/topic/90453-single-quotes-in-message-break-notification-script#reply-314370

B4DschK4Pp commented 2 years ago

For now it seems we cannot include the text of %message placeholder as it may break the notification script. We have to get rid of the parameter so the script works more reliable.

When PRTG will provide a fix or solution on how to proceed with this issue we could use it again.