File tree 5 files changed +13
-14
lines changed
5 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
3
3
# command-line utility to send JSON-encoded rtflow records through hsflowd.
4
- # requires "jsonPort =36343" in hsflowd.conf.
4
+ # requires "json { udpport =36343 } " in hsflowd.conf.
5
5
6
6
import argparse
7
7
import json
42
42
43
43
msg = {"rtflow" :metrics }
44
44
sock = socket .socket (socket .AF_INET ,socket .SOCK_DGRAM )
45
- sock .sendto (json .dumps (msg ),("127.0.0.1" ,36343 ))
45
+ sock .sendto (json .dumps (msg ). encode () ,("127.0.0.1" ,36343 ))
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
3
3
# command-line utility to send JSON-encoded rtmetric values through hsflowd.
4
- # requires "jsonPort =36343" in hsflowd.conf.
4
+ # requires "json { udpport =36343 } " in hsflowd.conf.
5
5
6
6
import argparse
7
7
import json
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
3
3
# Send JSON-encoded rtmetric messages through hsflowd to provide
4
4
# separate moniting of every CPU.
5
5
6
- # Requires "jsonPort =36343" in hsflowd.conf.
6
+ # Requires "json { udpport =36343 } " in hsflowd.conf.
7
7
8
8
# This should be executed periodically e.g. by cron(1)
9
9
# or like this at the shell prompt for testing:
31
31
'cpu_x_sintr' : { "type" :"counter32" , "value" : int (toks [7 ]) }
32
32
}
33
33
}
34
- sock .sendto (json .dumps (msg ), ('127.0.0.1' , 36343 ))
34
+ sock .sendto (json .dumps (msg ). encode () , ('127.0.0.1' , 36343 ))
35
35
inputfile .close ()
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
3
3
# Send JSON-encoded rtmetric through hsflowd to provide
4
4
# separate moniting of every local disk partition.
5
5
6
- # Requires "jsonPort =36343" in hsflowd.conf.
6
+ # Requires "json {udpport =36343 } " in hsflowd.conf.
7
7
8
8
# This should be executed periodically e.g. by cron(1)
9
9
# or like this at the shell prompt for testing:
14
14
import time
15
15
import os
16
16
import re
17
- from string import maketrans
18
17
19
18
# we are going to translate '/' to '_' in the mount point names
20
- transtab = maketrans ("/" , "_" )
19
+ transtab = str . maketrans ("/" , "_" )
21
20
22
21
# match the subset of mount points that we want to report on
23
22
pattern = re .compile ('^/$|^/tmp|^/usr/' )
43
42
}
44
43
}
45
44
# print json.dumps(msg)
46
- sock .sendto (json .dumps (msg ), ('127.0.0.1' , 36343 ))
45
+ sock .sendto (json .dumps (msg ). encode () , ('127.0.0.1' , 36343 ))
47
46
p .close ()
Original file line number Diff line number Diff line change 1
- #!/usr/bin/python3
1
+ #!/usr/bin/env python3
2
2
import dbus
3
3
bus = dbus .SystemBus ()
4
4
You can’t perform that action at this time.
0 commit comments