Search in sources :

Example 11 with TabletServerStatus

use of org.apache.accumulo.core.master.thrift.TabletServerStatus in project accumulo by apache.

the class XMLResource method getInformation.

/**
 * Generates summary of the Monitor
 *
 * @return SummaryInformation object
 */
public SummaryInformation getInformation() {
    MasterMonitorInfo mmi = Monitor.getMmi();
    if (null == mmi) {
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
    // Add Monitor information
    SummaryInformation xml = new SummaryInformation(mmi.tServerInfo.size(), MasterResource.getTables(), TablesResource.getTables());
    // Add tserver information
    for (TabletServerStatus status : mmi.tServerInfo) {
        xml.addTabletServer(new TabletServer(status));
    }
    return xml;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) WebApplicationException(javax.ws.rs.WebApplicationException) TabletServer(org.apache.accumulo.monitor.rest.tservers.TabletServer) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus)

Example 12 with TabletServerStatus

use of org.apache.accumulo.core.master.thrift.TabletServerStatus in project accumulo by apache.

the class TabletServerResource method getTserverRecovery.

/**
 * Generates a recovery tserver list
 *
 * @return Recovery tserver list
 */
@Path("recovery")
@GET
public TabletServersRecovery getTserverRecovery() {
    TabletServersRecovery recoveryList = new TabletServersRecovery();
    MasterMonitorInfo mmi = Monitor.getMmi();
    if (null == mmi) {
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
    for (TabletServerStatus server : mmi.tServerInfo) {
        if (server.logSorts != null) {
            for (RecoveryStatus recovery : server.logSorts) {
                String serv = AddressUtil.parseAddress(server.name, false).getHost();
                String log = recovery.name;
                int time = recovery.runtime;
                double progress = recovery.progress;
                recoveryList.addRecovery(new TabletServerRecoveryInformation(serv, log, time, progress));
            }
        }
    }
    return recoveryList;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) WebApplicationException(javax.ws.rs.WebApplicationException) RecoveryStatus(org.apache.accumulo.core.master.thrift.RecoveryStatus) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 13 with TabletServerStatus

use of org.apache.accumulo.core.master.thrift.TabletServerStatus in project accumulo by apache.

the class MasterResource method getTables.

/**
 * Generates a master information JSON object
 *
 * @return master JSON object
 */
@GET
public static MasterInformation getTables() {
    MasterInformation masterInformation;
    MasterMonitorInfo 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> masters = Monitor.getContext().getInstance().getMasterLocations();
        String master = masters.size() == 0 ? "Down" : AddressUtil.parseAddress(masters.get(0), false).getHost();
        Integer onlineTabletServers = mmi.tServerInfo.size();
        Integer totalTabletServers = tservers.size();
        Integer tablets = Monitor.getTotalTabletCount();
        Integer 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();
        masterInformation = new MasterInformation(master, onlineTabletServers, totalTabletServers, gcStatus, tablets, unassignedTablets, entries, ingest, entriesRead, entriesReturned, holdTime, osLoad, tables, deadTabletServers, lookups, uptime, label, getGoalState(), getState(), getNumBadTservers(), getServersShuttingDown(), getDeadTservers(), getDeadLoggers());
    } else {
        masterInformation = new MasterInformation();
    }
    return masterInformation;
}
Also used : MasterMonitorInfo(org.apache.accumulo.core.master.thrift.MasterMonitorInfo) ArrayList(java.util.ArrayList) GCStatus(org.apache.accumulo.core.gc.thrift.GCStatus) DeadServer(org.apache.accumulo.core.master.thrift.DeadServer) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) GET(javax.ws.rs.GET)

Example 14 with TabletServerStatus

use of org.apache.accumulo.core.master.thrift.TabletServerStatus in project accumulo by apache.

the class ScansResource method getTables.

/**
 * Generates a new JSON object with scan information
 *
 * @return Scan JSON object
 */
@GET
public Scans getTables() {
    Scans scans = new Scans();
    Map<HostAndPort, ScanStats> entry = Monitor.getScans();
    // Adds new scans to the array
    for (TabletServerStatus tserverInfo : Monitor.getMmi().getTServerInfo()) {
        ScanStats stats = entry.get(HostAndPort.fromString(tserverInfo.name));
        if (stats != null) {
            scans.addScan(new ScanInformation(tserverInfo, stats.scanCount, stats.oldestScan));
        }
    }
    return scans;
}
Also used : HostAndPort(org.apache.accumulo.core.util.HostAndPort) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) ScanStats(org.apache.accumulo.monitor.Monitor.ScanStats) GET(javax.ws.rs.GET)

Example 15 with TabletServerStatus

use of org.apache.accumulo.core.master.thrift.TabletServerStatus in project accumulo by apache.

the class StatusResource method getTables.

/**
 * Generates the JSON object with the status
 *
 * @return Status report
 */
@GET
public StatusInformation getTables() {
    StatusInformation status;
    Status masterStatus;
    Status gcStatus;
    Status tServerStatus = Status.ERROR;
    if (Monitor.getMmi() != null) {
        if (Monitor.getGcStatus() != null) {
            gcStatus = Status.OK;
        } else {
            gcStatus = Status.ERROR;
        }
        List<String> tservers = new ArrayList<>();
        for (TabletServerStatus up : Monitor.getMmi().tServerInfo) {
            tservers.add(up.name);
        }
        for (DeadServer down : Monitor.getMmi().deadTabletServers) {
            tservers.add(down.server);
        }
        List<String> masters = Monitor.getContext().getInstance().getMasterLocations();
        masterStatus = masters.size() == 0 ? Status.ERROR : Status.OK;
        int tServerUp = Monitor.getMmi().getTServerInfoSize();
        int tServerDown = Monitor.getMmi().getDeadTabletServersSize();
        int tServerBad = Monitor.getMmi().getBadTServersSize();
        /*
       * If there are no dead or bad servers and there are tservers up, status is OK, if there are dead or bad servers and there is at least a tserver up,
       * status is WARN, otherwise, the status is an error.
       */
        if ((tServerDown > 0 || tServerBad > 0) && tServerUp > 0) {
            tServerStatus = Status.WARN;
        } else if ((tServerDown == 0 || tServerBad == 0) && tServerUp > 0) {
            tServerStatus = Status.OK;
        } else if (tServerUp == 0) {
            tServerStatus = Status.ERROR;
        }
    } else {
        masterStatus = Status.ERROR;
        if (null == Monitor.getGcStatus()) {
            gcStatus = Status.ERROR;
        } else {
            gcStatus = Status.OK;
        }
        tServerStatus = Status.ERROR;
    }
    List<DedupedLogEvent> logs = LogService.getInstance().getEvents();
    boolean logsHaveError = false;
    for (DedupedLogEvent dedupedLogEvent : logs) {
        if (dedupedLogEvent.getEvent().getLevel().isGreaterOrEqual(Level.ERROR)) {
            logsHaveError = true;
            break;
        }
    }
    int numProblems = Monitor.getProblemSummary().entrySet().size();
    status = new StatusInformation(masterStatus.toString(), gcStatus.toString(), tServerStatus.toString(), logs.size(), logsHaveError, numProblems);
    return status;
}
Also used : TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) ArrayList(java.util.ArrayList) DeadServer(org.apache.accumulo.core.master.thrift.DeadServer) DedupedLogEvent(org.apache.accumulo.server.monitor.DedupedLogEvent) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) GET(javax.ws.rs.GET)

Aggregations

TabletServerStatus (org.apache.accumulo.core.master.thrift.TabletServerStatus)36 TableInfo (org.apache.accumulo.core.master.thrift.TableInfo)16 ArrayList (java.util.ArrayList)14 TServerInstance (org.apache.accumulo.server.master.state.TServerInstance)14 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 MasterMonitorInfo (org.apache.accumulo.core.master.thrift.MasterMonitorInfo)10 KeyExtent (org.apache.accumulo.core.data.impl.KeyExtent)9 GET (javax.ws.rs.GET)8 TreeMap (java.util.TreeMap)6 SortedMap (java.util.SortedMap)5 ClientContext (org.apache.accumulo.core.client.impl.ClientContext)5 ThriftNotActiveServiceException (org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException)5 MasterClientService (org.apache.accumulo.core.master.thrift.MasterClientService)5 AccumuloServerContext (org.apache.accumulo.server.AccumuloServerContext)5 WebApplicationException (javax.ws.rs.WebApplicationException)4 Connector (org.apache.accumulo.core.client.Connector)4 Credentials (org.apache.accumulo.core.client.impl.Credentials)4 Table (org.apache.accumulo.core.client.impl.Table)4 TabletStats (org.apache.accumulo.core.tabletserver.thrift.TabletStats)4