Skip to content

Upgrade for Python >=3.8 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions phpfpm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
import urllib
import urllib.request
import json

COLLECTD_ENABLED = True
Expand Down Expand Up @@ -60,14 +60,14 @@ def dispatch(pool, metric, value, metric_type, process=None):
type=metric_type, type_instance=metric)
vl.dispatch(values=[value])
else:
print 'dispatch: phpfpm.{}.{}.{} value: {}'.format(
instance, metric_type, metric, value)
print('dispatch: phpfpm.{}.{}.{} value: {}'.format(
instance, metric_type, metric, value))


def read_callback():
global URLS
for url in URLS:
response = urllib.urlopen(url)
response = urllib.request.urlopen(url)
data = json.loads(response.read())

# read master metrics
Expand All @@ -91,11 +91,11 @@ def read_callback():

if __name__ == "__main__" and not COLLECTD_ENABLED:
from pprint import pprint as pp
print "Running in test mode, invoke with"
print sys.argv[0] + " URL"
print("Running in test mode, invoke with")
print(sys.argv[0] + " URL")

URLS.append(sys.argv[1])
print "\n\nURLS:"
print("\n\nURLS:")
pp(URLS)
print

Expand Down