Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1020626 // Monthly Traffic Estimate [vnstat]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (11937L/86K).

!7

// works with certain versions of vnstat. Try apt-get install vnstat

module EstimatedMonthlyTraffic > DynBigNumber {
  switchable S vnstatInterface; // set this to the interface name if output is empty otherwise 
  
  start {
    dm_reloadOnFieldChange vnstatInterface();
    doEvery(0.0, 10*60.0, r {
      if (!isOnPATH('vnstat))
        setValue("vnstat not installed");
      else
        setValue(regexpReplaceWithNothing(",\\d+",
          parse_vnstat(backtick("vnstat" + (empty(vnstatInterface) ? "" : " -i " + vnstatInterface))).thisMonthEstimated));
    });
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1020626
Snippet name: Monthly Traffic Estimate [vnstat]
Eternal ID of this version: #1020626/8
Text MD5: 35c5b78c828e8224557deb2aa668c7a6
Transpilation MD5: 20bdc7504d9b78fc4139a0e192b9f5e8
Author: stefan
Category: javax / networking
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-09 18:07:55
Source code size: 595 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 269 / 317633
Version history: 7 change(s)
Referenced in: [show references]