Unverified Kaydet (Commit) 013af013 authored tarafından Ali Orhun Akkirman's avatar Ali Orhun Akkirman Kaydeden (comit) GitHub

Merge pull request #129 from aliorhun/master

added number of services and processes
......@@ -29,6 +29,9 @@ class OneController extends Controller
$outputs = [
"hostname" => $server->getHostname(),
"version" => $server->getVersion(),
"nofservices" => $server->getNoOfServices(),
"nofprocesses" => $server->getNoOfProcesses(),
"uptime" => $server->getUptime(),
];
$input_extensions = [];
......
......@@ -218,6 +218,51 @@ class Server extends Model
)[0];
}
public function getUptime()
{
if (!$this->canRunCommand()) {
return "";
}
if ($this->isLinux()) {
return $this->run("uptime -s");
}
return explode(
"|",
$this->run("wmic path Win32_OperatingSystem get LastBootUpTime")
)[0];
}
public function getNoOfServices()
{
if (!$this->canRunCommand()) {
return "";
}
if ($this->isLinux()) {
return $this->run("systemctl list-units --type=service --state=active | wc -l");
}
return explode(
"|",
$this->run("wmic service get name | find \"\" /v /c")
)[0];
}
public function getNoOfProcesses()
{
if (!$this->canRunCommand()) {
return "";
}
if ($this->isLinux()) {
return $this->run("ps -aux | wc -l");
}
return explode(
"|",
$this->run("(Get-Process).Count")
)[0];
}
public function getHostname()
{
if (!$this->canRunCommand()) {
......
......@@ -38,6 +38,17 @@
@endif
</p>
<hr>
@if(server()->canRunCommand())
<strong>{{ __('Açık Kalma') }}</strong>
<p class="text-muted">{{$outputs["uptime"]}}</p>
<hr>
<strong>{{ __('Servis Sayısı') }}</strong>
<p class="text-muted">{{$outputs["nofservices"]}}</p>
<hr>
<strong>{{ __('İşlem Sayısı') }}</strong>
<p class="text-muted">{{$outputs["nofprocesses"]}}</p>
<hr>
@endif
</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment