Kaydet (Commit) a4271df4 authored tarafından mertcelen's avatar mertcelen

Merge branch 'master' into 1.5-dev

......@@ -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()) {
......
This diff is collapsed.
......@@ -13,12 +13,15 @@ class CreateSystemSettingsTable extends Migration
*/
public function up()
{
Schema::create('system_settings', function (Blueprint $table) {
$table->uuid('id');
$table->string('key');
$table->string('data',10485760);
$table->timestamps();
});
if (!Schema::hasTable('system_settings')) {
Schema::create('system_settings', function (Blueprint $table) {
$table->uuid('id');
$table->string('key');
$table->string('data',10485760);
$table->timestamps();
});
}
}
/**
......
......@@ -13,12 +13,15 @@ class CreateLimansTable extends Migration
*/
public function up()
{
Schema::create('limans', function (Blueprint $table) {
$table->uuid('id');
$table->string('machine_id');
$table->string('last_ip');
$table->timestamps();
});
if (!Schema::hasTable('limans')) {
Schema::create('limans', function (Blueprint $table) {
$table->uuid('id');
$table->string('machine_id');
$table->string('last_ip');
$table->timestamps();
});
}
}
/**
......
......@@ -13,14 +13,17 @@ class CreateReplicationsTable extends Migration
*/
public function up()
{
Schema::create('replications', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('liman_id');
$table->string('key');
$table->integer('status')->default(0);
$table->string('output',9999);
$table->timestamps();
});
if (!Schema::hasTable('replications')) {
Schema::create('replications', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('liman_id');
$table->string('key');
$table->integer('status')->default(0);
$table->string('output',9999);
$table->timestamps();
});
}
}
/**
......
......@@ -13,14 +13,17 @@ class CreateMonitorServersTable extends Migration
*/
public function up()
{
Schema::create('monitor_servers', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('ip_address');
$table->integer('port');
$table->boolean('online');
$table->timestamp('last_checked');
$table->timestamps();
});
if (!Schema::hasTable('monitor_servers')) {
Schema::create('monitor_servers', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('ip_address');
$table->integer('port');
$table->boolean('online');
$table->timestamp('last_checked');
$table->timestamps();
});
}
}
/**
......
......@@ -13,13 +13,16 @@ class CreateUserMonitorsTable extends Migration
*/
public function up()
{
Schema::create('user_monitors', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('name');
$table->uuid('server_monitor_id');
$table->string("user_id");
$table->timestamps();
});
if (!Schema::hasTable('user_monitors')) {
Schema::create('user_monitors', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('name');
$table->uuid('server_monitor_id');
$table->string("user_id");
$table->timestamps();
});
}
}
/**
......
{
"private": true,
"scripts": {
"pre-commit": "lint-staged",
"check": "prettier --check ./{config,database,app,routes,resources/views,resources/assets/js/tus.js,resources/assets/css/liman.css}",
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
......@@ -12,9 +11,6 @@
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"docs": "node_modules/apidoc/bin/apidoc -o storage/docs -e vendor -e node_modules -e resources/ -e public/"
},
"pre-commit": [
"pre-commit"
],
"lint-staged": {
"{*liman.js,*tus.js,*liman.css,*.php}": [
"prettier --write",
......
......@@ -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
1.5.5
\ No newline at end of file
1.5.5
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