-
New Feature Request
-
Resolution: Duplicate
-
Trivial
-
4.4.6
-
None
Hi,
I had to configure a new template in order to monitor some http redirections, they should change every 24h or an alarm has to raise.
I did not find how do do this trough the web gui, I could't create a trigger to comparte the actual item text value to the one 24h ago (didn't find an easy way to compare strings), but was able to do it via UserParameters:
UserParameter=curl.get.redirecturl.hash[*],perl -le 'print shift()/1e27' $(printf "%f\n" 0x$(curl -m 5 -sI $1 | sed -n '/^Location:/ s/^Location:\s//p' | md5sum | cut -d ' ' -f1))
So basically I get the URL of the redirection with curl, hash it with md5, that gives a hex number, which is converted to decimal.
That number is too big to be stored on a item as a float, so it is divided by 1e27.
I thought that a preprocessing option to convert any text to a numeric hash value (probably using a more suitable hash function) can come very handy, as a easy way to compare strings in order to create triggers.
Thank you.
- duplicates
-
ZBXNEXT-702 Compare last "text" value with any other string
- Closed