Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import threading
import requests

import utils
from utils import get_module_logger


Expand All @@ -21,6 +22,8 @@ def run(self):
result = []
try:
s = requests.session()
s.verify = utils.verify
s.trust_env = utils.trust_env
response = s.get(self.url, timeout=5)
except Exception as e:
logger.warning("Get {0} failed, error: {1}.".format(self.url, str(e)))
Expand Down
11 changes: 10 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import logging
import yaml

verify = True
trust_env = True


def get_module_logger(mod_name):
logger = logging.getLogger(mod_name)
Expand Down Expand Up @@ -67,4 +70,10 @@ def parse_args():
parser.add_argument('-jns', required=False, metavar='journalnode_jmx_url', help='Hadoop journalnode jmx metrics URL.', nargs="*")
parser.add_argument('-host', required=False, metavar='host', help='Listen on this address. default: 0.0.0.0', default='0.0.0.0')
parser.add_argument('-port', required=False, metavar='port', type=int, help='Listen to this port. default: 6688', default=6688)
return parser.parse_args()
parser.add_argument('-verify', required=False, metavar='verify', help='Scrape veirify switch. default: True', default='True')
parser.add_argument('-trust', required=False, metavar='trust', help='Scrape trust env switch. default: True', default='True')
args = parser.parse_args()
global verify, trust_env
verify = args.verify == 'True'
trust_env = args.trust == 'True'
return args