diff options
author | Lennart Weller <lhw@ring0.de> | 2017-07-27 09:55:47 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2017-07-27 09:55:47 +0000 |
commit | a133c9c3b637b1dbe7b5b053f7e2572c1950cead (patch) | |
tree | 2207939a88e96bca329457f40a9d9d18ab659dc1 /src/freeipmi_plugin.c | |
parent | New upstream version 1.6.0+dfsg (diff) | |
download | netdata-a133c9c3b637b1dbe7b5b053f7e2572c1950cead.tar.xz netdata-a133c9c3b637b1dbe7b5b053f7e2572c1950cead.zip |
New upstream version 1.7.0+dfsgupstream/1.7.0+dfsg
Diffstat (limited to 'src/freeipmi_plugin.c')
-rw-r--r-- | src/freeipmi_plugin.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/freeipmi_plugin.c b/src/freeipmi_plugin.c index 4459de7ca..146268a53 100644 --- a/src/freeipmi_plugin.c +++ b/src/freeipmi_plugin.c @@ -242,7 +242,7 @@ _get_sensor_type_string (int sensor_type) static int debug = 0; -static int netdata_update_every = 5; +static int netdata_update_every = 5; // this is the minimum update frequency static int netdata_priority = 90000; static int netdata_do_sel = 1; @@ -1403,7 +1403,7 @@ int ipmi_detect_speed_secs(struct ipmi_monitoring_ipmi_config *ipmi_config) { // we find the average in microseconds // and we round-up to the closest second - return (( total * 2 / checks / 1000000 ) + 1); + return (int)(( total * 2 / checks / 1000000 ) + 1); } int main (int argc, char **argv) { @@ -1426,15 +1426,14 @@ int main (int argc, char **argv) { int i, freq = 0; for(i = 1; i < argc ; i++) { - if(!freq) { + if(isdigit(*argv[i]) && !freq) { int n = atoi(argv[i]); - if(n > 0) { + if(n > 0 && freq < 86400) { freq = n; continue; } } - - if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0 || strcmp("-V", argv[i]) == 0) { + else if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0 || strcmp("-V", argv[i]) == 0) { printf("freeipmi.plugin %s\n", VERSION); exit(0); } @@ -1568,7 +1567,7 @@ int main (int argc, char **argv) { freq = ipmi_detect_speed_secs(&ipmi_config); if(debug) fprintf(stderr, "freeipmi.plugin: IPMI minimum update frequency was calculated to %d seconds.\n", freq); - if(netdata_update_every < freq) { + if(freq > netdata_update_every) { info("enforcing minimum data collection frequency, calculated to %d seconds.", freq); netdata_update_every = freq; } |