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).

1  
!7
2  
3  
// works with certain versions of vnstat. Try apt-get install vnstat
4  
5  
module EstimatedMonthlyTraffic > DynBigNumber {
6  
  switchable S vnstatInterface; // set this to the interface name if output is empty otherwise 
7  
  
8  
  start {
9  
    dm_reloadOnFieldChange vnstatInterface();
10  
    doEvery(0.0, 10*60.0, r {
11  
      if (!isOnPATH('vnstat))
12  
        setValue("vnstat not installed");
13  
      else
14  
        setValue(regexpReplaceWithNothing(",\\d+",
15  
          parse_vnstat(backtick("vnstat" + (empty(vnstatInterface) ? "" : " -i " + vnstatInterface))).thisMonthEstimated));
16  
    });
17  
  }
18  
}

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: 273 / 320893
Version history: 7 change(s)
Referenced in: [show references]