]> arthur.barton.de Git - netdata.git/commitdiff
added common version options to all C programs; fixes #1927
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Mar 2017 09:48:48 +0000 (11:48 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Mar 2017 09:48:48 +0000 (11:48 +0200)
src/apps_plugin.c
src/freeipmi_plugin.c
src/main.c

index 338e6afbd3ef52184c445795a9808b32ef9a8cb8..bea06c3c84030d07cf2c2260bb6ca2c4df678d10 100644 (file)
@@ -3199,7 +3199,7 @@ static void parse_args(int argc, char **argv)
             }
         }
 
-        if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0) {
+        if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0 || strcmp("-V", argv[i]) == 0) {
             printf("apps.plugin %s\n", VERSION);
             exit(0);
         }
@@ -3269,7 +3269,7 @@ static void parse_args(int argc, char **argv)
                     "\n"
                     " This program is a data collector plugin for netdata.\n"
                     "\n"
-                    " Valid command line options:\n"
+                    " Available command line options:\n"
                     "\n"
                     " SECONDS           set the data collection frequency\n"
                     "\n"
@@ -3292,7 +3292,7 @@ static void parse_args(int argc, char **argv)
                     "                   apps_groups.conf\n"
                     "                   (default NAME=groups)\n"
                     "\n"
-                    " version           print program version and exit\n"
+                    " version or -v or -V print program version and exit\n"
                     "\n"
                     , VERSION
             );
index 78a3a6f5192330218399f4875056c0c686265dcd..4459de7cac48845dce507b700380af8835299c2b 100644 (file)
@@ -1434,7 +1434,11 @@ int main (int argc, char **argv) {
             }
         }
 
-        if(strcmp("debug", argv[i]) == 0) {
+        if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0 || strcmp("-V", argv[i]) == 0) {
+            printf("freeipmi.plugin %s\n", VERSION);
+            exit(0);
+        }
+        else if(strcmp("debug", argv[i]) == 0) {
             debug = 1;
             continue;
         }
@@ -1449,21 +1453,55 @@ int main (int argc, char **argv) {
         else if(strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
             fprintf(stderr,
                     "\n"
-                    "netdata freeipmi.plugin " VERSION "\n"
-                    "Usage:\n"
+                    " netdata freeipmi.plugin %s\n"
+                    " Copyright (C) 2016-2017 Costa Tsaousis <costa@tsaousis.gr>\n"
+                    " Released under GNU General Public License v3 or later.\n"
+                    " All rights reserved.\n"
+                    "\n"
+                    " This program is a data collector plugin for netdata.\n"
+                    "\n"
+                    " Available command line options:\n"
+                    "\n"
+                    "  SECONDS                 data collection frequency\n"
+                    "                          minimum: %d\n"
+                    "\n"
+                    "  debug                   enable verbose output\n"
+                    "                          default: disabled\n"
+                    "\n"
+                    "  sel\n"
+                    "  no-sel                  enable/disable SEL collection\n"
+                    "                          default: %s\n"
+                    "\n"
+                    "  hostname HOST\n"
+                    "  username USER\n"
+                    "  password PASS           connect to remote IPMI host\n"
+                    "                          default: local IPMI processor\n"
+                    "\n"
+                    "  sdr-cache-dir PATH      directory for SDR cache files\n"
+                    "                          default: %s\n"
+                    "\n"
+                    "  sensor-config-file FILE filename to read sensor configuration\n"
+                    "                          default: %s\n"
+                    "\n"
+                    "  -v\n"
+                    "  -V\n"
+                    "  version                 print version and exit\n"
+                    "\n"
+                    " Linux kernel module for IPMI is CPU hungry.\n"
+                    " On Linux run this to lower kipmiN CPU utilization:\n"
+                    " # echo 10 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us\n"
+                    "\n"
+                    " or create: /etc/modprobe.d/ipmi.conf with these contents:\n"
+                    " options ipmi_si kipmid_max_busy_us=10\n"
                     "\n"
-                    "  freeipmi.plugin [OPTIONS]\n"
+                    " For more information:\n"
+                    " https://github.com/firehol/netdata/wiki/monitoring-IPMI\n"
                     "\n"
-                    "Available options:\n"
-                    "  NUMBER, sets the data collection frequency\n"
-                    "  debug, enables verbose output\n"
-                    "  sel, enable SEL collection (it is on by default)\n"
-                    "  no-sel, disable SEL collection\n"
-                    "  hostname X, sets the remote host to connect to\n"
-                    "  username X, sets the username to authenticate at the remote host\n"
-                    "  password X, sets the password to authenticate at the remote host\n"
-                    "  sdr-cache-dir X, sets the directory to save SDR cache files\n"
-                    "  sensor-config-file X, set the filename to read sensor configuration\n"
+                    , VERSION
+                    , netdata_update_every
+                    , netdata_do_sel?"enabled":"disabled"
+                    , sdr_cache_directory?sdr_cache_directory:"system default"
+                    , sensor_config_file?sensor_config_file:"system default"
             );
             exit(1);
         }
index 86bd8604be39ba7b6687ed584f4ab88760e5e01c..20722a58f0cd60d8362de62499c9420f589ad2cd 100644 (file)
@@ -230,6 +230,7 @@ struct option_def options[] = {
     { 't', "The internal clock of netdata.",              "seconds",     "1"},
     { 'u', "Run as user.",                                "username",    "netdata"},
     { 'v', "Print netdata version and exit.",             NULL,          NULL},
+    { 'V', "Print netdata version and exit.",             NULL,          NULL},
     { 'W', "See Advanced options below.",                 "options",     NULL},
 };
 
@@ -614,6 +615,7 @@ int main(int argc, char **argv) {
                     config_set(CONFIG_SECTION_GLOBAL, "run as user", optarg);
                     break;
                 case 'v':
+                case 'V':
                     printf("%s %s\n", program_name, program_version);
                     return 0;
                 case 'W':