# Path: credentials.py
# SNMP_COMMUNITY = "public"


from pysnmp.entity.rfc3413.oneliner import cmdgen
from credentials import SNMP_COMMUNITY
import time
import json
import logging.config

    if error_indication:                         # Check for SNMP errors
        snmp_error = str(error_indication)
    else:
        if error_status:
            snmp_error = error_status.prettyPrint()
        else:
            # This OID will return a table, so we will loop through the entries in the table
            snmp_value = 0
            for snmp_entry in var_binds:
                # Check if the value is 4 (active call) and increment the counter
                if int(snmp_entry[0][1]) == 4:
                    snmp_value += 1

    return snmp_value, snmp_error


def output_message(message, detail):
    """This function will output an error message formatted in JSON to display on the StatusBoard app"""
    statusbar_output = {"graph": {"title": GRAPH_TITLE, "error": {"message": message, "detail": detail}}}
    output = json.dumps(statusbar_output)
    return output


def generate_json(snmp_monitor):
    """This function will take the device config and raw data (if any) from the snmp_monitor and output JSON data
    formatted for the StatusBar iPad App"""

    logger = logging.getLogger("snmp_interface_5")
    time_x_axis = time.strftime("%H:%M")         # Use the same time value for all samples per iteration

# Path: credentials.py
# SNMP_COMMUNITY = "public"


# Path: snmp_interface_5.py
from pysnmp.entity.rfc3413.oneliner import cmdgen
from credentials import SNMP_COMMUNITY
import time
import json
import logging.config


    if error_indication:                         # Check for SNMP errors
        snmp_error = str(error_indication)
    else:
        if error_status:
            snmp_error = error_status.prettyPrint()
        else:
            # This OID will return a table, so we will loop through the entries in the table
            snmp_value = 0
            for snmp_entry in var_binds:
                # Check if the value is 4 (active call) and increment the counter
                if int(snmp_entry[0][1]) == 4:
                    snmp_value += 1

    return snmp_value, snmp_error


def output_message(message, detail):
    """This function will output an error message formatted in JSON to display on the StatusBoard app"""
    statusbar_output = {"graph": {"title": GRAPH_TITLE, "error": {"message": message, "detail": detail}}}
    output = json.dumps(statusbar_output)
    return output


def generate_json(snmp_monitor):
    """This function will take the device config and raw data (if any) from the snmp_monitor and output JSON data
    formatted for the StatusBar iPad App"""

    logger = logging.getLogger("snmp_interface_5")
    time_x_axis = time.strftime("%H:%M")         # Use the same time value for all samples per iteration

    statusbar_datasequences = []