Git Product home page Git Product logo

ddcheck's People

Contributors

aleszoulek avatar kvbik avatar whiskybar avatar

Watchers

 avatar  avatar  avatar

ddcheck's Issues

AttributeError: 'Namespace' object has no attribute 'beat'

Attribute error, maybe because this arg is 'beat-interval' and not 'beat': https://github.com/whiskybar/ddcheck/blob/master/ddcheck/console.py#L20

[nick@nick-onebox-f19 ~]$ ddcheck -H -D fish.onetest.pantheon.io
Traceback (most recent call last):
  File "/usr/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.2.pre', 'console_scripts', 'ddcheck')()
  File "/usr/lib/python2.7/site-packages/ddcheck/console.py", line 80, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, backend_kwargs=dyndns_credentials, backend=backend, beat=options.beat)
AttributeError: 'Namespace' object has no attribute 'beat'

Verify working IPV6 before running checks

It's possible (i.e. from where I am testing), that IPV6 is not configured. It would be nice to verify that IPV6 is working at all from wherever ddcheck is being run, just to make sure. It could exit with an error message if there are IPV6 records.

I'm not sure exactly how to determine IPV6 is not working. Maybe by hitting google.com's AAAA, or some other server (one of Dyn's?).

○ → curl -g "https://[$(dig AAAA google.com +short)]/"
curl: (7) Failed to connect to 2607:f8b0:4010:801::1000: No route to host

Dry-run improvements

I love the idea of dry-run mode. Ideally, dry-run mode would work without any valid Dyn creds at all. That way we could run this against production URLs and watch logging, and see what it was doing, even if it was just monitoring at first.

For me, attempting to run dry-run mode without valid creds first yielded:

○ → ddcheck -e 500 --debug --dry-run http://getpantheon.com/test
2014-01-17 15:57:56,428 Resolving http://getpantheon.com/test
2014-01-17 15:57:56,506 Found health check point:  checkpoint(url='http://198.61.151.215/test', host='getpantheon.com', record='getpantheon.com.', ip='198.61.151.215', type='A')
2014-01-17 15:57:56,535 Found health check point:  checkpoint(url='http://[2001:4801:7901:0:aff8:a2d8:0:66]/test', host='getpantheon.com', record='getpantheon.com.', ip='2001:4801:7901:0:aff8:a2d8:0:66', type='AAAA')
Incorrect DynDns credentials
Exception AttributeError: "'DynDns' object has no attribute 'rest_iface'" in <bound method DynDns.__del__ of <ddcheck.dyndns.DynDns object at 0x10427ced0>> ignored

After removing the response check on https://github.com/whiskybar/ddcheck/blob/master/ddcheck/dyndns.py#L62, the script would exit after the first check:

○ → ddcheck -e 500 --debug --dry-run http://www.getpantheon.com/
2014-01-17 16:10:29,562 Resolving http://www.getpantheon.com/
2014-01-17 16:10:30,166 Found health check point:  checkpoint(url='http://198.61.151.215/', host='www.getpantheon.com', record='getpantheon.com.', ip='198.61.151.215', type='A')
2014-01-17 16:10:30,196 Found health check point:  checkpoint(url='http://[2001:4801:7901:0:aff8:a2d8:0:66]/', host='www.getpantheon.com', record='getpantheon.com.', ip='2001:4801:7901:0:aff8:a2d8:0:66', type='AAAA')
2014-01-17 16:10:30,700 Starting new HTTP connection (1): 198.61.151.215
2014-01-17 16:10:30,702 Starting new HTTP connection (1): 2001:4801:7901:0:aff8:a2d8:0:66
2014-01-17 16:10:30,819 http://[2001:4801:7901:0:aff8:a2d8:0:66]/ (www.getpantheon.com) connection failed: HTTPConnectionPool(host='2001:4801:7901:0:aff8:a2d8:0:66', port=80): Max retries exceeded with url: / (Caused by <class 'socket.gaierror'>: (7, 'No address associated with hostname'))
2014-01-17 16:10:30,864 "GET / HTTP/1.1" 301 0
2014-01-17 16:10:30,865 Starting new HTTPS connection (1): www.getpantheon.com
2014-01-17 16:10:31,347 "GET / HTTP/1.1" 200 8667
2014-01-17 16:10:31,428 http://198.61.151.215/ hit -> 200 (OK)
Traceback (most recent call last):
  File "/usr/local/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.1', 'console_scripts', 'ddcheck')()
  File "/usr/local/lib/python2.7/site-packages/ddcheck/console.py", line 59, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, dyndns_credentials=dyndns_credentials)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/server.py", line 49, in healthcheck
    dyndns.remove_records(records) #TODO: or return the records and call this elsewhere
  File "/usr/local/lib/python2.7/site-packages/ddcheck/dyndns.py", line 105, in remove_records
    self.remove_addresses(zone=zone, name=record, addresses=[cp.ip for cp in checkpoints], type=type)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/dyndns.py", line 79, in remove_addresses
    current_addresess = self.zone_addresses(zone, name, type).items()
  File "/usr/local/lib/python2.7/site-packages/ddcheck/dyndns.py", line 74, in zone_addresses
    for url in self.rest_iface.execute('/%sRecord/%s/%s/' % (type, zone, name), 'GET')['data']:
TypeError: 'NoneType' object is not iterable
curl -XDELETE https://api.dynect.net:443/REST/Session/ \
    --header "Content-Type: application/json" \
    --header "API-Version: current" \
    --header "Auth-Token: None"

Better error message for missing protocol on URL

If the protocol is left off the url, i.e. ddcheck -d -H -D fish.onetest.pantheon.io, it raises an exception. It would be nice to have it give a better error message.

Traceback (most recent call last):
  File "/usr/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.2.pre', 'console_scripts', 'ddcheck')()
  File "/usr/lib/python2.7/site-packages/ddcheck/console.py", line 80, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, backend_kwargs=dyndns_credentials, backend=backend, beat=options.beat)
  File "/usr/lib/python2.7/site-packages/ddcheck/server.py", line 66, in healthcheck
    checkpoints = resolve_ips(urls, ipv6=enable_ipv6) #TODO: green this
  File "/usr/lib/python2.7/site-packages/ddcheck/resolver.py", line 47, in resolve_ips
    answer = resolve_hostname(netloc, record_type)
  File "/usr/lib/python2.7/site-packages/ddcheck/resolver.py", line 25, in resolve_hostname
    a_hostname = dig(hostname, rdtype).rrset.name.to_text()
  File "/usr/lib/python2.7/site-packages/ddcheck/resolver.py", line 20, in dig
    return resolver.query(qname, rdtype)
  File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 905, in query
    raise_on_no_answer)
  File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 142, in __init__
    raise NoAnswer
dns.resolver.NoAnswer

Better errors if the checked host is not managed by Dyn

If the checked host is not managed by dyn, it should print out a nice messages saying so and exit unsuccessfully.

The current behavior is:

○ → ddcheck -e 500 --debug --dry-run http://dev.nuclearrooster.com/test
2014-01-17 16:05:59,959 Resolving http://dev.nuclearrooster.com/test
Traceback (most recent call last):
  File "/usr/local/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.1', 'console_scripts', 'ddcheck')()
  File "/usr/local/lib/python2.7/site-packages/ddcheck/console.py", line 59, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, dyndns_credentials=dyndns_credentials)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/server.py", line 40, in healthcheck
    checkpoints = resolve_ips(urls) #TODO: green this?
  File "/usr/local/lib/python2.7/site-packages/ddcheck/resolver.py", line 26, in resolve_ips
    answer = _dig(netloc, record_type, nameservers=nameservers)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/resolver.py", line 17, in _dig
    return resolver.query(qname, rdtype)
  File "/usr/local/lib/python2.7/site-packages/dns/resolver.py", line 817, in query
    raise NoNameservers
dns.resolver.NoNameservers

Syslog logging

It would be nice to use syslog logging. This way, even in dry-run mode, we can run this and watch the logs in logstash, and easily filter out all of the debug/info log statements.

Missing 'time' import

[nick@nick-onebox-f19 ~]$ ddcheck -H -D fish.onetest.pantheon.io
2014-01-22 20:39:37,852 ddcheck: [INFO] Starting new HTTP connection (1): 2607:f8b0:4000:802::1001
2014-01-22 20:39:37,944 ddcheck: [INFO] IPv6 support... off
Traceback (most recent call last):
  File "/usr/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.2.pre', 'console_scripts', 'ddcheck')()
  File "/usr/lib/python2.7/site-packages/ddcheck/console.py", line 80, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, backend_kwargs=dyndns_credentials, backend=backend, beat=options.beat)
  File "/usr/lib/python2.7/site-packages/ddcheck/server.py", line 64, in healthcheck
    started = time.time()
NameError: global name 'time' is not defined

Tests fail if a local HTTP server is running

FAIL: test_ddcheck.test_server.test_non_existing_host_get_to_failed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jbar/.virtualenvs/ddcheck/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jbar/ddcheck/test_ddcheck/test_server.py", line 15, in test_non_existing_host_get_to_failed
    tools.assert_equals([checkpoint], list(failed.queue))
AssertionError: Lists differ: [checkpoint(url='http://127.0.... != []

First list contains 1 additional elements.
First extra element 0:
checkpoint(url='http://127.0.0.1/', host='this.really.does.not.exist', record='this.really.does.not.exist.', ip='127.0.0.1', type='A')

- [checkpoint(url='http://127.0.0.1/', host='this.really.does.not.exist', record='this.really.does.not.exist.', ip='127.0.0.1', type='A')]
+ []
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): 127.0.0.1
requests.packages.urllib3.connectionpool: DEBUG: "GET / HTTP/1.1" 200 None
root: INFO: this.really.does.not.exist http://127.0.0.1/ hit -> 200 (OK)
--------------------- >> end captured logging << ---------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.