@@ -0,0 +1,985 @@
+'''%0A Measure how fast the ASOS database is responding to queries for data!%0A'''%0Aimport os%0Aimport sys%0Aimport datetime%0Aimport psycopg2%0AIEM = psycopg2.connect(database='asos', host='iemdb', user='nobody')%0Aicursor = IEM.cursor()%0A%0Adef check():%0A    year = str(datetime.datetime.now().year)%0A    icursor.execute(%22%22%22%0A    SELECT count(*) from t%22%22%22+ year +%22%22%22 WHERE station = %0A    (select id from stations where network ~* 'ASOS' %0A    ORDER by random() ASC LIMIT 1)%0A    %22%22%22)%0A    row = icursor.fetchone()%0A%0A    %0Aif __name__ == '__main__':%0A    t0 = datetime.datetime.now()%0A    check()%0A    t1 = datetime.datetime.now()%0A    delta = (t1 - t0).seconds + float((t1 - t0).microseconds) / 1000000.0%0A    if delta %3C 5:%0A        print 'OK - %25.3f %7Cqtime=%25.3f;5;10;15' %25 (delta, delta)%0A        sys.exit(0)%0A    elif delta %3C 10:%0A        print 'WARNING - %25.3f %7Cqtime=%25.3f;5;10;15' %25 (delta, delta)%0A        sys.exit(1)%0A    else:%0A        print 'CRITICAL - %25.3f %7Cqtime=%25.3f;5;10;15' %25 (delta, delta)%0A        sys.exit(2)

add check of ASOS query times