Perhaps it helps to see the service, metric and graph definitions:
Service:
from .agent_based_api.v1 import *
def discover_oracle_mem(section):
yield Service()
def check_oracle_mem(section):
for line in section:
if str(line[0]) == "total_processes":
yield Metric("oracle_sga_total_processes", float(line[1]))
yield Result(state=State.OK, summary=f"{line[0]} is {float(line[1])}")
elif line[0] == "w3wp_processes":
yield Metric("oracle_sga_w3wp_processes", float(line[1]))
yield Result(state=State.OK, summary=f"{line[0]} is {float(line[1])}")
elif line[0] == "other_processes":
yield Metric("oracle_sga_nonw3wp_processes", float(line[1]))
yield Result(state=State.OK, summary=f"{line[0]} is {float(line[1])}")
elif line[0] == "total_mbsize":
yield Metric("oracle_sga_total_mbsize", float(line[1]))
yield Result(state = State.OK, summary = f"{line[0]} is {render.bytes(float(line[1])*1048576)}")
elif line[0] == "w3wp_mbsize":
yield Metric("oracle_sga_w3wp_mbsize", float(line[1]))
yield Result(state = State.OK, summary = f"{line[0]} is {render.bytes(float(line[1])*1048576)}")
elif line[0] == "other_mbsize":
yield Metric("oracle_sga_nonw3wp_mbsize", float(line[1]))
yield Result(state = State.OK, summary = f"{line[0]} is {render.bytes(float(line[1])*1048576)}")
register.check_plugin(
name = "check_oracle_mem",
service_name = "Oracle PGA-SGA",
discovery_function = discover_oracle_mem,
check_function = check_oracle_mem,
)
Metric and graph:
from cmk.gui.i18n import _
from cmk.gui.plugins.metrics.utils import graph_info, metric_info
metric_info["oracle_sga_total_processes"] = {
"title": _("SGA Total Processes"),
"unit": "count",
"color": "#80f000",
}
metric_info["oracle_sga_w3wp_processes"] = {
"title": _("SGA w3wp Processes"),
"unit": "count",
"color": "#80f000",
}
metric_info["oracle_sga_nonw3wp_processes"] = {
"title": _("SGA non-w3wp Processes"),
"unit": "count",
"color": "#80f000",
}
metric_info["oracle_sga_total_mbsize"] = {
"title": _("SGA Total Size"),
"unit": "bytes",
"color": "#80f000",
}
metric_info["oracle_sga_w3wp_mbsize"] = {
"title": _("SGA w3wp Size"),
"unit": "bytes",
"color": "#80f000",
}
metric_info["oracle_sga_nonw3wp_mbsize"] = {
"title": _("SGA non-w3wp Size"),
"unit": "bytes",
"color": "#80f000",
}
graph_info["oracle_sga_process_count"] = {
"title": _("Process Count in Oracle SGA"),
"metrics": [
("oracle_sga_total_processes", "area"),
("oracle_sga_w3wp_processes", "line"),
("oracle_sga_nonw3wp_processes", "line"),
],
}
graph_info["oracle_sga_process_size"] = {
"title": _("Process Consumption in Oracle SGA"),
"metrics": [
("oracle_sga_total_mbsize", "area"),
("oracle_sga_w3wp_mbsize", "line"),
("oracle_sga_nonw3wp_mbsize", "line"),
],
}