X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Ffreeipmi_plugin.c;h=4459de7cac48845dce507b700380af8835299c2b;hb=6ca841ea4979329fc0ca9aa41bcc8fcb90737d04;hp=5a95688e8216cd8c9606f38887f8cb6a7b16c8db;hpb=7cb2527958e61d7f15383c78ddc20d3a54f082a7;p=netdata.git diff --git a/src/freeipmi_plugin.c b/src/freeipmi_plugin.c index 5a95688e..4459de7c 100644 --- a/src/freeipmi_plugin.c +++ b/src/freeipmi_plugin.c @@ -249,9 +249,9 @@ static int netdata_do_sel = 1; static size_t netdata_sensors_updated = 0; static size_t netdata_sensors_collected = 0; static size_t netdata_sel_events = 0; -static size_t netdata_sensors_state_nominal = 0; -static size_t netdata_sensors_state_warning = 0; -static size_t netdata_sensors_state_critical = 0; +static size_t netdata_sensors_states_nominal = 0; +static size_t netdata_sensors_states_warning = 0; +static size_t netdata_sensors_states_critical = 0; struct sensor { int record_id; @@ -284,9 +284,9 @@ static void netdata_mark_as_not_updated() { netdata_sensors_collected = 0; netdata_sel_events = 0; - netdata_sensors_state_nominal = 0; - netdata_sensors_state_warning = 0; - netdata_sensors_state_critical = 0; + netdata_sensors_states_nominal = 0; + netdata_sensors_states_warning = 0; + netdata_sensors_states_critical = 0; } static void send_chart_to_netdata_for_units(int units) { @@ -467,7 +467,7 @@ static void send_metrics_to_netdata_for_units(int units) { } static void send_metrics_to_netdata() { - static int sel_chart_generated = 0, sensors_state_chart_generated = 0; + static int sel_chart_generated = 0, sensors_states_chart_generated = 0; struct sensor *sn; if(netdata_do_sel && !sel_chart_generated) { @@ -479,9 +479,9 @@ static void send_metrics_to_netdata() { printf("DIMENSION events '' absolute 1 1\n"); } - if(!sensors_state_chart_generated) { - sensors_state_chart_generated = 1; - printf("CHART ipmi.sensors_state '' 'IPMI Sensors State' 'sensors' 'sensors' ipmi.sensors_state stacked %d %d\n" + if(!sensors_states_chart_generated) { + sensors_states_chart_generated = 1; + printf("CHART ipmi.sensors_states '' 'IPMI Sensors State' 'sensors' 'states' ipmi.sensors_states line %d %d\n" , netdata_priority + 1 , netdata_update_every ); @@ -505,14 +505,14 @@ static void send_metrics_to_netdata() { } printf( - "BEGIN ipmi.sensors_state\n" + "BEGIN ipmi.sensors_states\n" "SET nominal = %zu\n" "SET warning = %zu\n" "SET critical = %zu\n" "END\n" - , netdata_sensors_state_nominal - , netdata_sensors_state_warning - , netdata_sensors_state_critical + , netdata_sensors_states_nominal + , netdata_sensors_states_warning + , netdata_sensors_states_critical ); // send metrics to netdata @@ -592,15 +592,15 @@ static void netdata_get_sensor( switch(sensor_state) { case IPMI_MONITORING_STATE_NOMINAL: - netdata_sensors_state_nominal++; + netdata_sensors_states_nominal++; break; case IPMI_MONITORING_STATE_WARNING: - netdata_sensors_state_warning++; + netdata_sensors_states_warning++; break; case IPMI_MONITORING_STATE_CRITICAL: - netdata_sensors_state_critical++; + netdata_sensors_states_critical++; break; default: @@ -1434,26 +1434,74 @@ 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; } + else if(strcmp("sel", argv[i]) == 0) { + netdata_do_sel = 1; + continue; + } + else if(strcmp("no-sel", argv[i]) == 0) { + netdata_do_sel = 0; + continue; + } 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 \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" - " 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); } @@ -1495,7 +1543,7 @@ int main (int argc, char **argv) { error("freeipmi.plugin: ignoring parameter '%s'", argv[i]); } - if(freq > 0 && freq < netdata_update_every) + if(freq > netdata_update_every) netdata_update_every = freq; else if(freq)