Skip to content

Instantly share code, notes, and snippets.

@unacceptable
Last active July 24, 2020 14:36
Show Gist options
  • Save unacceptable/6f0db2f5a10f3215ace3f4cfffeb8943 to your computer and use it in GitHub Desktop.
Save unacceptable/6f0db2f5a10f3215ace3f4cfffeb8943 to your computer and use it in GitHub Desktop.
import statsd
STATSD_HOST = os.environ.get('STATSD_HOST', 'localhost')
STATSD_PORT = os.environ.get('STATSD_PORT', 8125)
STATSD = statsd.StatsClient(STATSD_HOST, STATSD_PORT)
def main():
STATSD.incr('invoke')
mfa_code = get_totp()
login(mfa_code)
STATSD.incr('successful')
logger.info('Exiting script.')
def login(mfa_code):
'''
do a login here
'''
STATSD.incr('login')
logger.info('Logged in.')
if __name__ == '__main__':
main()
''' running graphite in docker to test locally
docker run -d \
--name graphite \
--restart=always \
-p 80:80 \
-p 2003-2004:2003-2004 \
-p 2023-2024:2023-2024 \
-p 8125:8125/udp \
-p 8126:8126 \
graphiteapp/graphite-statsd
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment