Skip to content

Commit 26fef31

Browse files
committed
refactoring: updated discoveries and triggers names
1 parent bb3b729 commit 26fef31

File tree

11 files changed

+37
-38
lines changed

11 files changed

+37
-38
lines changed

mamonsu/plugins/pgsql/archive_command.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ArchiveCommand(Plugin):
5555
SELECT failed_count FROM pg_stat_archiver;
5656
"""
5757
key = "pgsql.archive_command{0}"
58-
name = "PostgreSQL archive command {0}"
5958
Items = [
6059
# key, desc, color, side, graph, delta, units
6160
("count_files_to_archive", "Files in archive_status Need to Archive Count", "9C8A4E", 0, 1, Plugin.DELTA.as_is, Plugin.UNITS.none),
@@ -134,7 +133,7 @@ def items(self, template, dashboard=False):
134133
for item in self.Items:
135134
result += template.item({
136135
"key": self.right_type(self.key, item[0]),
137-
"name": "PostgreSQL Archiver: {0}".format(self.name.format(item[1])),
136+
"name": "PostgreSQL Archiver: {0}".format(item[1]),
138137
"value_type": self.VALUE_TYPE.numeric_unsigned,
139138
"delay": self.plugin_config("interval"),
140139
"delta": item[5],
@@ -165,22 +164,22 @@ def graphs(self, template, dashboard=False):
165164
"key": self.right_type(self.key, item[0]), "color": item[2], "yaxisside": item[3], "drawtype": 2
166165
})
167166
result += template.graph({
168-
"name": self.name.format("") + " archive status ",
167+
"name": "PostgreSQL Archiver: Archive Status",
169168
"items": graph
170169
})
171170
if not dashboard:
172171
return result
173172
else:
174173
return [{
175-
"dashboard": {"name": self.name.format("") + " archive status ",
174+
"dashboard": {"name": "PostgreSQL Archiver: Archive Status",
176175
"page": ZbxTemplate.dashboard_page_wal["name"],
177176
"size": ZbxTemplate.dashboard_widget_size_medium,
178177
"position": 1}
179178
}]
180179

181180
def triggers(self, template, dashboard=False):
182181
return template.trigger({
183-
"name": "PostgreSQL count files in ./archive_status on {HOSTNAME} more than 2",
182+
"name": "PostgreSQL Archiver: count files need to archive on {HOSTNAME} more than 2",
184183
"expression": "{#TEMPLATE:" + self.right_type(self.key,
185184
self.Items[0][0]) + ".last()}>" + self.plugin_config(
186185
"max_count_files")

mamonsu/plugins/pgsql/cfs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def items(self, template, dashboard=False):
130130

131131
def discovery_rules(self, template, dashboard=False):
132132
rule = {
133-
"name": "Compressed relations discovery",
133+
"name": "PostgreSQL CFS Discovery",
134134
"key": "pgsql.cfs.discovery_compressed_relations[]"
135135
}
136136
if Plugin.old_zabbix:
@@ -147,12 +147,12 @@ def discovery_rules(self, template, dashboard=False):
147147
}]
148148
items = [{
149149
"key": "pgsql.cfs.compress_ratio[{#COMPRESSED_RELATION}]",
150-
"name": "Relation {#COMPRESSED_RELATION}: compress ratio",
150+
"name": "PostgreSQL CFS: Relation {#COMPRESSED_RELATION} Compress Ratio",
151151
"delay": self.timeRatioInterval,
152152
"drawtype": 2
153153
}]
154154
graphs = [{
155-
"name": "Relation {#COMPRESSED_RELATION}: compress ratio",
155+
"name": "PostgreSQL CFS: Relation {#COMPRESSED_RELATION} Compress Ratio",
156156
"delay": self.timeRatioInterval,
157157
"items": [{
158158
"color": "8B817C",

mamonsu/plugins/pgsql/checkpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def graphs(self, template, dashboard=False):
121121

122122
def triggers(self, template, dashboard=False):
123123
return template.trigger({
124-
"name": "PostgreSQL required checkpoints occurs to frequently on {HOSTNAME}",
124+
"name": "PostgreSQL Checkpoints: required checkpoints occurs to frequently on {HOSTNAME}",
125125
"expression": "{#TEMPLATE:" + self.right_type(self.key,
126126
self.Items[1][1]) + ".last()}>" + self.plugin_config(
127127
"max_checkpoint_by_wal_in_hour")

mamonsu/plugins/pgsql/connections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ def graphs(self, template, dashboard=False):
223223

224224
def triggers(self, template, dashboard=False):
225225
return template.trigger({
226-
"name": "PostgreSQL many connections on {HOSTNAME} (total connections more than " + self.plugin_config(
227-
"percent_connections_tr") + "% max connections)",
226+
"name": "PostgreSQL Connections: too many connections on {HOSTNAME} (total connections more than " + self.plugin_config(
227+
"percent_connections_tr") + "% of max_connections)",
228228
"expression": " {#TEMPLATE:" + self.right_type(self.key,
229229
"total") + ".last()}/{#TEMPLATE:" + self.right_type(self.key,
230230
"max_connections") + ".last()}*100 >" + self.plugin_config(

mamonsu/plugins/pgsql/databases.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def items(self, template, dashboard=False):
105105

106106
def discovery_rules(self, template, dashboard=False):
107107
rule = {
108-
"name": "Database discovery",
108+
"name": "PostgreSQL Databases Discovery",
109109
"key": self.key_db_discovery.format("[{0}]".format(self.Macros[self.Type])),
110110

111111
}
@@ -123,30 +123,30 @@ def discovery_rules(self, template, dashboard=False):
123123
}]
124124
items = [
125125
{"key": self.right_type(self.key_db_size, var_discovery="{#DATABASE},"),
126-
"name": "Database {#DATABASE}: size",
126+
"name": "PostgreSQL Databases {#DATABASE}: size",
127127
"units": Plugin.UNITS.bytes,
128128
"value_type": Plugin.VALUE_TYPE.numeric_unsigned,
129129
"delay": self.plugin_config("interval")},
130130
{"key": self.right_type(self.key_db_age, var_discovery="{#DATABASE},"),
131-
"name": "Max age (datfrozenxid) in: {#DATABASE}",
131+
"name": "PostgreSQL Databases: Max datfrozenxid Age in: {#DATABASE}",
132132
"delay": self.plugin_config("interval")},
133133
{"key": self.right_type(self.key_db_bloating_tables, var_discovery="{#DATABASE},"),
134-
"name": "Count of bloating tables in database: {#DATABASE}",
134+
"name": "PostgreSQL Databases: Count of Bloating Tables in {#DATABASE}",
135135
"delay": self.plugin_config("interval")},
136136
{"key": self.right_type(self.key_invalid_indexes, var_discovery="{#DATABASE},"),
137-
"name": "Count of invalid indexes in database: {#DATABASE}",
137+
"name": "PostgreSQL Databases: Count of Invalid Indexes in {#DATABASE}",
138138
"delay": self.plugin_config("interval")}
139139
]
140140
graphs = [{
141-
"name": "Database: {#DATABASE} size",
141+
"name": "PostgreSQL Databases: {#DATABASE} size",
142142
"type": 1,
143143
"items": [
144144
{"color": "8B817C",
145145
"key": self.right_type(self.key_db_size, var_discovery="{#DATABASE},"),
146146
"drawtype": 2}]
147147
},
148148
{
149-
"name": "Database bloating overview: {#DATABASE}",
149+
"name": "PostgreSQL Databases: {#DATABASE} Bloating Overview",
150150
"items": [
151151
{"color": "7EB29B",
152152
"key": self.right_type(self.key_db_bloating_tables, var_discovery="{#DATABASE},"),
@@ -157,7 +157,7 @@ def discovery_rules(self, template, dashboard=False):
157157
"drawtype": 2}]
158158
},
159159
{
160-
"name": "Database max age overview: {#DATABASE}",
160+
"name": "PostgreSQL Databases: {#DATABASE} Max age(datfrozenxid)",
161161
"items": [
162162
{"color": "7EB29B",
163163
"key": self.right_type(self.key_db_age, var_discovery="{#DATABASE},"),
@@ -168,7 +168,7 @@ def discovery_rules(self, template, dashboard=False):
168168
"drawtype": 2}]
169169
}]
170170
triggers = [{
171-
"name": "PostgreSQL invalid indexes in database {#DATABASE} (hostname={HOSTNAME} value={ITEM.LASTVALUE})",
171+
"name": "PostgreSQL Databases: invalid indexes in {#DATABASE} (hostname={HOSTNAME} value={ITEM.LASTVALUE})",
172172
"expression": "{#TEMPLATE:pgsql.database.invalid_indexes[{#DATABASE}].last()}>0"}
173173
]
174174
return template.discovery_rule(rule=rule, conditions=conditions, items=items, graphs=graphs, triggers=triggers)

mamonsu/plugins/pgsql/health.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ def items(self, template, dashboard=False):
9595

9696
def triggers(self, template, dashboard=False):
9797
result = template.trigger({
98-
"name": "PostgreSQL service was restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})",
98+
"name": "PostgreSQL Health: service has been restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})",
9999
"expression": "{#TEMPLATE:" + self.right_type(self.key_uptime) + ".last()}<" + str(
100100
self.plugin_config("uptime"))
101101
}) + template.trigger({
102-
"name": "PostgreSQL cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})",
102+
"name": "PostgreSQL Health: cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})",
103103
"expression": "{#TEMPLATE:" + self.right_type(self.key_cache, "hit") + ".last()}<" + str(
104104
self.plugin_config("cache"))
105105
}) + template.trigger({
106-
"name": "PostgreSQL no ping from PostgreSQL for 3 minutes {HOSTNAME}",
106+
"name": "PostgreSQL Health: no ping from PostgreSQL for 3 minutes on {HOSTNAME}",
107107
"expression": "{#TEMPLATE:" + self.right_type(self.key_ping) + ".nodata(180)}=1"
108108
})
109109
return result

mamonsu/plugins/pgsql/instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def graphs(self, template, dashboard=False):
188188

189189
def triggers(self, template, dashboard=False):
190190
return template.trigger({
191-
"name": "PostgreSQL server mode changed on {HOSTNAME} to {ITEM.LASTVALUE}",
191+
"name": "PostgreSQL Instance: server mode has been changed on {HOSTNAME} to {ITEM.LASTVALUE}",
192192
"expression": "{#TEMPLATE:" + self.key_server_mode + ".change()}>0"
193193
})
194194

mamonsu/plugins/pgsql/oldest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ def items(self, template, dashboard=False):
8787

8888
def triggers(self, template, dashboard=False):
8989
return template.trigger({
90-
"name": "PostgreSQL oldest xid is too big on {HOSTNAME}",
90+
"name": "PostgreSQL Transactions: the oldest XID is too big on {HOSTNAME}",
9191
"expression": "{#TEMPLATE:" + self.right_type(self.key, "xid_age") + ".last()}>" + self.plugin_config(
9292
"max_xid_age")
9393
}) + template.trigger({
94-
"name": "PostgreSQL query running is too old on {HOSTNAME}",
94+
"name": "PostgreSQL Transactions: running transaction is too old on {HOSTNAME}",
9595
"expression": "{#TEMPLATE:" + self.right_type(self.key,
9696
"transaction_time") + ".last()}>" + self.plugin_config(
9797
"max_transaction_time")

mamonsu/plugins/pgsql/prepared_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def graphs(self, template, dashboard=False):
9494

9595
def triggers(self, template, dashboard=False):
9696
result = template.trigger({
97-
"name": "PostgreSQL prepared transaction is too old on {HOSTNAME}",
97+
"name": "PostgreSQL Prepared Transactions: prepared transaction is too old on {HOSTNAME}",
9898
"expression": "{#TEMPLATE:" + self.key_prepared["key"] + ".last()}>" + self.plugin_config(
9999
"max_prepared_transaction_time")
100100
})

mamonsu/plugins/pgsql/relations_size.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def run(self, zbx):
8585

8686
def discovery_rules(self, template, dashboard=False):
8787
rule = {
88-
"name": "Relation size discovery",
88+
"name": "PostgreSQL Relations Sizes Discovery",
8989
"key": self.key_rel_size_discovery.format("[{0}]".format(self.Macros[self.Type])),
9090
}
9191
if Plugin.old_zabbix:
@@ -102,14 +102,14 @@ def discovery_rules(self, template, dashboard=False):
102102
}]
103103
items = [
104104
{"key": self.right_type(self.key_rel_size_discovery, var_discovery="{#RELATIONNAME},"),
105-
"name": "Relation size: {#RELATIONNAME}",
105+
"name": "PostgreSQL Relation Size: {#RELATIONNAME}",
106106
"units": Plugin.UNITS.bytes,
107107
"value_type": Plugin.VALUE_TYPE.numeric_unsigned,
108108
"delay": self.plugin_config("interval"),
109109
"drawtype": 2},
110110
]
111111
graphs = [{
112-
"name": "PostgreSQL relation size: {#RELATIONNAME}",
112+
"name": "PostgreSQL Relation Size: {#RELATIONNAME}",
113113
"type": 1,
114114
"items": [
115115
{"color": "8B817C",

0 commit comments

Comments
 (0)