Пример #1
0
            UOM='%')

        #check logic
        status = "OK"

        if current_redis_memory_usage >= s_warning:
            status = "Warning"
        if current_redis_memory_usage >= s_critical:
            status = "Critical"

        #output formating
        memory_usage_message = '{used}% of {max}'.format(
            used=current_redis_memory_usage,
            max=size(redis_maxmemory, alternative))

        output = OutputFormatHelpers.check_output_string(
            status, memory_usage_message, [con_perf_data_string])

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
            sys.exit(2)
        if status == "Warning":
            warn=s_warning,
            crit=s_critical)

        #check logic
        status = "OK"

        if redis_blocked_clients >= s_warning:
            status = "Warning"
        if redis_blocked_clients >= s_critical:
            status = "Critical"

        #output formating
        memory_usage_message = '{n} blocked clients'.format(
            n=redis_blocked_clients)

        output = OutputFormatHelpers.check_output_string(
            status, memory_usage_message, [con_perf_data_string])

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
            sys.exit(2)
        if status == "Warning":
Пример #3
0
        redis = redis.StrictRedis(
            port=port,
            password=password,
            host=hostname,
            db=database
        )

        if redis.ping():
            status = "OK"
            message = "Success to ping-pong"
        else:
            status = "Critial"
            message = "Failed to ping-pong"

        output = OutputFormatHelpers.check_output_string(
            status,
            message
        )

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
            sys.exit(2)
Пример #4
0
    debug = opts.debug

    try:
        redis = redis.StrictRedis(port=port,
                                  password=password,
                                  host=hostname,
                                  db=database)

        if redis.ping():
            status = "OK"
            message = "Success to ping-pong"
        else:
            status = "Critial"
            message = "Failed to ping-pong"

        output = OutputFormatHelpers.check_output_string(status, message)

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
            sys.exit(2)
        if status == "Warning":
Пример #5
0
        #check logic
        status = "OK"

        if redis_memory_used >= s_warning:
            status = "Warning"
        if redis_memory_used >= s_critical:
            status = "Critical"

        #output formating
        memory_usage_message = '{used} memory usage'.format(
            used=size(redis_memory_used, alternative)
        )

        output = OutputFormatHelpers.check_output_string(
            status,
            memory_usage_message,
            perfdata
        )

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
Пример #6
0
                                                 UOM='B')
        ]

        #check logic
        status = "OK"

        if redis_memory_used >= s_warning:
            status = "Warning"
        if redis_memory_used >= s_critical:
            status = "Critical"

        #output formating
        memory_usage_message = '{used} memory usage'.format(
            used=size(redis_memory_used, alternative))

        output = OutputFormatHelpers.check_output_string(
            status, memory_usage_message, perfdata)

        print(output)

    except Exception as e:
        if debug:
            print(e)
            the_type, value, tb = sys.exc_info()
            traceback.print_tb(tb)
        print("Error: {m}".format(m=e))
        sys.exit(2)

    finally:
        if status == "Critical":
            sys.exit(2)
        if status == "Warning":