Disk stat for fsusage.c is compiled in different route between nagios plug v 1.4 and 1.4.15

Yu Watanabe yu.watanabe at jp.fujitsu.com
Thu Dec 1 13:27:42 CET 2011


Hi!

I have found that the fsusage.c (where get_fs_usage is defined)
is compiled differently in versions between nagios plugins 1.4 and 1.4.15.
I have compiled both plugins on same platform.

In 1.4, fsusage.c is compiled in the route where most of the stats are
retrieved by  'full_read'

    150   struct filsys fsd;
    151   int fd;
    152
    153   if (! disk)
    154     {
    155       errno = 0;
    156       return -1;
    157     }
    158
    159   fd = open (disk, O_RDONLY);
    160   if (fd < 0)
    161     return -1;
    162   lseek (fd, (off_t) SUPERBOFF, 0);
    163   if (full_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
    164     {
    165       close (fd);
    166       return -1;
    167     }
    168   close (fd);

    'blocksize' is overlapped by 'statfs'

    182 #ifdef STAT_STATFS2_BSIZE       /* 4.3BSD, SunOS 4, HP-UX, AIX */
    185   struct statfs fsd;
    186
    187   if (statfs (path, &fsd) < 0)
    188     return -1;
    189
    190   fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);

However , in v 1.4.15 , fsusage.c is compiled in the route where all the stats are
retrieved by 'statfs'

    171 #elif defined STAT_STATFS2_BSIZE        /* 4.3BSD, SunOS 4, HP-UX, AIX */
    173
    174   struct statfs fsd;
    175
    176   if (statfs (file, &fsd) < 0)
    177     return -1;
    178
    179   fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);

    then it goes into the route,

    232 #if (defined STAT_STATVFS \
    233      || (!defined STAT_STATFS2_FS_DATA && !defined STAT_READ_FILSYS))
    234
    236   fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
    237   fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
    238   fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail);
    239   fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0;
    240   fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
    241   fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
    242
    243 #endif

This difference cases the difference in the output.

(v 1.4)
DISK OK - free space: / 17211 MB (35%);| /=32385MB;34716;44635;0;49595

(v 1.4.15)
DISK OK - free space: / 17210 MB (36% inode=98%);| /=29825MB;34716;44635;0;49595

This seems to be caused in the configure where all the compile 
options are decided. I am trying to figure out why there is a 
difference in the compile option. The inode prompts correctly 
in RHEL 4.

It would be helpful if someone can give me a hand with this...

Thanks,
Yu


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list