Remove global dinfo and use a local perfstat_disk_total_t structure for both
implemented metrics leaving part_max_used without implementation for now.
The first snippet is really part of the first patch
Signed-off-by: Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
---
trunk/monitor-core/libmetrics/aix/metrics.c | 29 ++++++++++++++-------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/trunk/monitor-core/libmetrics/aix/metrics.c
b/trunk/monitor-core/libmetrics/aix/metrics.c
index 6075ee4..dc53c94 100644
--- a/trunk/monitor-core/libmetrics/aix/metrics.c
+++ b/trunk/monitor-core/libmetrics/aix/metrics.c
@@ -3,7 +3,7 @@
*
* Libperfstat can deal with a 32-bit and a 64-bit Kernel and does not
require root authority.
*
- * The code has been tested with AIX 5.1, AIX 5.2 and AIX 5.3
+ * The code has been tested with AIX 4.3.3, AIX 5.1, AIX 5.2 and AIX 5.3
*
* Written by Michael Perzl ([EMAIL PROTECTED])
* and Nigel Griffiths ([EMAIL PROTECTED])
@@ -107,7 +107,6 @@ int ni_flag=0;
perfstat_cpu_total_t cpu_total_buffer;
perfstat_memory_total_t minfo;
-perfstat_disk_total_t dinfo;
perfstat_netinterface_total_t ninfo[2],*last_ninfo, *cur_ninfo ;
@@ -155,7 +154,6 @@ metric_init(void)
get_cpuinfo();
perfstat_memory_total(NULL, &minfo, sizeof(perfstat_memory_total_t), 1);
- perfstat_disk_total(NULL, &dinfo, sizeof(perfstat_disk_total_t), 1);
update_ifdata();
@@ -401,30 +399,35 @@ pkts_out_func ( void )
return val;
}
-
g_val_t
disk_free_func ( void )
{
g_val_t val;
+ perfstat_disk_total_t d;
- perfstat_disk_total(NULL, &dinfo, sizeof(perfstat_disk_total_t), 1);
- val.d = dinfo.free;
+ if (perfstat_disk_total(NULL, &d, sizeof(perfstat_disk_total_t), 1) == -1)
+ val.d = 0.0;
+ else
+ val.d = (double)d.free;
+
return val;
}
-
g_val_t
disk_total_func ( void )
{
g_val_t val;
- perfstat_disk_total(NULL, &dinfo, sizeof(perfstat_disk_total_t), 1);
- val.d =dinfo.size ;
+ pefstat_disk_total_t d;
+
+ if (perfstat_disk_total(NULL, &d, sizeof(perfstat_disk_total_t), 1) == -1)
+ val.d = 0.0;
+ else
+ val.d = (double)d.size;
+
return val;
}
-/* most used Partition dose not make sense to me
-** FIXME
-*/
+/* FIXME */
g_val_t
part_max_used_func ( void )
{
@@ -433,8 +436,6 @@ part_max_used_func ( void )
return val;
}
-
-
g_val_t
load_one_func ( void )
{
--
1.5.3.7
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers