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. Calculating monthly speeds over 95th percentile?

Calculating monthly speeds over 95th percentile?

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 17.1k 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.
  • M
    M
    Millenium7
    wrote on last edited by
    #1

    I want to create a DCI on nodes that have leased fiber lines. We pay for a particular speed i.e. 500/500mbit but the line is actually burstable much higher to i.e. 10gbit/10gbit. We do not pay for bursting, however we do get billed significantly extra if we exceed the provisioned speed for more than 5% of the billing cycle

    I can see there is an example NetXMS script for 95th percentile packet loss, but this isn't directly applicable
    I'm already polling interface speeds every 5 minutes, how can I create another DCI that can calculate the average speed so far the current month, and then use thresholds to alert at 50%, 85%, 95% etc

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2
      dciId = 2531;
      threshold = 500 * 1000 * 1000;
      
      t = localtime();
      t->hour = 0;
      t->min = 0;
      t->sec = 0;
      endTime = mktime(t);
      
      if (t->mon >= 2) {
        t->mon = t->mon - 1;
      }
      else
      {
        t->mon = 12;
        t->year = t->year - 1;
      }
      startTime = mktime(t);
      
      a = GetDCIValues($node, dciId, startTime, endTime);
      
      HighCnt = 0;
      Cnt = 0;
      
      for (v : a) {
        Cnt++;
        if (v > threshold) HighCnt++;
      }
      
      return HighCnt / Cnt;
      

      Here's an example script that grabs all values for a DCI for last month. You can put this in a script DCI that is being collected by cron schedule on the first day of each month.

      Once you nave array with values, you can do various calculations with them. If you want to do calculations that involve big numbers, e.g. calculating average value, initialize variable like that:

      TotalCounter = 0L;

      This will use INT64 for this variable.

      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