Search in sources :

Example 16 with ManagerMonitorInfo

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;
}
Also used : TableId(org.apache.accumulo.core.data.TableId) TreeMap(java.util.TreeMap) ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) TableManager(org.apache.accumulo.server.tables.TableManager) TableInfo(org.apache.accumulo.core.master.thrift.TableInfo) Map(java.util.Map) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap) TableState(org.apache.accumulo.core.manager.state.tables.TableState)

Example 17 with ManagerMonitorInfo

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;
}
Also used : BulkImportStatus(org.apache.accumulo.core.master.thrift.BulkImportStatus) ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) GET(jakarta.ws.rs.GET)

Example 18 with ManagerMonitorInfo

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;
}
Also used : ServerShuttingDownInformation(org.apache.accumulo.monitor.rest.tservers.ServerShuttingDownInformation) ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) ServersShuttingDown(org.apache.accumulo.monitor.rest.tservers.ServersShuttingDown)

Example 19 with ManagerMonitorInfo

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;
}
Also used : ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) DeadLoggerList(org.apache.accumulo.monitor.rest.logs.DeadLoggerList) DeadLoggerInformation(org.apache.accumulo.monitor.rest.logs.DeadLoggerInformation) DeadServer(org.apache.accumulo.core.manager.thrift.DeadServer)

Example 20 with ManagerMonitorInfo

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;
}
Also used : ManagerMonitorInfo(org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo) ArrayList(java.util.ArrayList) GCStatus(org.apache.accumulo.core.gc.thrift.GCStatus) DeadServer(org.apache.accumulo.core.manager.thrift.DeadServer) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus)

Aggregations

ManagerMonitorInfo (org.apache.accumulo.core.manager.thrift.ManagerMonitorInfo)26 TabletServerStatus (org.apache.accumulo.core.master.thrift.TabletServerStatus)14 GET (jakarta.ws.rs.GET)8 ArrayList (java.util.ArrayList)8 TableInfo (org.apache.accumulo.core.master.thrift.TableInfo)8 Test (org.junit.Test)7 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)6 ClientContext (org.apache.accumulo.core.clientImpl.ClientContext)6 ThriftNotActiveServiceException (org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException)6 ManagerClientService (org.apache.accumulo.core.manager.thrift.ManagerClientService)5 Text (org.apache.hadoop.io.Text)5 TreeSet (java.util.TreeSet)4 DeadServer (org.apache.accumulo.core.manager.thrift.DeadServer)4 Path (jakarta.ws.rs.Path)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 TableId (org.apache.accumulo.core.data.TableId)3 HostAndPort (org.apache.accumulo.core.util.HostAndPort)3 SortedMap (java.util.SortedMap)2 TreeMap (java.util.TreeMap)2