use of org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo in project accumulo by apache.
the class TablesResource method getTables.
public static TableInformationList getTables(Monitor monitor) {
TableInformationList tableList = new TableInformationList();
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null) {
return tableList;
}
SortedMap<TableId, TableInfo> tableStats = new TreeMap<>();
if (mmi.tableMap != null) {
for (Map.Entry<String, TableInfo> te : mmi.tableMap.entrySet()) {
tableStats.put(TableId.of(te.getKey()), te.getValue());
}
}
Map<String, Double> compactingByTable = TableInfoUtil.summarizeTableStats(mmi);
TableManager tableManager = monitor.getContext().getTableManager();
// Add tables to the list
for (Map.Entry<String, TableId> entry : monitor.getContext().getTableNameToIdMap().entrySet()) {
String tableName = entry.getKey();
TableId tableId = entry.getValue();
TableInfo tableInfo = tableStats.get(tableId);
TableState tableState = tableManager.getTableState(tableId);
if (tableInfo != null && tableState != TableState.OFFLINE) {
Double holdTime = compactingByTable.get(tableId.canonical());
if (holdTime == null) {
holdTime = 0.;
}
tableList.addTable(new TableInformation(tableName, tableId, tableInfo, holdTime, tableState.name()));
} else {
tableList.addTable(new TableInformation(tableName, tableId, tableState.name()));
}
}
return tableList;
}
use of org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo in project accumulo by apache.
the class BulkImportResource method getTables.
/**
* Generates bulk import and tserver bulk imports with the information from the Monitor
*
* @return JSON object with BulkImport information
*/
@GET
public BulkImport getTables() {
BulkImport bulkImport = new BulkImport();
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null)
return bulkImport;
// Generating Bulk Import and adding it to the return object
for (BulkImportStatus bulk : mmi.bulkImports) {
bulkImport.addBulkImport(new BulkImportInformation(bulk.filename, bulk.startTime, bulk.state));
}
// Generating TServer Bulk Import and adding it to the return object
for (TabletServerStatus tserverInfo : mmi.getTServerInfo()) {
int size = 0;
long oldest = 0L;
List<BulkImportStatus> stats = tserverInfo.bulkImports;
if (stats != null) {
size = stats.size();
oldest = Long.MAX_VALUE;
for (BulkImportStatus bulk : stats) {
oldest = Math.min(oldest, bulk.startTime);
}
if (oldest == Long.MAX_VALUE) {
oldest = 0L;
}
}
bulkImport.addTabletServerBulkImport(new TabletServerBulkImportInformation(tserverInfo, size, oldest));
}
return bulkImport;
}
use of org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo in project accumulo by apache.
the class ManagerResource method getServersShuttingDown.
/**
* Generates a JSON object of a list of servers shutting down
*
* @return servers shutting down list
*/
public static ServersShuttingDown getServersShuttingDown(Monitor monitor) {
ManagerMonitorInfo mmi = monitor.getMmi();
ServersShuttingDown servers = new ServersShuttingDown();
if (mmi == null)
return servers;
// Add new servers to the list
for (String server : mmi.serversShuttingDown) {
servers.addServerShuttingDown(new ServerShuttingDownInformation(server));
}
return servers;
}
use of org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo in project accumulo by apache.
the class ManagerResource method getDeadLoggers.
/**
* Generates a dead logger list as a JSON object
*
* @return dead logger list
*/
public static DeadLoggerList getDeadLoggers(Monitor monitor) {
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null) {
return new DeadLoggerList();
}
DeadLoggerList deadLoggers = new DeadLoggerList();
// Add new dead loggers to the list
for (DeadServer dead : mmi.deadTabletServers) {
deadLoggers.addDeadLogger(new DeadLoggerInformation(dead.server, dead.lastStatus, dead.status));
}
return deadLoggers;
}
use of org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo in project accumulo by apache.
the class ManagerResource method getTables.
public static ManagerInformation getTables(Monitor monitor) {
ManagerInformation managerInformation;
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi != null) {
GCStatus gcStatusObj = monitor.getGcStatus();
String gcStatus = "Waiting";
String label = "";
if (gcStatusObj != null) {
long start = 0;
if (gcStatusObj.current.started != 0 || gcStatusObj.currentLog.started != 0) {
start = Math.max(gcStatusObj.current.started, gcStatusObj.currentLog.started);
label = "Running";
} else if (gcStatusObj.lastLog.finished != 0) {
start = gcStatusObj.lastLog.finished;
}
if (start != 0) {
gcStatus = String.valueOf(start);
}
} else {
gcStatus = "Down";
}
List<String> tservers = new ArrayList<>();
for (TabletServerStatus up : mmi.tServerInfo) {
tservers.add(up.name);
}
for (DeadServer down : mmi.deadTabletServers) {
tservers.add(down.server);
}
List<String> managers = monitor.getContext().getManagerLocations();
String manager = managers.isEmpty() ? "Down" : AddressUtil.parseAddress(managers.get(0), false).getHost();
int onlineTabletServers = mmi.tServerInfo.size();
int totalTabletServers = tservers.size();
int tablets = monitor.getTotalTabletCount();
int unassignedTablets = mmi.unassignedTablets;
long entries = monitor.getTotalEntries();
double ingest = monitor.getTotalIngestRate();
double entriesRead = monitor.getTotalScanRate();
double entriesReturned = monitor.getTotalQueryRate();
long holdTime = monitor.getTotalHoldTime();
double osLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
int tables = monitor.getTotalTables();
int deadTabletServers = mmi.deadTabletServers.size();
long lookups = monitor.getTotalLookups();
long uptime = System.currentTimeMillis() - monitor.getStartTime();
managerInformation = new ManagerInformation(manager, onlineTabletServers, totalTabletServers, gcStatus, tablets, unassignedTablets, entries, ingest, entriesRead, entriesReturned, holdTime, osLoad, tables, deadTabletServers, lookups, uptime, label, getGoalState(monitor), getState(monitor), getNumBadTservers(monitor), getServersShuttingDown(monitor), getDeadTservers(monitor), getDeadLoggers(monitor));
} else {
managerInformation = new ManagerInformation();
}
return managerInformation;
}
Aggregations