Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Data Collection Table and regex

Data Collection Table and regex

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 16.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    J
    jds
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups