Hello!
I've configured a discovery rule that is an HTTP agent. This discovery is using a URL that returns a token value. What's happening is: I've created an prototype item on this discovery rule, it's a HTTP agent too, but this item will consum the discovery rule response (the token part) because this API requires a token change. So what I've done was:
1. create a JavaScript preprocessing that transform this discovery rule http agent response in a array and it's working, my response is: [{"token":{"token":"MY-TOKEN","result":null,"resultCode":"0","requestId": "xxx"}]
2. With this answer, I've created two LLD macros: {#TOKEN} with jsonpath: $.[0].token.token and {#REQUESTID} with jsonpath: $.[0].token.requestId, I've tested and it's right.
Ok, for me, it seems that everything was right. After this, I've created my prototype item:
1. put the key as: test.[#REQUESTID]
2. it's an HTTP agent so I parse the URL, which is something like: http://hostname/aaaa/bbbb/cccc/dd/ff...token=MY-TOKEN, and in this token part, I did like this:

That's all. But it's not working... I don't know why, but I receive a return that my http agent item prototype is not receiving the correct token, it's invalid. It seems that it's not recognizing my token macro
Help!
Thanks a lot.
I've configured a discovery rule that is an HTTP agent. This discovery is using a URL that returns a token value. What's happening is: I've created an prototype item on this discovery rule, it's a HTTP agent too, but this item will consum the discovery rule response (the token part) because this API requires a token change. So what I've done was:
1. create a JavaScript preprocessing that transform this discovery rule http agent response in a array and it's working, my response is: [{"token":{"token":"MY-TOKEN","result":null,"resultCode":"0","requestId": "xxx"}]
2. With this answer, I've created two LLD macros: {#TOKEN} with jsonpath: $.[0].token.token and {#REQUESTID} with jsonpath: $.[0].token.requestId, I've tested and it's right.
Ok, for me, it seems that everything was right. After this, I've created my prototype item:
1. put the key as: test.[#REQUESTID]
2. it's an HTTP agent so I parse the URL, which is something like: http://hostname/aaaa/bbbb/cccc/dd/ff...token=MY-TOKEN, and in this token part, I did like this:
That's all. But it's not working... I don't know why, but I receive a return that my http agent item prototype is not receiving the correct token, it's invalid. It seems that it's not recognizing my token macro
Help!
Thanks a lot.
but there's no item on this host
Comment