-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipvs_bytes
More file actions
executable file
·24 lines (23 loc) · 899 Bytes
/
ipvs_bytes
File metadata and controls
executable file
·24 lines (23 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
import sys
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
print "yes"
elif len(sys.argv) == 2 and sys.argv[1] == "config":
print 'graph_title IPVS Bytes'
print 'graph_vlabel bps'
print 'graph_category ipvs'
print 'graph_order bytesin bytesout'
print 'bytesin.label Bytes IN'
print 'bytesin.type DERIVE'
print 'bytesout.label Bytes OUT'
print 'bytesout.type DERIVE'
print 'graph_args --base 1000'
else:
readfile = open('/proc/net/ip_vs_stats', 'r')
i = 0
for line in readfile:
i = i + 1
if i == 3:
conns, packetsin, packetsout, bytesin, bytesout = line.split()
print("bytesin.value " + str(int(packetsin, 16)))
print("bytesout.value " + str(int(packetsout, 16)))