X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdf.c;h=0f357d8ded8671e7ced051c4b0b01c17760653cd;hb=e4b274ed754af52196d3390b8ce101a7f94e318a;hp=fde5d9ae503692b492286604f561c747350f850a;hpb=2d897a731bd23f7a33b89e7b7e3004b6b26b5a94;p=collectd.git diff --git a/src/df.c b/src/df.c index fde5d9ae..0f357d8d 100644 --- a/src/df.c +++ b/src/df.c @@ -26,12 +26,6 @@ #include "utils_mount.h" #include "utils_ignorelist.h" -#if HAVE_STATFS || HAVE_STATVFS -# define DF_HAVE_READ 1 -#else -# define DF_HAVE_READ 0 -#endif - #if HAVE_STATVFS # if HAVE_SYS_STATVFS_H # include @@ -44,21 +38,10 @@ # endif # define STATANYFS statfs # define BLOCKSIZE(s) (s).f_bsize +#else +# error "No applicable input method." #endif -/* 2^50 - 1 == 1125899906842623 = 1 Petabyte */ -static data_source_t dsrc[2] = -{ - {"free", DS_TYPE_GAUGE, 0, 1125899906842623.0}, - {"used", DS_TYPE_GAUGE, 0, 1125899906842623.0} -}; - -static data_set_t ds = -{ - "df", 2, dsrc -}; - -#if DF_HAVE_READ static const char *config_keys[] = { "Device", @@ -174,7 +157,10 @@ static int df_read (void) { if (STATANYFS (mnt_ptr->dir, &statbuf) < 0) { - syslog (LOG_ERR, "statv?fs failed: %s", strerror (errno)); + char errbuf[1024]; + ERROR ("statv?fs failed: %s", + sstrerror (errno, errbuf, + sizeof (errbuf))); continue; } @@ -218,15 +204,11 @@ static int df_read (void) return (0); } /* int df_read */ -#endif /* DF_HAVE_READ */ void module_register (void) { - plugin_register_data_set (&ds); - -#if DF_HAVE_READ - plugin_register_config ("df", df_config, config_keys, config_keys_num); + plugin_register_config ("df", df_config, + config_keys, config_keys_num); plugin_register_init ("df", df_init); plugin_register_read ("df", df_read); -#endif } /* void module_register */