|
|
ed64c5 |
From b3a0f481304e76b5fe3ec69025df20cea16e6f0e Mon Sep 17 00:00:00 2001
|
|
|
ed64c5 |
From: Sebastien GODARD <sysstat@orange.fr.fake>
|
|
|
ed64c5 |
Date: Sat, 18 May 2013 22:04:27 +0200
|
|
|
ed64c5 |
Subject: [PATCH] Filesystems statistics (part 6): XML output format
|
|
|
ed64c5 |
|
|
|
ed64c5 |
This patch adds XML output format for filesystems statistics. This
|
|
|
ed64c5 |
format can be displayed with sadf option -x.
|
|
|
ed64c5 |
DTD and XML Schema (xsd) documents have also been updated.
|
|
|
ed64c5 |
|
|
|
ed64c5 |
(cherry picked from commit 1eddc64a1db0efd5cdffd5d272adb9f8d4ccb589)
|
|
|
ed64c5 |
---
|
|
|
ed64c5 |
sadf.h | 2 +-
|
|
|
ed64c5 |
xml/{sysstat-2.15.dtd => sysstat-2.16.dtd} | 18 ++++++++++++--
|
|
|
ed64c5 |
xml/sysstat.xsd | 22 ++++++++++++++++-
|
|
|
ed64c5 |
xml_stats.c | 38 +++++++++++++++++++++++++++++-
|
|
|
ed64c5 |
4 files changed, 75 insertions(+), 5 deletions(-)
|
|
|
ed64c5 |
rename xml/{sysstat-2.15.dtd => sysstat-2.16.dtd} (96%)
|
|
|
ed64c5 |
|
|
|
ed64c5 |
diff --git a/sadf.h b/sadf.h
|
|
|
ed64c5 |
index 786d3b0..198568a 100644
|
|
|
ed64c5 |
--- a/sadf.h
|
|
|
ed64c5 |
+++ b/sadf.h
|
|
|
ed64c5 |
@@ -9,7 +9,7 @@
|
|
|
ed64c5 |
#include "sa.h"
|
|
|
ed64c5 |
|
|
|
ed64c5 |
/* DTD version for XML output */
|
|
|
ed64c5 |
-#define XML_DTD_VERSION "2.15"
|
|
|
ed64c5 |
+#define XML_DTD_VERSION "2.16"
|
|
|
ed64c5 |
|
|
|
ed64c5 |
/* Possible actions for functions used to display reports */
|
|
|
ed64c5 |
#define F_BEGIN 0x01
|
|
|
ed64c5 |
diff --git a/xml/sysstat-2.15.dtd b/xml/sysstat-2.16.dtd
|
|
|
ed64c5 |
similarity index 96%
|
|
|
ed64c5 |
rename from xml/sysstat-2.15.dtd
|
|
|
ed64c5 |
rename to xml/sysstat-2.16.dtd
|
|
|
ed64c5 |
index e0b7bfb..06faed2 100644
|
|
|
ed64c5 |
--- a/xml/sysstat-2.15.dtd
|
|
|
ed64c5 |
+++ b/xml/sysstat-2.16.dtd
|
|
|
ed64c5 |
@@ -1,11 +1,11 @@
|
|
|
ed64c5 |
|
|
|
ed64c5 |
-
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
-
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
|
|
|
ed64c5 |
@@ -551,3 +551,17 @@
|
|
|
ed64c5 |
manufact CDATA #REQUIRED
|
|
|
ed64c5 |
product CDATA #REQUIRED
|
|
|
ed64c5 |
>
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ fsname CDATA #REQUIRED
|
|
|
ed64c5 |
+ MBfsfree CDATA #REQUIRED
|
|
|
ed64c5 |
+ MBfsused CDATA #REQUIRED
|
|
|
ed64c5 |
+ fsused-percent CDATA #REQUIRED
|
|
|
ed64c5 |
+ ufsused-percent CDATA #REQUIRED
|
|
|
ed64c5 |
+ Ifree CDATA #REQUIRED
|
|
|
ed64c5 |
+ Iused CDATA #REQUIRED
|
|
|
ed64c5 |
+ Iused-percent CDATA #REQUIRED
|
|
|
ed64c5 |
+>
|
|
|
ed64c5 |
diff --git a/xml/sysstat.xsd b/xml/sysstat.xsd
|
|
|
ed64c5 |
index 8304ac5..09818f6 100644
|
|
|
ed64c5 |
--- a/xml/sysstat.xsd
|
|
|
ed64c5 |
+++ b/xml/sysstat.xsd
|
|
|
ed64c5 |
@@ -1,7 +1,7 @@
|
|
|
ed64c5 |
|
|
|
ed64c5 |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://pagesperso-orange.fr/sebastien.godard/sysstat" targetNamespace="http://pagesperso-orange.fr/sebastien.godard/sysstat" elementFormDefault="qualified">
|
|
|
ed64c5 |
<xs:annotation>
|
|
|
ed64c5 |
- <xs:appinfo>-- XML Schema v2.15 for sysstat. See sadf.h --</xs:appinfo>
|
|
|
ed64c5 |
+ <xs:appinfo>-- XML Schema v2.16 for sysstat. See sadf.h --</xs:appinfo>
|
|
|
ed64c5 |
</xs:annotation>
|
|
|
ed64c5 |
|
|
|
ed64c5 |
<xs:element name="sysstat" type="sysstat-type"></xs:element>
|
|
|
ed64c5 |
@@ -97,6 +97,7 @@
|
|
|
ed64c5 |
<xs:element name="disk" type="disk-type"></xs:element>
|
|
|
ed64c5 |
<xs:element name="network" type="network-type"></xs:element>
|
|
|
ed64c5 |
<xs:element name="power-management" type="power-management-type"></xs:element>
|
|
|
ed64c5 |
+ <xs:element name="filesystems" type="filesystems-type"></xs:element>
|
|
|
ed64c5 |
</xs:sequence>
|
|
|
ed64c5 |
<xs:attribute name="date" type="xs:date"></xs:attribute>
|
|
|
ed64c5 |
<xs:attribute name="time" type="xs:time"></xs:attribute>
|
|
|
ed64c5 |
@@ -723,4 +724,23 @@
|
|
|
ed64c5 |
<xs:attribute name="product" type="xs:string"></xs:attribute>
|
|
|
ed64c5 |
</xs:complexType>
|
|
|
ed64c5 |
|
|
|
ed64c5 |
+<xs:element name="filesystems" type="filesystems-type"></xs:element>
|
|
|
ed64c5 |
+<xs:complexType name="filesystems-type">
|
|
|
ed64c5 |
+ <xs:sequence>
|
|
|
ed64c5 |
+ <xs:element name="filesystem" type="filesystem-type"></xs:element>
|
|
|
ed64c5 |
+ </xs:sequence>
|
|
|
ed64c5 |
+</xs:complexType>
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+<xs:element name="filesystem" type="filesystem-type"></xs:element>
|
|
|
ed64c5 |
+<xs:complexType name="filesystem-type">
|
|
|
ed64c5 |
+ <xs:attribute name="fsname" type="xs:string"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="MBfsfree" type="xs:nonNegativeInteger"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="MBfsused" type="xs:nonNegativeInteger"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="fsused-percent" type="hundredth-type"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="ufsused-percent" type="hundredth-type"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="Ifree" type="xs:nonNegativeInteger"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="Iused" type="xs:nonNegativeInteger"></xs:attribute>
|
|
|
ed64c5 |
+ <xs:attribute name="Iused-percent" type="hundredth-type"></xs:attribute>
|
|
|
ed64c5 |
+</xs:complexType>
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
</xs:schema>
|
|
|
ed64c5 |
diff --git a/xml_stats.c b/xml_stats.c
|
|
|
ed64c5 |
index 0a15f98..f41d520 100644
|
|
|
ed64c5 |
--- a/xml_stats.c
|
|
|
ed64c5 |
+++ b/xml_stats.c
|
|
|
ed64c5 |
@@ -2005,5 +2005,41 @@ close_xml_markup:
|
|
|
ed64c5 |
__print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
|
|
|
ed64c5 |
unsigned long long itv)
|
|
|
ed64c5 |
{
|
|
|
ed64c5 |
- /* FIXME */
|
|
|
ed64c5 |
+ int i;
|
|
|
ed64c5 |
+ struct stats_filesystem *sfc;
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ xprintf(tab, "<filesystems>");
|
|
|
ed64c5 |
+ tab++;
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ for (i = 0; i < a->nr; i++) {
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ if (!sfc->f_blocks)
|
|
|
ed64c5 |
+ /* Size of filesystem is null: We are at the end of the list */
|
|
|
ed64c5 |
+ break;
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ xprintf(tab, "
|
|
|
ed64c5 |
+ "MBfsfree=\"%.0f\" "
|
|
|
ed64c5 |
+ "MBfsused=\"%.0f\" "
|
|
|
ed64c5 |
+ "fsused-percent=\"%.2f\" "
|
|
|
ed64c5 |
+ "ufsused-percent=\"%.2f\" "
|
|
|
ed64c5 |
+ "Ifree=\"%llu\" "
|
|
|
ed64c5 |
+ "Iused=\"%llu\" "
|
|
|
ed64c5 |
+ "Iused-percent=\"%.2f\"/>",
|
|
|
ed64c5 |
+ sfc->fs_name,
|
|
|
ed64c5 |
+ (double) sfc->f_bfree / 1024 / 1024,
|
|
|
ed64c5 |
+ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024,
|
|
|
ed64c5 |
+ /* f_blocks is not null. But test it anyway ;-) */
|
|
|
ed64c5 |
+ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
|
|
|
ed64c5 |
+ : 0.0,
|
|
|
ed64c5 |
+ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
|
|
|
ed64c5 |
+ : 0.0,
|
|
|
ed64c5 |
+ sfc->f_ffree,
|
|
|
ed64c5 |
+ sfc->f_files - sfc->f_ffree,
|
|
|
ed64c5 |
+ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files)
|
|
|
ed64c5 |
+ : 0.0);
|
|
|
ed64c5 |
+ }
|
|
|
ed64c5 |
+
|
|
|
ed64c5 |
+ xprintf(--tab, "</filesystems>");
|
|
|
ed64c5 |
}
|
|
|
ed64c5 |
--
|
|
|
ed64c5 |
2.14.3
|
|
|
ed64c5 |
|