@@ -59,8 +59,8 @@ def items(self, template, dashboard=False):
59
59
"type" : Plugin .TYPE .CALCULATED ,
60
60
"params" : "last(//{blocks_hit})*100/(last(//{blocks_hit})+last(//{blocks_read}))" .format (
61
61
# TODO: hardcoded params
62
- blocks_hit = self .right_type ("pgsql.blocks.hit {0}" ),
63
- blocks_read = self .right_type ("pgsql.blocks.read {0}" ))
62
+ blocks_hit = self .right_type ("pgsql.blocks{0}" , "hit " ),
63
+ blocks_read = self .right_type ("pgsql.blocks{0}" , "read " ))
64
64
}) + template .item ({
65
65
"name" : "PostgreSQL Health: Service Uptime" ,
66
66
"key" : self .right_type (self .key_uptime ),
@@ -106,19 +106,22 @@ def macros(self, template, dashboard=False):
106
106
return []
107
107
108
108
def triggers (self , template , dashboard = False ):
109
- result = template .trigger ({
110
- "name" : "PostgreSQL Health: service has been restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})" ,
111
- "expression" : "{#TEMPLATE:" + self .right_type (self .key_uptime ) + ".change()}>" +
112
- self .plugin_macros ["pg_uptime" ][0 ][1 ]
113
- }) + template .trigger ({
114
- "name" : "PostgreSQL Health: cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})" ,
115
- "expression" : "{#TEMPLATE:" + self .right_type (self .key_cache , "hit" ) + ".last()}<" +
116
- self .plugin_macros ["cache_hit_ratio_percent" ][0 ][1 ]
117
- }) + template .trigger ({
118
- "name" : "PostgreSQL Health: no ping from PostgreSQL for 3 minutes on {HOSTNAME}" ,
119
- "expression" : "{#TEMPLATE:" + self .right_type (self .key_ping ) + ".nodata(180)}=1"
120
- })
121
- return result
109
+ if self .Type == 'mamonsu' :
110
+ result = template .trigger ({
111
+ "name" : "PostgreSQL Health: service has been restarted on {HOSTNAME} (uptime={ITEM.LASTVALUE})" ,
112
+ "expression" : "{#TEMPLATE:" + self .right_type (self .key_uptime ) + ".change()}>" +
113
+ self .plugin_macros ["pg_uptime" ][0 ][1 ]
114
+ }) + template .trigger ({
115
+ "name" : "PostgreSQL Health: cache hit ratio too low on {HOSTNAME} ({ITEM.LASTVALUE})" ,
116
+ "expression" : "{#TEMPLATE:" + self .right_type (self .key_cache , "hit" ) + ".last()}<" +
117
+ self .plugin_macros ["cache_hit_ratio_percent" ][0 ][1 ]
118
+ }) + template .trigger ({
119
+ "name" : "PostgreSQL Health: no ping from PostgreSQL for 3 minutes on {HOSTNAME}" ,
120
+ "expression" : "{#TEMPLATE:" + self .right_type (self .key_ping ) + ".nodata(180)}=1"
121
+ })
122
+ return result
123
+ else :
124
+ return ""
122
125
123
126
def keys_and_queries (self , template_zabbix ):
124
127
# TODO: define another metric key because it duplicates native zabbix agents keys
0 commit comments