<commit_before>"""
 Check how much SNET data we have
"""
import sys
import psycopg2
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = IEM.cursor()

if __name__ == '__main__':
    icursor.execute("""
    SELECT network,
    sum(case when valid > now() - '75 minutes'::interval then 1 else 0 end)
    from current c JOIN stations s on
    (s.iemid = c.iemid)
    WHERE network in ('KCCI','KELO','KIMT') GROUP by network
    """)

    counts = {'KCCI': 0, 'KELO': 0, 'KIMT': 0}
    total = 0
    for row in icursor:
        counts[row[0]] = row[1]
        total += row[1]

    if total > 20:
        print(('OK - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(0)
    elif total > 10:
        print(('WARNING - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(1)
    else:
        print(('CRITICAL - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(2)<commit_msg>lower SNET ingest alerting thresholds<commit_after>"""
 Check how much SNET data we have
"""
import sys
import psycopg2


def main():
    """Go Main"""
    pgconn = psycopg2.connect(database='iem', host='iemdb', user='nobody')
    icursor = pgconn.cursor()
    icursor.execute("""
    SELECT network,
    sum(case when valid > now() - '75 minutes'::interval then 1 else 0 end)
    from current c JOIN stations s on
    (s.iemid = c.iemid)
    WHERE network in ('KCCI','KELO','KIMT') GROUP by network
    """)

    counts = {'KCCI': 0, 'KELO': 0, 'KIMT': 0}
    total = 0
    for row in icursor:
        counts[row[0]] = row[1]
        total += row[1]

    if total > 15:
        print(('OK - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(0)
    elif total > 5:
        print(('WARNING - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(1)
    else:
        print(('CRITICAL - %s count |kcci=%s;1;3;5 kelo=%s;1;3;5 kimt=%s;1;3;5'
               ) % (total, counts['KCCI'], counts['KELO'], counts['KIMT']))
        sys.exit(2)


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.19705038918476034, 'fraction_numerical': 0.03809913969684556, 'mean_word_length': 2.7978227060653187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7291150', 'n_tokens_mistral': 988, 'n_tokens_neox': 957, 'n_words': 224}