33from mamonsu import __version__
44from optparse import OptionParser , BadOptionError
55import mamonsu .lib .platform as platform
6+ from mamonsu .lib .default_config import DefaultConfig
67
78usage_msg = """
89Options:
910 -a, --add-plugins <directory>
1011 -c, --config <file>
1112 -p, --pid <pid-file>
12- -d daemonize
13- --version output version information, then exit
13+ """
14+ if platform .LINUX :
15+ usage_msg += """ -d daemonize
16+ """
17+
18+ usage_msg += """ --version output version information, then exit
1419 --help show this help, then exit
1520
1621Export example config with default variables:
1924 {prog} export config <file>
2025Options:
2126 --add-plugins <directory>
22-
23- Export zabbix keys for native zabbix-agent:
24- Command: export zabbix-parameters
25- Examples:
26- {prog} export zabbix-parameters <file>
27- Options:
28- --plugin-type <plugin_type> (pg|sys|all) by default all
29- --pg-version <pg_version> by default 10
30- --add-plugins <directory>
31- --config <file>
32- HINT: Supported version numbers are 12, 10, 11, 9.6, 9.5
33-
3427
35- Export template for native zabbix agent:
36- Command: export zabbix-template
37- Examples:
38- {prog} export zabbix-template [options] <file>
39- Options:
40- --template-name <template name> by default PostgresPro-<platform name>
41- --plugin-type <plugin_type> (pg|sys|all) by default all
42- --application <application name in template> by default App-PostgresPro-<platform name>
43- --add-plugins <directory>
44- --config <file>
45- --old-zabbix
46- By default, mamonsu exports the template for Zabbix 4.4 or higher.
47- To export a template for older Zabbix versions, use the --old-zabbix option.
48-
49-
5028Export zabbix template with additional plugins included in config file:
5129Command: export template
5230Examples:
6038HINT: By default, mamonsu exports the template for Zabbix 4.4 or higher.
6139To export a template for older Zabbix versions, use the --old-zabbix option.
6240
63-
6441Bootstrap DDL for monitoring:
6542Command: bootstrap
6643Examples:
7350 -U, --username <USERNAME>
7451 --host <PGHOST>
7552
76-
7753Information about working mamonsu:
7854Command: agent
7955Examples:
8359Options:
8460 -c, --config <file>
8561
86-
87-
8862Zabbix API toolbox:
8963Command: zabbix
9064Usage:
11488 --url=http://zabbix/web/face
11589 --user=WebUser
11690 --password=WebPassword
117-
91+
11892Export metrics to zabbix server
11993Command: upload
12094Example:
129103
130104if platform .LINUX :
131105 usage_msg += """
106+ Export zabbix keys for native zabbix-agent:
107+ Command: export zabbix-parameters
108+ Examples:
109+ {prog} export zabbix-parameters <file>
110+ Options:
111+ --plugin-type <plugin_type> (pg|sys|all) by default all
112+ --pg-version <pg_version> by default 10
113+ --add-plugins <directory>
114+ --config <file>
115+ HINT: Supported version numbers are 12, 10, 11, 9.6, 9.5
116+
117+ Export template for native zabbix agent:
118+ Command: export zabbix-template
119+ Examples:
120+ {prog} export zabbix-template [options] <file>
121+ Options:
122+ --template-name <template name> by default PostgresPro-<platform name>
123+ --plugin-type <plugin_type> (pg|sys|all) by default all
124+ --application <application name in template> by default App-PostgresPro-<platform name>
125+ --add-plugins <directory>
126+ --config <file>
127+ --old-zabbix
128+ By default, mamonsu exports the template for Zabbix 4.4 or higher.
129+ To export a template for older Zabbix versions, use the --old-zabbix option.
132130
133131Report about hardware and software:
134132Command: report
144142 -r, --print-report
145143 -w, --report-path <path to file>
146144
147-
148-
149145AutoTune config and system:
150146Command: tune
151147Options:
158154
159155if platform .WINDOWS :
160156 usage_msg += """
161-
162157AutoTune config and system:
163158Command: tune
164159Options:
@@ -179,7 +174,6 @@ class MissOptsParser(OptionParser):
179174 def print_help (self , ** kwargs ):
180175 print ("""
181176
182-
183177Export example config with default variables:
184178Command: export
185179Examples:
@@ -248,7 +242,7 @@ def parse_args():
248242 usage = usage_msg ,
249243 version = '%prog {0}' .format (__version__ ))
250244 parser .add_option (
251- '-c' , '--config' , dest = 'config_file' , default = '/etc/mamonsu/agent.conf' )
245+ '-c' , '--config' , dest = 'config_file' , default = DefaultConfig . default_config_path () )
252246 # pid
253247 parser .add_option (
254248 '-p' , '--pid' , dest = 'pid' , default = None )
0 commit comments