Data Collection Table and regex

Started by jds, August 22, 2020, 12:40:59 AM

Previous topic - Next topic

jds

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

Filipp Sudanov

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