monitor API output reserved and available space

This commit is contained in:
YuQing
2025-09-04 19:39:39 +08:00
parent 907239cb67
commit 1d75bb50d0
9 changed files with 145 additions and 182 deletions
+5
View File
@@ -1,4 +1,9 @@
Version 1.35 2025-09-04
* group and storage statistics / monitor API output reserved
and available space
* you must upgrade your FastDFS server V6.13.1 and higher version
Version 1.34 2025-08-28
* adapt to FastDFS server V6.13 for read-write separation
you must upgrade your FastDFS server V6.13 and higher version
+1 -1
View File
@@ -4,7 +4,7 @@
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.34-SNAPSHOT</version>
<version>1.35-SNAPSHOT</version>
<name>fastdfs-client-java</name>
<description>fastdfs client for java</description>
<packaging>jar</packaging>
@@ -75,8 +75,7 @@ public class ProtoCommon {
public static final int FDFS_GROUP_NAME_MAX_LEN = 16;
public static final int FDFS_IPV4_SIZE = 16;
public static final int FDFS_IPV6_SIZE = 46;
public static final int FDFS_OLD_VERSION_SIZE = 6;
public static final int FDFS_NEW_VERSION_SIZE = 8;
public static final int FDFS_VERSION_SIZE = 8;
public static final int FDFS_STORAGE_ID_MAX_SIZE = 16;
public static final String FDFS_RECORD_SEPERATOR = "\u0001";
public static final String FDFS_FIELD_SEPERATOR = "\u0002";
@@ -18,18 +18,21 @@ public class StructGroupStat extends StructBase {
protected static final int FIELD_INDEX_GROUP_NAME = 0;
protected static final int FIELD_INDEX_TOTAL_MB = 1;
protected static final int FIELD_INDEX_FREE_MB = 2;
protected static final int FIELD_INDEX_TRUNK_FREE_MB = 3;
protected static final int FIELD_INDEX_STORAGE_COUNT = 4;
protected static final int FIELD_INDEX_STORAGE_PORT = 5;
protected static final int FIELD_INDEX_READABLE_SERVER_COUNT = 6;
protected static final int FIELD_INDEX_WRITABLE_SERVER_COUNT = 7;
protected static final int FIELD_INDEX_CURRENT_WRITE_SERVER = 8;
protected static final int FIELD_INDEX_STORE_PATH_COUNT = 9;
protected static final int FIELD_INDEX_SUBDIR_COUNT_PER_PATH = 10;
protected static final int FIELD_INDEX_CURRENT_TRUNK_FILE_ID = 11;
protected static final int FIELD_INDEX_RESERVED_MB = 3;
protected static final int FIELD_INDEX_TRUNK_FREE_MB = 4;
protected static final int FIELD_INDEX_STORAGE_COUNT = 5;
protected static final int FIELD_INDEX_STORAGE_PORT = 6;
protected static final int FIELD_INDEX_READABLE_SERVER_COUNT = 7;
protected static final int FIELD_INDEX_WRITABLE_SERVER_COUNT = 8;
protected static final int FIELD_INDEX_CURRENT_WRITE_SERVER = 9;
protected static final int FIELD_INDEX_STORE_PATH_COUNT = 10;
protected static final int FIELD_INDEX_SUBDIR_COUNT_PER_PATH = 11;
protected static final int FIELD_INDEX_CURRENT_TRUNK_FILE_ID = 12;
protected static final int FIELD_COUNT = 13;
protected static int fieldsTotalSize;
protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[12];
protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[FIELD_COUNT];
static {
int offset = 0;
@@ -45,6 +48,10 @@ public class StructGroupStat extends StructBase {
"freeMB", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
fieldsArray[FIELD_INDEX_RESERVED_MB] = new StructBase.FieldInfo(
"reservedMB", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
fieldsArray[FIELD_INDEX_TRUNK_FREE_MB] = new StructBase.FieldInfo(
"trunkFreeMB", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
@@ -85,8 +92,9 @@ public class StructGroupStat extends StructBase {
}
protected String groupName; //name of this group
protected long totalMB; //total disk storage in MB
protected long totalMB; //total disk space in MB
protected long freeMB; //free disk space in MB
protected long reservedMB; //reserved disk space in MB
protected long trunkFreeMB; //trunk free space in MB
protected int storageCount; //storage server count
protected int storagePort; //storage server port
@@ -133,6 +141,15 @@ public class StructGroupStat extends StructBase {
return this.freeMB;
}
/**
* get reserved disk space in MB
*
* @return reserved disk space in MB
*/
public long getReservedMB() {
return this.reservedMB;
}
/**
* get trunk free space in MB
*
@@ -224,6 +241,7 @@ public class StructGroupStat extends StructBase {
this.groupName = stringValue(bs, offset, fieldsArray[FIELD_INDEX_GROUP_NAME]);
this.totalMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_TOTAL_MB]);
this.freeMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_FREE_MB]);
this.reservedMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_RESERVED_MB]);
this.trunkFreeMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_TRUNK_FREE_MB]);
this.storageCount = intValue(bs, offset, fieldsArray[FIELD_INDEX_STORAGE_COUNT]);
this.storagePort = intValue(bs, offset, fieldsArray[FIELD_INDEX_STORAGE_PORT]);
@@ -1,45 +0,0 @@
/**
* Copyright (C) 2025 Happy Fish / YuQing
* <p>
* FastDFS Java Client may be copied only under the terms of the GNU Lesser
* General Public License (LGPL).
* Please visit the FastDFS Home Page https://github.com/happyfish100/fastdfs for more detail.
*/
package org.csource.fastdfs;
import java.util.Date;
/**
* C struct body decoder
*
* @author Happy Fish / YuQing
* @version Version 1.33
*/
public class StructIPv4StorageStat extends StructStorageStat {
protected static int fieldsTotalSize;
protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[StructStorageStat.FIELD_COUNT];
static {
fieldsTotalSize = StructStorageStat.initFieldsArray(fieldsArray,
ProtoCommon.FDFS_IPV4_SIZE, ProtoCommon.FDFS_OLD_VERSION_SIZE);
}
/**
* get fields total size
*
* @return fields total size
*/
public static int getFieldsTotalSize() {
return fieldsTotalSize;
}
/**
*
* @param bs byte array
* @param offset start offset
*/
public void setFields(byte[] bs, int offset) {
super.setFields(fieldsArray, bs, offset);
}
}
@@ -1,45 +0,0 @@
/**
* Copyright (C) 2025 Happy Fish / YuQing
* <p>
* FastDFS Java Client may be copied only under the terms of the GNU Lesser
* General Public License (LGPL).
* Please visit the FastDFS Home Page https://github.com/happyfish100/fastdfs for more detail.
*/
package org.csource.fastdfs;
import java.util.Date;
/**
* C struct body decoder
*
* @author Happy Fish / YuQing
* @version Version 1.33
*/
public class StructIPv6StorageStat extends StructStorageStat {
protected static int fieldsTotalSize;
protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[StructStorageStat.FIELD_COUNT];
static {
fieldsTotalSize = StructStorageStat.initFieldsArray(fieldsArray,
ProtoCommon.FDFS_IPV6_SIZE, ProtoCommon.FDFS_NEW_VERSION_SIZE);
}
/**
* get fields total size
*
* @return fields total size
*/
public static int getFieldsTotalSize() {
return fieldsTotalSize;
}
/**
*
* @param bs byte array
* @param offset start offset
*/
public void setFields(byte[] bs, int offset) {
super.setFields(fieldsArray, bs, offset);
}
}
@@ -14,7 +14,7 @@ import java.util.Date;
* C struct body decoder
*
* @author Happy Fish / YuQing
* @version Version 1.34
* @version Version 1.35
*/
public class StructStorageStat extends StructBase {
protected static final int FIELD_INDEX_STATUS = 0;
@@ -27,65 +27,68 @@ public class StructStorageStat extends StructBase {
protected static final int FIELD_INDEX_UP_TIME = 7;
protected static final int FIELD_INDEX_TOTAL_MB = 8;
protected static final int FIELD_INDEX_FREE_MB = 9;
protected static final int FIELD_INDEX_UPLOAD_PRIORITY = 10;
protected static final int FIELD_INDEX_STORE_PATH_COUNT = 11;
protected static final int FIELD_INDEX_SUBDIR_COUNT_PER_PATH = 12;
protected static final int FIELD_INDEX_CURRENT_WRITE_PATH = 13;
protected static final int FIELD_INDEX_STORAGE_PORT = 14;
protected static final int FIELD_INDEX_RESERVED_MB = 10;
protected static final int FIELD_INDEX_CONNECTION_ALLOC_COUNT = 15;
protected static final int FIELD_INDEX_CONNECTION_CURRENT_COUNT = 16;
protected static final int FIELD_INDEX_CONNECTION_MAX_COUNT = 17;
protected static final int FIELD_INDEX_UPLOAD_PRIORITY = 11;
protected static final int FIELD_INDEX_STORE_PATH_COUNT = 12;
protected static final int FIELD_INDEX_SUBDIR_COUNT_PER_PATH = 13;
protected static final int FIELD_INDEX_CURRENT_WRITE_PATH = 14;
protected static final int FIELD_INDEX_STORAGE_PORT = 15;
protected static final int FIELD_INDEX_TOTAL_UPLOAD_COUNT = 18;
protected static final int FIELD_INDEX_SUCCESS_UPLOAD_COUNT = 19;
protected static final int FIELD_INDEX_TOTAL_APPEND_COUNT = 20;
protected static final int FIELD_INDEX_SUCCESS_APPEND_COUNT = 21;
protected static final int FIELD_INDEX_TOTAL_MODIFY_COUNT = 22;
protected static final int FIELD_INDEX_SUCCESS_MODIFY_COUNT = 23;
protected static final int FIELD_INDEX_TOTAL_TRUNCATE_COUNT = 24;
protected static final int FIELD_INDEX_SUCCESS_TRUNCATE_COUNT = 25;
protected static final int FIELD_INDEX_TOTAL_SET_META_COUNT = 26;
protected static final int FIELD_INDEX_SUCCESS_SET_META_COUNT = 27;
protected static final int FIELD_INDEX_TOTAL_DELETE_COUNT = 28;
protected static final int FIELD_INDEX_SUCCESS_DELETE_COUNT = 29;
protected static final int FIELD_INDEX_TOTAL_DOWNLOAD_COUNT = 30;
protected static final int FIELD_INDEX_SUCCESS_DOWNLOAD_COUNT = 31;
protected static final int FIELD_INDEX_TOTAL_GET_META_COUNT = 32;
protected static final int FIELD_INDEX_SUCCESS_GET_META_COUNT = 33;
protected static final int FIELD_INDEX_TOTAL_CREATE_LINK_COUNT = 34;
protected static final int FIELD_INDEX_SUCCESS_CREATE_LINK_COUNT = 35;
protected static final int FIELD_INDEX_TOTAL_DELETE_LINK_COUNT = 36;
protected static final int FIELD_INDEX_SUCCESS_DELETE_LINK_COUNT = 37;
protected static final int FIELD_INDEX_TOTAL_UPLOAD_BYTES = 38;
protected static final int FIELD_INDEX_SUCCESS_UPLOAD_BYTES = 39;
protected static final int FIELD_INDEX_TOTAL_APPEND_BYTES = 40;
protected static final int FIELD_INDEX_SUCCESS_APPEND_BYTES = 41;
protected static final int FIELD_INDEX_TOTAL_MODIFY_BYTES = 42;
protected static final int FIELD_INDEX_SUCCESS_MODIFY_BYTES = 43;
protected static final int FIELD_INDEX_TOTAL_DOWNLOAD_BYTES = 44;
protected static final int FIELD_INDEX_SUCCESS_DOWNLOAD_BYTES = 45;
protected static final int FIELD_INDEX_TOTAL_SYNC_IN_BYTES = 46;
protected static final int FIELD_INDEX_SUCCESS_SYNC_IN_BYTES = 47;
protected static final int FIELD_INDEX_TOTAL_SYNC_OUT_BYTES = 48;
protected static final int FIELD_INDEX_SUCCESS_SYNC_OUT_BYTES = 49;
protected static final int FIELD_INDEX_TOTAL_FILE_OPEN_COUNT = 50;
protected static final int FIELD_INDEX_SUCCESS_FILE_OPEN_COUNT = 51;
protected static final int FIELD_INDEX_TOTAL_FILE_READ_COUNT = 52;
protected static final int FIELD_INDEX_SUCCESS_FILE_READ_COUNT = 53;
protected static final int FIELD_INDEX_TOTAL_FILE_WRITE_COUNT = 54;
protected static final int FIELD_INDEX_SUCCESS_FILE_WRITE_COUNT = 55;
protected static final int FIELD_INDEX_LAST_SOURCE_UPDATE = 56;
protected static final int FIELD_INDEX_LAST_SYNC_UPDATE = 57;
protected static final int FIELD_INDEX_LAST_SYNCED_TIMESTAMP = 58;
protected static final int FIELD_INDEX_LAST_HEART_BEAT_TIME = 59;
protected static final int FIELD_INDEX_IF_TRUNK_FILE = 60;
protected static final int FIELD_INDEX_CONNECTION_ALLOC_COUNT = 16;
protected static final int FIELD_INDEX_CONNECTION_CURRENT_COUNT = 17;
protected static final int FIELD_INDEX_CONNECTION_MAX_COUNT = 18;
protected static final int FIELD_COUNT = 61;
protected static final int FIELD_INDEX_TOTAL_UPLOAD_COUNT = 19;
protected static final int FIELD_INDEX_SUCCESS_UPLOAD_COUNT = 20;
protected static final int FIELD_INDEX_TOTAL_APPEND_COUNT = 21;
protected static final int FIELD_INDEX_SUCCESS_APPEND_COUNT = 22;
protected static final int FIELD_INDEX_TOTAL_MODIFY_COUNT = 23;
protected static final int FIELD_INDEX_SUCCESS_MODIFY_COUNT = 24;
protected static final int FIELD_INDEX_TOTAL_TRUNCATE_COUNT = 25;
protected static final int FIELD_INDEX_SUCCESS_TRUNCATE_COUNT = 26;
protected static final int FIELD_INDEX_TOTAL_SET_META_COUNT = 27;
protected static final int FIELD_INDEX_SUCCESS_SET_META_COUNT = 28;
protected static final int FIELD_INDEX_TOTAL_DELETE_COUNT = 29;
protected static final int FIELD_INDEX_SUCCESS_DELETE_COUNT = 30;
protected static final int FIELD_INDEX_TOTAL_DOWNLOAD_COUNT = 31;
protected static final int FIELD_INDEX_SUCCESS_DOWNLOAD_COUNT = 32;
protected static final int FIELD_INDEX_TOTAL_GET_META_COUNT = 33;
protected static final int FIELD_INDEX_SUCCESS_GET_META_COUNT = 34;
protected static final int FIELD_INDEX_TOTAL_CREATE_LINK_COUNT = 35;
protected static final int FIELD_INDEX_SUCCESS_CREATE_LINK_COUNT = 36;
protected static final int FIELD_INDEX_TOTAL_DELETE_LINK_COUNT = 37;
protected static final int FIELD_INDEX_SUCCESS_DELETE_LINK_COUNT = 38;
protected static final int FIELD_INDEX_TOTAL_UPLOAD_BYTES = 39;
protected static final int FIELD_INDEX_SUCCESS_UPLOAD_BYTES = 40;
protected static final int FIELD_INDEX_TOTAL_APPEND_BYTES = 41;
protected static final int FIELD_INDEX_SUCCESS_APPEND_BYTES = 42;
protected static final int FIELD_INDEX_TOTAL_MODIFY_BYTES = 43;
protected static final int FIELD_INDEX_SUCCESS_MODIFY_BYTES = 44;
protected static final int FIELD_INDEX_TOTAL_DOWNLOAD_BYTES = 45;
protected static final int FIELD_INDEX_SUCCESS_DOWNLOAD_BYTES = 46;
protected static final int FIELD_INDEX_TOTAL_SYNC_IN_BYTES = 47;
protected static final int FIELD_INDEX_SUCCESS_SYNC_IN_BYTES = 48;
protected static final int FIELD_INDEX_TOTAL_SYNC_OUT_BYTES = 49;
protected static final int FIELD_INDEX_SUCCESS_SYNC_OUT_BYTES = 50;
protected static final int FIELD_INDEX_TOTAL_FILE_OPEN_COUNT = 51;
protected static final int FIELD_INDEX_SUCCESS_FILE_OPEN_COUNT = 52;
protected static final int FIELD_INDEX_TOTAL_FILE_READ_COUNT = 53;
protected static final int FIELD_INDEX_SUCCESS_FILE_READ_COUNT = 54;
protected static final int FIELD_INDEX_TOTAL_FILE_WRITE_COUNT = 55;
protected static final int FIELD_INDEX_SUCCESS_FILE_WRITE_COUNT = 56;
protected static final int FIELD_INDEX_LAST_SOURCE_UPDATE = 57;
protected static final int FIELD_INDEX_LAST_SYNC_UPDATE = 58;
protected static final int FIELD_INDEX_LAST_SYNCED_TIMESTAMP = 59;
protected static final int FIELD_INDEX_LAST_HEART_BEAT_TIME = 60;
protected static final int FIELD_INDEX_IF_TRUNK_FILE = 61;
protected static int initFieldsArray(StructBase.FieldInfo[] fieldsArray,
int ipaddr_size, int version_size)
{
protected static final int FIELD_COUNT = 62;
protected static int fieldsTotalSize;
protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[FIELD_COUNT];
static {
int offset = 0;
fieldsArray[FIELD_INDEX_STATUS] = new StructBase.FieldInfo(
@@ -101,16 +104,16 @@ public class StructStorageStat extends StructBase {
offset += ProtoCommon.FDFS_STORAGE_ID_MAX_SIZE;
fieldsArray[FIELD_INDEX_IP_ADDR] = new StructBase.FieldInfo(
"ipAddr", offset, ipaddr_size);
offset += ipaddr_size;
"ipAddr", offset, ProtoCommon.FDFS_IPV6_SIZE);
offset += ProtoCommon.FDFS_IPV6_SIZE;
fieldsArray[FIELD_INDEX_SRC_ID] = new StructBase.FieldInfo(
"srcId", offset, ProtoCommon.FDFS_STORAGE_ID_MAX_SIZE);
offset += ProtoCommon.FDFS_STORAGE_ID_MAX_SIZE;
fieldsArray[FIELD_INDEX_VERSION] = new StructBase.FieldInfo(
"version", offset, version_size);
offset += version_size;
"version", offset, ProtoCommon.FDFS_VERSION_SIZE);
offset += ProtoCommon.FDFS_VERSION_SIZE;
fieldsArray[FIELD_INDEX_JOIN_TIME] = new StructBase.FieldInfo(
"joinTime", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
@@ -128,6 +131,10 @@ public class StructStorageStat extends StructBase {
"freeMB", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
fieldsArray[FIELD_INDEX_RESERVED_MB] = new StructBase.FieldInfo(
"reservedMB", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
fieldsArray[FIELD_INDEX_UPLOAD_PRIORITY] = new StructBase.FieldInfo(
"uploadPriority", offset, ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE);
offset += ProtoCommon.FDFS_PROTO_PKG_LEN_SIZE;
@@ -332,7 +339,16 @@ public class StructStorageStat extends StructBase {
"ifTrunkServer", offset, 1);
offset += 1;
return offset;
fieldsTotalSize = offset;
}
/**
* get fields total size
*
* @return fields total size
*/
public static int getFieldsTotalSize() {
return fieldsTotalSize;
}
protected byte status;
@@ -341,8 +357,9 @@ public class StructStorageStat extends StructBase {
protected String ipAddr;
protected String srcId;
protected String version;
protected long totalMB; //total disk storage in MB
protected long freeMB; //free disk storage in MB
protected long totalMB; //total disk space in MB
protected long freeMB; //free disk space in MB
protected long reservedMB; //reserved disk space in MB
protected int uploadPriority; //upload priority
protected Date joinTime; //storage join timestamp (create timestamp)
protected Date upTime; //storage service started timestamp
@@ -469,6 +486,15 @@ public class StructStorageStat extends StructBase {
return this.freeMB;
}
/**
* get reserved disk space in MB
*
* @return reserved disk space in MB
*/
public long getReservedMB() {
return this.reservedMB;
}
/**
* get storage server upload priority
*
@@ -952,7 +978,7 @@ public class StructStorageStat extends StructBase {
* @param bs byte array
* @param offset start offset
*/
protected void setFields(StructBase.FieldInfo[] fieldsArray, byte[] bs, int offset) {
public void setFields(byte[] bs, int offset) {
this.status = byteValue(bs, offset, fieldsArray[FIELD_INDEX_STATUS]);
this.readWriteMode = byteValue(bs, offset, fieldsArray[FIELD_INDEX_RW_MODE]);
this.id = stringValue(bs, offset, fieldsArray[FIELD_INDEX_ID]);
@@ -961,6 +987,7 @@ public class StructStorageStat extends StructBase {
this.version = stringValue(bs, offset, fieldsArray[FIELD_INDEX_VERSION]);
this.totalMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_TOTAL_MB]);
this.freeMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_FREE_MB]);
this.reservedMB = longValue(bs, offset, fieldsArray[FIELD_INDEX_RESERVED_MB]);
this.uploadPriority = intValue(bs, offset, fieldsArray[FIELD_INDEX_UPLOAD_PRIORITY]);
this.joinTime = dateValue(bs, offset, fieldsArray[FIELD_INDEX_JOIN_TIME]);
this.upTime = dateValue(bs, offset, fieldsArray[FIELD_INDEX_UP_TIME]);
@@ -1017,7 +1044,4 @@ public class StructStorageStat extends StructBase {
this.lastHeartBeatTime = dateValue(bs, offset, fieldsArray[FIELD_INDEX_LAST_HEART_BEAT_TIME]);
this.ifTrunkServer = booleanValue(bs, offset, fieldsArray[FIELD_INDEX_IF_TRUNK_FILE]);
}
public void setFields(byte[] bs, int offset) {
}
}
@@ -673,15 +673,9 @@ public class TrackerClient {
return null;
}
if (pkgInfo.body.length % StructIPv6StorageStat.getFieldsTotalSize() == 0) {
ProtoStructDecoder<StructIPv6StorageStat> decoder = new ProtoStructDecoder<StructIPv6StorageStat>();
return decoder.decode(pkgInfo.body, StructIPv6StorageStat.class,
StructIPv6StorageStat.getFieldsTotalSize());
} else {
ProtoStructDecoder<StructIPv4StorageStat> decoder = new ProtoStructDecoder<StructIPv4StorageStat>();
return decoder.decode(pkgInfo.body, StructIPv4StorageStat.class,
StructIPv4StorageStat.getFieldsTotalSize());
}
ProtoStructDecoder<StructStorageStat> decoder = new ProtoStructDecoder<StructStorageStat>();
return decoder.decode(pkgInfo.body, StructStorageStat.class,
StructStorageStat.getFieldsTotalSize());
} catch (IOException ex) {
try {
connection.close();
+15 -2
View File
@@ -80,11 +80,18 @@ public class Monitor {
count = 0;
for (StructGroupStat groupStat : groupStats) {
long available_mb;
available_mb = groupStat.getFreeMB() - groupStat.getReservedMB();
if (available_mb < 0) {
available_mb = 0;
}
count++;
System.out.println("Group " + count + ":");
System.out.println("group name = " + groupStat.getGroupName());
System.out.println("disk total space = " + groupStat.getTotalMB() + "MB");
System.out.println("disk free space = " + groupStat.getFreeMB() + " MB");
System.out.println("disk reserved space = " + groupStat.getReservedMB() + " MB");
System.out.println("disk availale space = " + available_mb + " MB");
System.out.println("trunk free space = " + groupStat.getTrunkFreeMB() + " MB");
System.out.println("storage server count = " + groupStat.getStorageCount());
System.out.println("readable server count = " + groupStat.getReadableServerCount());
@@ -106,6 +113,10 @@ public class Monitor {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int stroageCount = 0;
for (StructStorageStat storageStat : storageStats) {
available_mb = storageStat.getFreeMB() - storageStat.getReservedMB();
if (available_mb < 0) {
available_mb = 0;
}
stroageCount++;
System.out.println("\tStorage " + stroageCount + ":");
System.out.println("\t\tstorage id = " + storageStat.getId());
@@ -115,8 +126,10 @@ public class Monitor {
System.out.println("\t\tversion = " + storageStat.getVersion());
System.out.println("\t\tjoin time = " + df.format(storageStat.getJoinTime()));
System.out.println("\t\tup time = " + (storageStat.getUpTime().getTime() == 0 ? "" : df.format(storageStat.getUpTime())));
System.out.println("\t\ttotal storage = " + storageStat.getTotalMB() + "MB");
System.out.println("\t\tfree storage = " + storageStat.getFreeMB() + "MB");
System.out.println("\t\tdisk total space = " + storageStat.getTotalMB() + "MB");
System.out.println("\t\tdisk free space = " + storageStat.getFreeMB() + "MB");
System.out.println("\t\tdisk reserved space = " + storageStat.getReservedMB() + " MB");
System.out.println("\t\tdisk availale space = " + available_mb + " MB");
System.out.println("\t\tupload priority = " + storageStat.getUploadPriority());
System.out.println("\t\tstore_path_count = " + storageStat.getStorePathCount());
System.out.println("\t\tsubdir_count_per_path = " + storageStat.getSubdirCountPerPath());