def METHOD_NAME(self, template, dashboard=False):
    rule = {
        "name": "PostgreSQL Databases Discovery",
        "key": self.key_db_discovery.format("[{0}]".format(self.Macros[self.Type])),
    }
    if Plugin.old_zabbix:
        conditions = []
        rule["filter"] = "{#DATABASE}:.*"
    else:
        conditions = [{
            "condition": [
                {"macro": "{#DATABASE}",
                 "value": ".*",
                 "operator": 8,
                 "formulaid": "A"}
            ]
        }]
    items = [
        {"key": self.right_type(self.key_db_size, var_discovery="{#DATABASE},"),
         "name": "PostgreSQL Databases: {#DATABASE} size",
         "units": Plugin.UNITS.bytes,
         "value_type": Plugin.VALUE_TYPE.numeric_unsigned,
         "delay": self.plugin_config("interval")},
        {"key": self.right_type(self.key_db_age, var_discovery="{#DATABASE},"),
         "name": "PostgreSQL Databases: Max datfrozenxid Age in: {#DATABASE}",
         "delay": self.plugin_config("interval")},
        {"key": self.right_type(self.key_db_bloating_tables, var_discovery="{#DATABASE},"),
         "name": "PostgreSQL Databases: Count of Bloating Tables in {#DATABASE}",
         "delay": self.plugin_config("interval")},
        {"key": self.right_type(self.key_invalid_indexes, var_discovery="{#DATABASE},"),
         "name": "PostgreSQL Databases: Count of Invalid Indexes in {#DATABASE}",
         "delay": self.plugin_config("interval")}
    ]
    graphs = [{
        "name": "PostgreSQL Databases: {#DATABASE} size",
        "type": 1,
        "items": [
            {"color": "A39B98",
             "key": self.right_type(self.key_db_size, var_discovery="{#DATABASE},"),
             "drawtype": 2}]
    },
        {
            "name": "PostgreSQL Databases: {#DATABASE} Bloating Overview",
            "items": [
                {"color": "87C2B9",
                 "key": self.right_type(self.key_db_bloating_tables, var_discovery="{#DATABASE},"),
                 "drawtype": 2},
                {"color": "793F5D",
                 "key": self.right_type(Autovacuum.key_count),
                 "yaxisside": 1,
                 "drawtype": 2}]
        },
        {
            "name": "PostgreSQL Databases: {#DATABASE} Max age(datfrozenxid)",
            "items": [
                {"color": "87C2B9",
                 "key": self.right_type(self.key_db_age, var_discovery="{#DATABASE},"),
                 "drawtype": 2},
                {"color": "793F5D",
                 "key": self.right_type(Autovacuum.key_count),
                 "yaxisside": 1,
                 "drawtype": 2}]
        }]
    triggers = [{
        "name": "PostgreSQL Databases: invalid indexes in {#DATABASE} (hostname={HOSTNAME} value={ITEM.LASTVALUE})",
        "expression": "{#TEMPLATE:" + items[3]['key'] + ".last()}&gt;0"}
    ]
    return template.discovery_rule(rule=rule, conditions=conditions, items=items, graphs=graphs, triggers=triggers)