Skip to content

Commit 7c345a9

Browse files
committed
fix: rename option which sends data to zabbix server and update mamonsu help
1 parent 15c39b1 commit 7c345a9

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

mamonsu/lib/parser.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
application = App-PostgresPro-<platform name>, pg-version = 10,
5454
Note: default pg-version is vanilla, but with PGPRO or PGEE before version number it can be changed. Supported version
5555
numbers are 10, 11, 9.6, 9.5
56-
default template export for currently supported zabbix -server versions, if template for unsupported versions
57-
is needed use --old zabbix flag
56+
By default, mamonsu exports the template for Zabbix 4.4 or higher.
57+
To export a template for older Zabbix versions, use the --old-zabbix option.
5858
Example: PGPRO_10 or PGEE_11 or PGPRO_9.6
5959
6060
@@ -69,8 +69,8 @@
6969
--config <file>
7070
--old-zabbix
7171
Default template name = PostgresPro-<platform name>, application = App-PostgresPro-<platform name>
72-
Note: default template export for currently supported zabbix -server versions, if template for unsupported versions
73-
is needed use --old zabbix flag
72+
By default, mamonsu exports the template for Zabbix 4.4 or higher.
73+
To export a template for older Zabbix versions, use the --old-zabbix option.
7474
7575
7676
Bootstrap DDL for monitoring:
@@ -127,14 +127,14 @@
127127
{prog} zabbix item lastclock <host name>
128128
129129
Export metrics to zabbix server
130-
Command: --send-data-zabbix
130+
Command: upload
131131
Example:
132-
{prog} --send-data-zabbix --zabbix-file=localhost.log --zabbix-address=localhost
132+
{prog} upload --zabbix-address=localhost
133133
Options:
134134
--zabbix-address <name of the Zabbix host to send metrics>
135135
--zabbix-port <port of Zabbix server to send metrics> by default 10051
136-
--zabbix-file <path to file with metrics to send metrics>
137-
--zabbix-client <name of the Zabbix host to send metrics> by default localhost
136+
--zabbix-file <text file that stores the collected metric data to be visualized, such as localhost>
137+
--zabbix-client <name of the host on Zabbix Server to send metrics>
138138
--zabbix-log-level <log level to send metrics> (INFO|DEBUG|WARN) by default INFO
139139
"""
140140

@@ -291,7 +291,7 @@ def parse_args():
291291
# name of the Zabbix host to send metrics
292292
parser.add_option('--zabbix-client', dest='zabbix_client', default='localhost')
293293
# path to file with metrics to send metrics
294-
parser.add_option('--zabbix-file', dest='zabbix_file', default=None)
294+
parser.add_option('--zabbix-file', dest='zabbix_file', default='/var/log/mamonsu/localhost')
295295
# log level to send metrics
296296
parser.add_option('--zabbix-log-level', dest='zabbix_log_level', default='INFO')
297297
return parser.parse_args()

mamonsu/lib/runner.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,21 @@ def quit_handler(_signo=None, _stack_frame=None):
5151
from mamonsu.tools.agent.start import run_agent
5252
sys.argv.remove('agent')
5353
return run_agent()
54-
elif tool == '--send-data-zabbix':
55-
args, _ = parse_args()
54+
elif tool == 'upload':
55+
args, commands = parse_args()
5656
if not args.zabbix_address:
57-
print('To send metrics to zabbix, please, add option --zabbix-addres')
57+
print('Option --zabbix-address is missing')
58+
print_total_help()
5859
exit(125)
5960

60-
if not args.zabbix_file:
61-
print ('To send metrics to zabbix, please, add option --zabbix_file')
62-
exit(123)
63-
6461
cfg = Config(args.config_file, args.plugins_dirs)
65-
cfg.config.set('zabbix','address',args.zabbix_address)
66-
cfg.config.set('zabbix','port',args.zabbix_port)
67-
cfg.config.set('zabbix', 'client', args.zabbix_client)
62+
cfg.config.set('zabbix', 'address', args.zabbix_address)
63+
cfg.config.set('zabbix', 'port', args.zabbix_port)
64+
cfg.config.set('zabbix', 'client', args.zabbix_client)
6865
cfg.config.set('log', 'level', args.zabbix_log_level)
6966

7067
supervisor = Supervisor(cfg)
71-
supervisor.send_file_zabbix(cfg,args.zabbix_file)
68+
supervisor.send_file_zabbix(cfg, args.zabbix_file)
7269
exit(0)
7370

7471
elif tool == 'export':

mamonsu/lib/supervisor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ def _loop(self):
6464
self._sender.send('mamonsu.plugin.errors[]', '')
6565
plugin_errors, plugin_probes = 0, 0
6666

67-
def send_file_zabbix(self,cfg,path):
68-
zbxSender = ZbxSender (cfg)
69-
zbxSender.send_file_to_zabbix(path)
67+
def send_file_zabbix(self, cfg, path):
68+
sender = ZbxSender(cfg)
69+
sender.send_file_to_zabbix(path)

0 commit comments

Comments
 (0)