Skip to content

Commit e591d1d

Browse files
committed
fix: change path for scripts for zabbix agent
1 parent 12094cb commit e591d1d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

mamonsu/plugins/system/linux/disk_sizes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import os
22
from mamonsu.plugins.system.plugin import SystemPlugin as Plugin
33

4-
PATH = "/etc/zabbix/scripts/agentd/zapgix"
4+
#PATH = "/etc/zabbix/scripts/agentd/zapgix"
55

66

77
class DiskSizes(Plugin):
88
AgentPluginType = 'sys'
99

10-
query_agent_discovery = PATH + "/disk_sizes.sh -j MOUNTPOINT"
10+
query_agent_discovery = "/disk_sizes.sh -j MOUNTPOINT"
1111
query_agent_used = "df $1 | awk 'NR == 2 {print $$3 * 1024}'"
1212
query_agent_free = "df $1 | awk 'NR == 2 {print $$4 * 1024}'"
1313
query_agent_percent_free = "df $1 | awk 'NR == 2 {print 100 - $$5}'"
@@ -128,7 +128,7 @@ def discovery_rules(self, template):
128128

129129
def keys_and_queries(self, template_zabbix):
130130
result = []
131-
result.append('system.vfs.discovery,{0}'.format(self.query_agent_discovery))
131+
result.append('system.vfs.discovery,{0}{1}'.format(Plugin.PATH, self.query_agent_discovery))
132132
result.append('system.vfs.used[*],{0}'.format(self.query_agent_used))
133133
result.append('system.vfs.free[*],{0}'.format(self.query_agent_free))
134134
result.append('system.vfs.percent_free[*],{0}'.format(self.query_agent_percent_free))

mamonsu/plugins/system/linux/disk_stats.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import re
22
from mamonsu.plugins.system.plugin import SystemPlugin as Plugin
33

4-
PATH = "/etc/zabbix/scripts/agentd/zapgix"
4+
#PATH = "/etc/zabbix/scripts/agentd/zapgix"
55

66

77
class DiskStats(Plugin):
88
# todo yaxis right 100%
99
# bold line
1010
AgentPluginType = 'sys'
11-
query_agent_discovery = PATH + "/disk_stats.sh -j BLOCKDEVICE"
11+
query_agent_discovery = "/disk_stats.sh -j BLOCKDEVICE"
1212
agent_query_read_op = "expr `grep -w '$1' /proc/diskstats | awk '{print $$4}'`"
1313
agent_query_read_sc = "expr `grep -w '$1' /proc/diskstats | awk '{print $$6 * 512}'`"
1414
agent_query_write_op = "expr `grep -w '$1' /proc/diskstats | awk '{print $$8}'`"
1515
agent_query_write_sc = "expr `grep -w '$1' /proc/diskstats | awk '{print $$10 * 512}'`"
1616
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"
2121

2222
key = 'system.disk'
2323

@@ -187,14 +187,14 @@ def discovery_rules(self, template):
187187

188188
def keys_and_queries(self, template_zabbix):
189189
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))
191191
result.append('system.disk.utilization[*],{0}'.format(self.agent_query_ticks))
192192
result.append('system.disk.read[*],{0}'.format(self.agent_query_read_op))
193193
result.append('system.disk.write[*],{0}'.format(self.agent_query_write_op))
194194
result.append('system.disk.read_b[*],{0}'.format(self.agent_query_read_sc))
195195
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))
200200
return template_zabbix.key_and_query(result)

mamonsu/plugins/system/linux/net.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from mamonsu.plugins.system.plugin import SystemPlugin as Plugin
22

3-
PATH = "/etc/zabbix/scripts/agentd/zapgix"
3+
#PATH = "/etc/zabbix/scripts/agentd/zapgix"
44

55

66
class Net(Plugin):
7-
query_agent_discovery = PATH + "/net.sh -j NETDEVICE"
7+
query_agent_discovery = "/net.sh -j NETDEVICE"
88
query_agent = "expr `grep -Ei '$1' /proc/net/dev | awk '{print $$"
99
AgentPluginType = 'sys'
1010
# position in line, key, desc, units
@@ -68,7 +68,7 @@ def discovery_rules(self, template):
6868

6969
def keys_and_queries(self, template_zabbix):
7070
result = []
71-
result.append('system.net.discovery,{0}'.format(self.query_agent_discovery))
71+
result.append('system.net.discovery,{0}{1}'.format(Plugin.PATH, self.query_agent_discovery))
7272
for item in self.Items:
7373
result.append('{0}[*], {1}'.format(item[1], self.query_agent + str(item[0] + 2) + "}'`"))
7474
return template_zabbix.key_and_query(result)

0 commit comments

Comments
 (0)