1
1
import re
2
2
from mamonsu .plugins .system .plugin import SystemPlugin as Plugin
3
3
4
- PATH = "/etc/zabbix/scripts/agentd/zapgix"
4
+ # PATH = "/etc/zabbix/scripts/agentd/zapgix"
5
5
6
6
7
7
class DiskStats (Plugin ):
8
8
# todo yaxis right 100%
9
9
# bold line
10
10
AgentPluginType = 'sys'
11
- query_agent_discovery = PATH + "/disk_stats.sh -j BLOCKDEVICE"
11
+ query_agent_discovery = "/disk_stats.sh -j BLOCKDEVICE"
12
12
agent_query_read_op = "expr `grep -w '$1' /proc/diskstats | awk '{print $$4}'`"
13
13
agent_query_read_sc = "expr `grep -w '$1' /proc/diskstats | awk '{print $$6 * 512}'`"
14
14
agent_query_write_op = "expr `grep -w '$1' /proc/diskstats | awk '{print $$8}'`"
15
15
agent_query_write_sc = "expr `grep -w '$1' /proc/diskstats | awk '{print $$10 * 512}'`"
16
16
agent_query_ticks = "expr `grep -w '$1' /proc/diskstats | awk '{print $$13 / 10}'`"
17
- agent_query_read_op_all = PATH + "/disk_stats_read_op.sh" # get sum for all read_op
18
- agent_query_read_sc_all = PATH + "/disk_stats_read_b.sh"
19
- agent_query_write_op_all = PATH + "/disk_stats_write_op.sh"
20
- agent_query_write_sc_all = PATH + "/disk_stats_write_b.sh"
17
+ agent_query_read_op_all = "/disk_stats_read_op.sh" # get sum for all read_op
18
+ agent_query_read_sc_all = "/disk_stats_read_b.sh"
19
+ agent_query_write_op_all = "/disk_stats_write_op.sh"
20
+ agent_query_write_sc_all = "/disk_stats_write_b.sh"
21
21
22
22
key = 'system.disk'
23
23
@@ -187,14 +187,14 @@ def discovery_rules(self, template):
187
187
188
188
def keys_and_queries (self , template_zabbix ):
189
189
result = []
190
- result .append ('system.disk.discovery,{0}' .format (self .query_agent_discovery ))
190
+ result .append ('system.disk.discovery,{0}{1} ' .format (Plugin . PATH , self .query_agent_discovery ))
191
191
result .append ('system.disk.utilization[*],{0}' .format (self .agent_query_ticks ))
192
192
result .append ('system.disk.read[*],{0}' .format (self .agent_query_read_op ))
193
193
result .append ('system.disk.write[*],{0}' .format (self .agent_query_write_op ))
194
194
result .append ('system.disk.read_b[*],{0}' .format (self .agent_query_read_sc ))
195
195
result .append ('system.disk.write_b[*],{0}' .format (self .agent_query_write_sc ))
196
- result .append ('system.disk.all_read,{0}' .format (self .agent_query_read_op_all ))
197
- result .append ('system.disk.all_write,{0}' .format (self .agent_query_write_op_all ))
198
- result .append ('system.disk.all_read_b,{0}' .format (self .agent_query_read_sc_all ))
199
- result .append ('system.disk.all_write_b,{0}' .format (self .agent_query_write_sc_all ))
196
+ result .append ('system.disk.all_read,{0}{1} ' .format (Plugin . PATH , self .agent_query_read_op_all ))
197
+ result .append ('system.disk.all_write,{0}{1} ' .format (Plugin . PATH , self .agent_query_write_op_all ))
198
+ result .append ('system.disk.all_read_b,{0}{1} ' .format (Plugin . PATH , self .agent_query_read_sc_all ))
199
+ result .append ('system.disk.all_write_b,{0}{1} ' .format (Plugin . PATH , self .agent_query_write_sc_all ))
200
200
return template_zabbix .key_and_query (result )
0 commit comments