Data Collection Table and regex
-
Howdy,
We were trying to get an agent to monitor SSL certificate expiration dates. We were able to achieve this with the ExternalParameterShellExec command, regex and some other commands to calculate the remaining seconds before expiration. My manager wanted me to create a table with all our SSL websites and the remaining time for each. I tried several ways to use regex to validate the string before the calculations but it seems that the transformation script on the Data Collection table doesn't support regex at all. Below are the two ways I tried to get regex to work, I use the "match" version in the ExternalParameterShellExec command and it's working flawless. If there is any regex in the transformation script, the collection errors out.
idate = $1->getColumnIndex("Date"); ireman = $1->getColumnIndex("Remaining"); for (i=0; i<$1->rowCount; i++) { value = $1->get(i,idate); if (value match "^([A-Za-z]+)\s+([0-9]+)\s+([0-9]+):([0-9]+):([0-9]+)\s+([0-9]+)") { //alot of conversion and math is omitted $1->set(i,ireman,value); } }idate = $1->getColumnIndex("Date"); ireman = $1->getColumnIndex("Remaining"); for (i=0; i<$1->rowCount; i++) { value = $1->get(i,idate); if (value ~= "^([A-Za-z]+)\s+([0-9]+)\s+([0-9]+):([0-9]+):([0-9]+)\s+([0-9]+)") { //alot of conversion and math is omitted $1->set(i,ireman,value); } }I've also tried to just inject a value myself instead of pulling from the table and it still gives an Error on updating the table
idate = $1->getColumnIndex("Date"); ireman = $1->getColumnIndex("Remaining"); for (i=0; i<$1->rowCount; i++) { value = 1; if (value ~= "([0-9])") //tried both match and ~= for the regex { $1->set(i,ireman,1); } }I can't seem to find the answer on the forum of in any documentation that I can find. Any help would be appreciated.
Thank you,
Josh -
If I understand you correctly, you are trying to use a Table DCI and fill it in with data.
Did you consider using summary tables - it's a way to show a DCI from multiple nodes in table format. https://www.netxms.org/documentation/adminguide/visualisation.html#summary-table
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