-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipvs_packets
More file actions
executable file
·24 lines (23 loc) · 921 Bytes
/
Copy pathipvs_packets
File metadata and controls
executable file
·24 lines (23 loc) · 921 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 Packets'
print 'graph_vlabel pps'
print 'graph_category ipvs'
print 'graph_order packetsin packetsout'
print 'packetsin.label Packets IN'
print 'packetsin.type DERIVE'
print 'packetsout.label Packets OUT'
print 'packetsout.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("packetsin.value " + str(int(packetsin, 16)))
print("packetsout.value " + str(int(packetsout, 16)))