| 1 |
+ |
/* |
| 2 |
+ |
* i-scream central monitoring system |
| 3 |
+ |
* http://www.i-scream.org.uk |
| 4 |
+ |
* Copyright (C) 2000-2002 i-scream |
| 5 |
+ |
* |
| 6 |
+ |
* This program is free software; you can redistribute it and/or |
| 7 |
+ |
* modify it under the terms of the GNU General Public License |
| 8 |
+ |
* as published by the Free Software Foundation; either version 2 |
| 9 |
+ |
* of the License, or (at your option) any later version. |
| 10 |
+ |
* |
| 11 |
+ |
* This program is distributed in the hope that it will be useful, |
| 12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
+ |
* GNU General Public License for more details. |
| 15 |
+ |
* |
| 16 |
+ |
* You should have received a copy of the GNU General Public License |
| 17 |
+ |
* along with this program; if not, write to the Free Software |
| 18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
+ |
*/ |
| 20 |
+ |
|
| 21 |
|
#include <stdio.h> |
| 22 |
|
#include <sys/types.h> |
| 23 |
|
#include <sys/statvfs.h> |
| 54 |
|
while((getmntent(f, &mp)) == 0){ |
| 55 |
|
if ((statvfs(mp.mnt_mountp, &df)) !=0){ |
| 56 |
|
errf("Failed to gets fs stats (%m)"); |
| 57 |
< |
die(); |
| 57 |
> |
continue; |
| 58 |
|
} |
| 59 |
+ |
|
| 60 |
+ |
if((((strcmp(mp.mnt_fstype,"ufs"))==0) || (strcmp(mp.mnt_fstype,"tmpfs")) ==0)){ |
| 61 |
|
|
| 62 |
< |
printf("packet.disk.p%d.attributes.mount %s\n", counter, mp.mnt_mountp); |
| 63 |
< |
printf("packet.disk.p%d.attributes.name %s\n", counter, mp.mnt_special); |
| 64 |
< |
printf("packet.disk.p%d.attributes.kbytes %lu\n",counter, ((df.f_frsize/1024) * df.f_blocks)); |
| 65 |
< |
printf("packet.disk.p%d.attributes.used %lu\n",counter, (((df.f_frsize/1024) * df.f_blocks) -((df.f_frsize/1024) * df.f_bfree))); |
| 66 |
< |
printf("packet.disk.p%d.attributes.avail %lu\n",counter, (df.f_frsize/1024) * df.f_bavail); |
| 67 |
< |
printf("packet.disk.p%d.attributes.totalinodes %lu\n", counter, df.f_files); |
| 68 |
< |
printf("packet.disk.p%d.attributes.freeinodes %lu\n",counter, df.f_ffree); |
| 62 |
> |
printf("packet.disk.p%d.attributes.mount %s\n", counter, mp.mnt_mountp); |
| 63 |
> |
printf("packet.disk.p%d.attributes.name %s\n", counter, mp.mnt_special); |
| 64 |
> |
printf("packet.disk.p%d.attributes.kbytes %lu\n",counter, ((df.f_frsize/1024) * df.f_blocks)); |
| 65 |
> |
printf("packet.disk.p%d.attributes.used %lu\n",counter, (((df.f_frsize/1024) * df.f_blocks) -((df.f_frsize/1024) * df.f_bfree))); |
| 66 |
> |
printf("packet.disk.p%d.attributes.avail %lu\n",counter, (df.f_frsize/1024) * df.f_bavail); |
| 67 |
> |
printf("packet.disk.p%d.attributes.totalinodes %lu\n", counter, df.f_files); |
| 68 |
> |
printf("packet.disk.p%d.attributes.freeinodes %lu\n",counter, df.f_ffree); |
| 69 |
|
|
| 70 |
< |
counter++; |
| 70 |
> |
counter++; |
| 71 |
> |
} |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|