Rename "systeminfo" class -> "systemmanager"

Updated the docs as part of this commit
This commit is contained in:
Kris Moore
2016-02-03 12:27:06 -05:00
parent 37224472cc
commit 6fd9a689b4
6 changed files with 55 additions and 55 deletions

View File

@@ -1,9 +1,9 @@
.. _systeminfo:
.. _systemmanager:
systeminfo
systemmanager
**********
The systeminfo class is used to retrieve information about the system. Every systeminfo class request contains the following parameters:
The systemmanager class is used to manage various aspects of the FreeBSD system. Every systemmanager class request contains the following parameters:
+---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+
| **Parameter** | **Value** | **Description** |
@@ -12,19 +12,19 @@ The systeminfo class is used to retrieve information about the system. Every sys
| id | | any unique value for the request; examples include a hash, checksum, or uuid |
| | | |
+---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+
| name | systeminfo | |
| name | systemmanager | |
| | | |
+---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+
| namespace | sysadm | |
| | | |
+---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+
| action | | supported actions include "memorystats", "cpupercentage", "cputemps", "batteryinfo", "externalmounts", "systeminfo" |
| action | | supported actions include "memorystats", "cpupercentage", "cputemps", "batteryinfo", "externalmounts", "systemmanager" |
| | | |
+---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+
The rest of this section provides examples of the available *actions* for each type of request, along with their responses.
.. index:: memorystats, systeminfo
.. index:: memorystats, systemmanager
.. _Memory Statistics:
@@ -37,7 +37,7 @@ The "memorystats" action returns memory statistics, including the amount of acti
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "memorystats"
}
@@ -68,7 +68,7 @@ The "memorystats" action returns memory statistics, including the amount of acti
"action" : "memorystats"
},
"namespace" : "sysadm",
"name" : "systeminfo"
"name" : "systemmanager"
}
**WebSocket Response**
@@ -90,7 +90,7 @@ The "memorystats" action returns memory statistics, including the amount of acti
"namespace": "sysadm"
}
.. index:: cpupercentage, systeminfo
.. index:: cpupercentage, systemmanager
.. _CPU Usage:
@@ -103,7 +103,7 @@ The "cpupercentage" action returns the usage percentage of each CPU.
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "cpupercentage"
}
@@ -140,7 +140,7 @@ The "cpupercentage" action returns the usage percentage of each CPU.
"args" : {
"action" : "cpupercentage"
},
"name" : "systeminfo",
"name" : "systemmanager",
"id" : "fooid",
"namespace" : "sysadm"
}
@@ -172,7 +172,7 @@ The "cpupercentage" action returns the usage percentage of each CPU.
"namespace": "sysadm"
}
.. index:: cputemps, systeminfo
.. index:: cputemps, systemmanager
.. _CPU Temperature:
@@ -185,7 +185,7 @@ The "cputemps" action returns the temperature of each CPU.
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "cputemps"
}
@@ -214,7 +214,7 @@ The "cputemps" action returns the temperature of each CPU.
"action" : "cputemps"
},
"id" : "fooid",
"name" : "systeminfo",
"name" : "systemmanager",
"namespace" : "sysadm"
}
@@ -236,7 +236,7 @@ The "cputemps" action returns the temperature of each CPU.
"namespace": "sysadm"
}
.. index:: batteryinfo, systeminfo
.. index:: batteryinfo, systemmanager
.. _Battery Information:
@@ -250,7 +250,7 @@ status (offline, charging, on backup, or unknown), and estimated time left (in s
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "batteryinfo"
}
@@ -273,7 +273,7 @@ status (offline, charging, on backup, or unknown), and estimated time left (in s
{
"namespace" : "sysadm",
"name" : "systeminfo",
"name" : "systemmanager",
"id" : "fooid",
"args" : {
"action" : "batteryinfo"
@@ -295,7 +295,7 @@ status (offline, charging, on backup, or unknown), and estimated time left (in s
"namespace": "sysadm"
}
.. index:: externalmounts, systeminfo
.. index:: externalmounts, systemmanager
.. _List External Mounts:
@@ -309,7 +309,7 @@ For each mounted device, the response will include the device name, filesystem,
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "externalmounts"
}
@@ -337,7 +337,7 @@ For each mounted device, the response will include the device name, filesystem,
{
"id" : "fooid",
"namespace" : "sysadm",
"name" : "systeminfo",
"name" : "systemmanager",
"args" : {
"action" : "externalmounts"
}
@@ -362,23 +362,23 @@ For each mounted device, the response will include the device name, filesystem,
"namespace": "sysadm"
}
.. index:: systeminfo
.. index:: systemmanager
.. _System Information:
System Information
==================
The "systeminfo" action lists system information, including the architecture, number of CPUs, type of CPU, hostname, kernel name and version, system version and patch level, total amount
The "systemmanager" action lists system information, including the architecture, number of CPUs, type of CPU, hostname, kernel name and version, system version and patch level, total amount
of RAM, and the system's uptime.
**REST Request**
.. code-block:: json
PUT /sysadm/systeminfo
PUT /sysadm/systemmanager
{
"action" : "systeminfo"
"action" : "systemmanager"
}
**REST Response**
@@ -387,7 +387,7 @@ of RAM, and the system's uptime.
{
"args": {
"systeminfo": {
"systemmanager": {
"arch": "amd64",
"cpucores": "4",
"cputype": "Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz",
@@ -407,10 +407,10 @@ of RAM, and the system's uptime.
{
"args" : {
"action" : "systeminfo"
"action" : "systemmanager"
},
"id" : "fooid",
"name" : "systeminfo",
"name" : "systemmanager",
"namespace" : "sysadm"
}
@@ -420,7 +420,7 @@ of RAM, and the system's uptime.
{
"args": {
"systeminfo": {
"systemmanager": {
"arch": "amd64",
"cpucores": "4",
"cputype": "Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz",
@@ -435,4 +435,4 @@ of RAM, and the system's uptime.
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
}

View File

@@ -14,7 +14,7 @@
#include "library/sysadm-iohyve.h"
#include "library/sysadm-lifepreserver.h"
#include "library/sysadm-network.h"
#include "library/sysadm-systeminfo.h"
#include "library/sysadm-systemmanager.h"
#include "library/sysadm-update.h"
#include "syscache-client.h"
@@ -59,7 +59,7 @@ RestOutputStruct::ExitCode WebSocket::AvailableSubsystems(bool allaccess, QJsonO
}
// - Generic system information
out->insert("sysadm/systeminfo","read/write");
out->insert("sysadm/systemmanager","read/write");
// - PC-BSD Updater
if(QFile::exists("/usr/local/bin/pc-updatemanager")){
@@ -101,7 +101,7 @@ RestOutputStruct::ExitCode WebSocket::EvaluateBackendRequest(const RestInputStru
}else if(namesp=="rpc" && name=="syscache"){
return EvaluateSyscacheRequest(IN.args, out);
}else if(namesp=="sysadm" && name=="systeminfo"){
return EvaluateSysadmSystemInfoRequest(IN.args, out);
return EvaluateSysadmSystemMgmtRequest(IN.args, out);
}else if(namesp=="sysadm" && name=="update"){
return EvaluateSysadmUpdateRequest(IN.args, out);
}else{
@@ -294,8 +294,8 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmLifePreserverRequest(const Q
return RestOutputStruct::OK;
}
//==== SYSADM -- SysInfo ====
RestOutputStruct::ExitCode WebSocket::EvaluateSysadmSystemInfoRequest(const QJsonValue in_args, QJsonObject *out){
//==== SYSADM -- SysMgmt ====
RestOutputStruct::ExitCode WebSocket::EvaluateSysadmSystemMgmtRequest(const QJsonValue in_args, QJsonObject *out){
if(in_args.isObject()){
QStringList keys = in_args.toObject().keys();
bool ok = false;
@@ -303,31 +303,31 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmSystemInfoRequest(const QJso
QString act = JsonValueToString(in_args.toObject().value("action"));
if(act=="batteryinfo"){
ok = true;
out->insert("batteryinfo", sysadm::SysInfo::batteryInfo());
out->insert("batteryinfo", sysadm::SysMgmt::batteryInfo());
}
if(act=="cpupercentage"){
ok = true;
out->insert("cpupercentage", sysadm::SysInfo::cpuPercentage());
out->insert("cpupercentage", sysadm::SysMgmt::cpuPercentage());
}
if(act=="cputemps"){
ok = true;
out->insert("cputemps", sysadm::SysInfo::cpuTemps());
out->insert("cputemps", sysadm::SysMgmt::cpuTemps());
}
if(act=="externalmounts"){
ok = true;
out->insert("externalmounts", sysadm::SysInfo::externalDevicePaths());
out->insert("externalmounts", sysadm::SysMgmt::externalDevicePaths());
}
if(act=="memorystats"){
ok = true;
out->insert("memorystats", sysadm::SysInfo::memoryStats());
out->insert("memorystats", sysadm::SysMgmt::memoryStats());
}
if(act=="procinfo"){
ok = true;
out->insert("procinfo", sysadm::SysInfo::procInfo());
out->insert("procinfo", sysadm::SysMgmt::procInfo());
}
if(act=="systeminfo"){
ok = true;
out->insert("systeminfo", sysadm::SysInfo::systemInfo());
out->insert("systeminfo", sysadm::SysMgmt::systemInfo());
}
} //end of "action" key usage

View File

@@ -55,7 +55,7 @@ private:
// -- sysadm LifePreserver API
RestOutputStruct::ExitCode EvaluateSysadmLifePreserverRequest(const QJsonValue in_args, QJsonObject *out);
// -- sysadm info API
RestOutputStruct::ExitCode EvaluateSysadmSystemInfoRequest(const QJsonValue in_args, QJsonObject *out);
RestOutputStruct::ExitCode EvaluateSysadmSystemMgmtRequest(const QJsonValue in_args, QJsonObject *out);
// -- sysadm Update API
RestOutputStruct::ExitCode EvaluateSysadmUpdateRequest(const QJsonValue in_args, QJsonObject *out);

View File

@@ -9,7 +9,7 @@ HEADERS += $${PWD}/sysadm-global.h \
$${PWD}/sysadm-network.h \
$${PWD}/sysadm-firewall.h \
$${PWD}/sysadm-servicemanager.h\
$${PWD}/sysadm-systeminfo.h\
$${PWD}/sysadm-systemmanager.h\
$${PWD}/sysadm-update.h \
$${PWD}/sysadm-usermanager.h
@@ -21,7 +21,7 @@ SOURCES += $${PWD}/NetDevice.cpp \
$${PWD}/sysadm-network.cpp \
$${PWD}/sysadm-firewall.cpp \
$${PWD}/sysadm-servicemanager.cpp \
$${PWD}/sysadm-systeminfo.cpp \
$${PWD}/sysadm-systemmanager.cpp \
$${PWD}/sysadm-update.cpp \
$${PWD}/sysadm-usermanager.cpp

View File

@@ -5,7 +5,7 @@
// See the LICENSE file for full details
//===========================================
#include "sysadm-general.h"
#include "sysadm-systeminfo.h"
#include "sysadm-systemmanager.h"
#include "sysadm-global.h"
using namespace sysadm;
@@ -14,7 +14,7 @@ using namespace sysadm;
//Battery Availability
QJsonObject SysInfo::batteryInfo(){
QJsonObject SysMgmt::batteryInfo(){
QJsonObject retObject;
bool ok;
@@ -57,7 +57,7 @@ QJsonObject SysInfo::batteryInfo(){
// KPM 1-21-2016
// This needs to be looked at, I'm not 100% sure it is returning correct busy %
// We probably want to supply more info as well, such as user,nice,system,interrupt,idle
QJsonObject SysInfo::cpuPercentage() {
QJsonObject SysMgmt::cpuPercentage() {
QJsonObject retObject;
QString tmp;
@@ -102,7 +102,7 @@ QJsonObject SysInfo::cpuPercentage() {
return retObject;
}
QJsonObject SysInfo::cpuTemps() {
QJsonObject SysMgmt::cpuTemps() {
// Make sure coretemp is loaded
if ( General::RunCommand("kldstat").indexOf("coretemp") == -1 )
General::RunCommand("kldload coretemp");
@@ -123,7 +123,7 @@ QJsonObject SysInfo::cpuTemps() {
}
// ==== ExternalDevicePaths() ====
QJsonObject SysInfo::externalDevicePaths() {
QJsonObject SysMgmt::externalDevicePaths() {
QJsonObject retObject;
//Returns: QStringList[<type>::::<filesystem>::::<path>]
@@ -162,7 +162,7 @@ QJsonObject SysInfo::externalDevicePaths() {
}
// Return information about memory
QJsonObject SysInfo::memoryStats() {
QJsonObject SysMgmt::memoryStats() {
QJsonObject retObject;
QString tmp;
@@ -211,7 +211,7 @@ QJsonObject SysInfo::memoryStats() {
}
// Return a json list of process information
QJsonObject SysInfo::procInfo() {
QJsonObject SysMgmt::procInfo() {
QJsonObject retObject;
QStringList output;
output = General::RunCommand("top -t -n all").split("\n");
@@ -249,7 +249,7 @@ QJsonObject SysInfo::procInfo() {
}
// Return a bunch of various system information
QJsonObject SysInfo::systemInfo() {
QJsonObject SysMgmt::systemInfo() {
QJsonObject retObject;
QString arch = General::RunCommand("uname -m").simplified();

View File

@@ -4,15 +4,15 @@
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#ifndef __PCBSD_LIB_UTILS_SYSINFO_H
#define __PCBSD_LIB_UTILS_SYSINFO_H
#ifndef __PCBSD_LIB_UTILS_SYSMGMT_H
#define __PCBSD_LIB_UTILS_SYSMGMT_H
#include <QJsonObject>
#include "sysadm-global.h"
namespace sysadm{
class SysInfo{
class SysMgmt{
public:
static QJsonObject batteryInfo();
static QJsonObject cpuPercentage();