# 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
# ===============================================================================


class MonitorJSON:
    """This is a simple class passed to Monitor threads so we can access the current JSON data in that thread"""
    def __init__(self):
        self.json = json.dumps(
            {
                "ups_load": "--",
                "runtime": "--",
                "temperature": "--",
                "hot_aisle": "--",
                "humidity": "--"
            }, indent=4
        )


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_environmental_1")

    # Create the pysnmp SNMP CommandGenerator, used to get SNMP data
    cmd_gen = cmdgen.CommandGenerator()

    try:
        # ===============CLT NetBotz1 data
        logger.debug("Getting: CLT NetBotz1 data")
        error_indication, error_status, error_index, var_binds = cmd_gen.getCmd(

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


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

# ===============================================================================


class MonitorJSON:
    """This is a simple class passed to Monitor threads so we can access the current JSON data in that thread"""
    def __init__(self):
        self.json = json.dumps(
            {
                "ups_load": "--",
                "runtime": "--",
                "temperature": "--",
                "hot_aisle": "--",
                "humidity": "--"
            }, indent=4
        )


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_environmental_1")

    # Create the pysnmp SNMP CommandGenerator, used to get SNMP data
    cmd_gen = cmdgen.CommandGenerator()

    try:
        # ===============CLT NetBotz1 data
        logger.debug("Getting: CLT NetBotz1 data")
        error_indication, error_status, error_index, var_binds = cmd_gen.getCmd(

            cmdgen.CommunityData(SNMP_COMMUNITY),