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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations