| Server IP : 199.250.200.62 / Your IP : 216.73.216.15 Web Server : Apache System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : jasonp18 ( 1000) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/proc/2/root/usr/share/doc/dstat-0.7.2/examples/ |
Upload File : |
#!/usr/bin/python ### Example 1: Direct accessing stats ### This is a quick example showing how you can access dstat data ### If you're interested in this functionality, contact me at dag@wieers.com import sys sys.path.insert(0, '/usr/share/dstat/') import dstat ### Set default theme dstat.theme = dstat.set_theme() clear = dstat.ansi['reset'] dstat.tick = dstat.ticks() c = dstat.dstat_cpu() print c.title() + '\n' + c.subtitle() c.extract() print c.show(), clear print 'Percentage:', c.val['total'] print 'Raw:', c.cn2['total'] print m = dstat.dstat_mem() print m.title() + '\n' + m.subtitle() m.extract() print m.show(), clear print 'Raw:', m.val print l = dstat.dstat_load() print l.title() + '\n' + l.subtitle() l.extract() print l.show(), clear print 'Raw:', l.val print d = dstat.dstat_disk() print d.title() + '\n' + d.subtitle() d.extract() print d.show(), clear print 'Raw:', d.val['total'] print