Transforming a value to string to use in custom error message
-
Current I report the current value of the DCI using the %<currentValue>
For the ServiceCheck.HTTP the value can be 0 to 3.
I would rather have a textual description instead of the numerical value. I thought of using a the transformation script but this will change the type from int to string which cannot be graphed.
Another place where I could do this is in the filtering script where CUSTOM_MESSAGE can be set.sub main()
{
CUSTOM_MESSAGE = "";
if($1->value == 2)
{
CUSTOM_MESSAGE = "cannot connect to server";
}
else
if($1->value == 3)
{
CUSTOM_MESSAGE = "content of does not match";
}return true;
}How do I test the “value” within the filtering script ($1->value above does not work of course) ?
Or maybe there's a better solution?Regards,
Dan
-
Hi!
I would suggest calling a script from macro, like this:
- Create script called "ServiceStateName" in script library:
state = GetEventParameter($event, "currentValue"); switch(state) { case 0: return "OK"; case 1: return "error in parameters"; case 2: return "cannot connect to server"; case 3: return "content of does not match"; } return "UNKNOWN";- Use %[ServiceStateName] instead of %<currentValue>
Best regards,
Victor -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login