 a background in oncology and research and has worked as a Behavioral Coach with an online provider of lifestyle and behavioral health solutions. She holds professional certifications as a Health and Wellness Coach, Holistic Health Practitioner, Reiki Practitioner, and Registered Yoga Teacher. Marta has a passion for the ocean and loves swimming, scuba diving and underwater photography.Especially in a place like this. I cannot state just how beautiful this spot was. Wonderful view as I descended down the road to wait for the ferry. I just wish I could have captured the scenery here a bit better. The Weldon Ferry crosses the South Saskatchewan River. It took a bit of driving down rural gravels to get here. Of course when I did cross over the side turned out to be paved.
There is not a lot anchoring a ferry.
Gorgeous spot. I loved it except for the bugs. Saskatchewan has lots of nasty plus size insects. While talking to the ferry operator I was bitten by horseflies. After my trip my car was plastered with insect remains.
Cable tower.
I'm adding this one to the Crowfoot Ferry on my list of must visit out of the way sights in Canada. Then, on to the Faroe Islands!
This got me thinking about the Crowfoot Ferry and I noticed the Closed signs are removed from the sign on the Trans. I am going to ride it for the heck of it someday soon.
Ferry nice post BW.
That water looks high, BW... was it muddy? Might be worth throwing a hook in to do some fishin'...<reponame>isabella232/zenoss-gap-detection
from kafka import KafkaProducer
from kafka.errors import KafkaError

import json, requests, datetime
#from zenoss import Zenoss
import logging
import sys
import time
import os
import configparser

#need to make command line stuff more robust -- e.g. explain options
try:
    sys.argv[1]
except:
    sys.argv = [sys.argv[0], 'default', 'both','realtime', 1540204200, 1540207800]#late,gap,both;realtime,cleanup,pointforward,point,range


class loadConfig():
    '''
    library providing config functionality 
    '''
    def __init__(self, section = 'default', cfgFilePath = ""):
        self._url = ''
        self.configSectionName = section
        self.config = self._getConfigDetails(section, cfgFilePath)
       

    def _getConfigDetails(self, section, cfgFilePath):
        '''
        Read 'creds.cfg' configuration file. Default location being in the
        same directory as the python library file & return parameters in
        specific'section'.
        '''
        #self.log.info('_getConfigDetails; section:%s, cfgFilePath:%s' % (section, cfgFilePath))
        configurations = configparser.ConfigParser()
        if cfgFilePath == "":
            cfgFilePath = os.path.realpath(
                os.path.join(os.getcwd(), os.path.dirname(__file__), 'creds.cfg')
            )
        configurations.read(cfgFilePath)
        if not (section in configurations.sections()):
            raise Exception('Specified configuration section, "%s" not defined in "%s".' % (section, cfgFilePath)) 
        configuration = {item[0]: item[1] for item in configurations.items(section)}
        configuration = self._sanitizeConfig(configuration)
        return configuration


    def _sanitizeConfig(self, configuration):
        '''
        Ensure 'creds.cfg' configuration file has required fields.
        Deal with special fields.
        '''
        #self.log.info('_sanitizeConfig; configuration:%s' %(configuration))
        if not ('url' in configuration):
            raise Exception('Configuration file missing "url" key')
        if not ('username' in configuration):
            raise Exception('Configuration file missing "username" key')
        if not ('password' in configuration):
            pass
            #self.log.error('Configuration file missing "password" key')
        if not ('timeout' in configuration):
            configuration['timeout'] = 3
        else:
            configuration['timeout'] = float(configuration['timeout'])
        if not ('retries' in configuration):
            configuration['retries'] = 3
        else:
            configuration['retries'] = float(configuration['retries'])
        sslVerify = True
        if'ssl_verify' in configuration:
            if configuration['ssl_verify'].lower() == 'false':
                sslVerify = False
                #requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        configuration['ssl_verify'] = sslVerify
        if 'kafka' not in configuration:
            configuration['kafka']=''
        if 'classes' in configuration:
            configuration['classes']=configuration['classes'].split(',')
        else:
            configuration['classes']=[]
            
        return configuration

configValues=loadConfig(sys.argv[1],('' if 'HOME' not in os.environ or sys.argv[1]!='default' else os.environ['HOME']+'/creds.cfg'))

envhost=configValues.config['url'].split('.')[1]
scriptmode=sys.argv[2]
scripttiming=sys.argv[3]

if sys.argv[1]=='default':
    devmode=True
else:
    devmode=False
if devmode==True:
    logfile=''
    loglevel='DEBUG'
else:
    logfile='d:'
    loglevel='INFO'#WARNING'
    
logfile+='/tmp/zenossCheckGaps' + sys.argv[1] + scriptmode+  scripttiming+'.log'
producer = KafkaProducer(bootstrap_servers=[configValues.config['kafka']])
deviceClasslist=configValues.config['classes']

#setup logging
class Log(object):

    def __init__(self):
        self.started = False

    def startLogging(self, stream=None, level=None, **kwargs):
        if not self.started:
            if stream is None:
                stream = 'file'

            if level is None:
                level = logging.INFO
            elif level == 'DEBUG':
                level = logging.DEBUG
            elif level == 'WARNING':
                level = logging.WARNING
            elif level == 'ERROR':
                level = logging.ERROR
            elif level == 'CRITICAL':
                level = logging.CRITICAL
            else:
                level = logging.INFO

            #setting logging level for requests package
            logging.getLogger('requests').setLevel(logging.CRITICAL)

            format = "\"{\"timestamp\":\"%(asctime)s\",\"level\":\"%(levelname)s\",\"msg\":%(message)s}\""

            logging.Formatter.converter = time.gmtime

            if stream == 'console':
                logging.basicConfig(stream=sys.stdout,
                                    level=level,
                                    format=format)
            else:
                logging.basicConfig(filename=logfile,
                                    level=level,
                                    format=format)

            self.started = True
            self.info({'logging':'started'})

    def info(self, msg):
        logging.info(json.dumps(msg))
    def debug(self, msg):
        logging.debug(json.dumps(msg))
    def warning(self, msg):
        logging.warning(json.dumps(msg))
    def error(self, msg):
        logging.error(json.dumps(msg))
    def critical(self, msg):
        logging.critical(json.dumps(msg))

log = Log()

log.startLogging('file',loglevel)#file or console

'''Python module fragments to work with the Zenoss JSON API
'''
import ast
import re
import json
import logging
import requests

log = logging.getLogger(__name__) # pylint: disable=C0103
requests.packages.urllib3.disable_warnings()

ROUTERS = {'DeviceRouter': 'device',
           'DeviceManagementRouter': 'devicemanagement'}

class Zenoss(object):
    '''A class that represents a connection to a Zenoss server
    '''
    def __init__(self, host, username, password, ssl_verify=True):
        self.__host = host
        self.__session = requests.Session()
        self.__session.auth = (username, password)
        self.__session.verify = ssl_verify
        self.__req_count