better import for psycopg2

Only import psycopg2 if SQL probes are to be runned. Import it the first
time it is needed.
send output to the configured url
avoid keyboard exception when in foreground
honor the interval