# Path: es_stats_zabbix/defaults/settings.py
# NODETYPES = ['cluster', 'coordinating', 'master', 'data', 'ml', 'ingest']
# 
# Path: es_stats_zabbix/exceptions.py
# class FailedExecution(ESZException):
#     """
#     Exception raised when a function fails to execute for some reason.
#     """
# 
# class NotFound(ESZException):
#     """
#     Exception raised when expected information is not found.
#     """


import socket
import logging
import requests
from es_stats_zabbix.defaults.settings import NODETYPES
from es_stats_zabbix.exceptions import FailedExecution, NotFound
            # We don't need this here.
            pass
        else:
            #  The default is true for each node type, so if it's not false, it's true.
            retval.append(nodetype)
    LOGGER.debug('RETVAL={0}'.format(retval))
    return retval

def get_cluster_macros(statobj, nodeid):
    """Get the cluster and node LLD macros"""
    cluster_name = statobj.client.cluster.health()['cluster_name']
    nodeinfo = statobj.cached_read('nodeinfo')['nodes']
    nodename = nodeinfo[nodeid]['name']
    entries = {
        '{#CLUSTERNAME}': cluster_name,
        '{#NODEID}':nodeid,
        '{#NODENAME}':nodename
    }
    return entries

def get_node_macros(statobj, nodeid):
    """Get the nodetype LLD macros"""
    macros = []
    def macgen(nodetype, boolish):
        """Add the uppercase value of valuetype to the LLD Macros"""
        return {
            '{#NODETYPE}':nodetype,
            '{#PRESENT}':boolish
        }
    present_nodetypes = true_nodetypes(statobj, nodeid)

# Path: es_stats_zabbix/defaults/settings.py
# NODETYPES = ['cluster', 'coordinating', 'master', 'data', 'ml', 'ingest']
# 
# Path: es_stats_zabbix/exceptions.py
# class FailedExecution(ESZException):
#     """
#     Exception raised when a function fails to execute for some reason.
#     """
# 
# class NotFound(ESZException):
#     """
#     Exception raised when expected information is not found.
#     """


# Path: es_stats_zabbix/helpers/utils.py
import socket
import logging
import requests
from es_stats_zabbix.defaults.settings import NODETYPES
from es_stats_zabbix.exceptions import FailedExecution, NotFound

            # We don't need this here.
            pass
        else:
            #  The default is true for each node type, so if it's not false, it's true.
            retval.append(nodetype)
    LOGGER.debug('RETVAL={0}'.format(retval))
    return retval

def get_cluster_macros(statobj, nodeid):
    """Get the cluster and node LLD macros"""
    cluster_name = statobj.client.cluster.health()['cluster_name']
    nodeinfo = statobj.cached_read('nodeinfo')['nodes']
    nodename = nodeinfo[nodeid]['name']
    entries = {
        '{#CLUSTERNAME}': cluster_name,
        '{#NODEID}':nodeid,
        '{#NODENAME}':nodename
    }
    return entries

def get_node_macros(statobj, nodeid):
    """Get the nodetype LLD macros"""
    macros = []
    def macgen(nodetype, boolish):
        """Add the uppercase value of valuetype to the LLD Macros"""
        return {
            '{#NODETYPE}':nodetype,
            '{#PRESENT}':boolish
        }
    present_nodetypes = true_nodetypes(statobj, nodeid)

    for nodetype in NODETYPES: