diff --git a/clearlock.sh b/clearlock.sh new file mode 100755 index 0000000..8335b71 --- /dev/null +++ b/clearlock.sh @@ -0,0 +1,8 @@ +#!/bin/bash +source /usr/share/cockpit/yottadb/envfile +source $yotta_inst/ydb_env_set +/usr/local/yottadb/lke << EOF > /dev/null +clear pid=$1 +Y +exit +EOF diff --git a/envfile b/envfile new file mode 100644 index 0000000..8bc1808 --- /dev/null +++ b/envfile @@ -0,0 +1 @@ +export yotta_inst="/usr/local/yottadb" diff --git a/freecnt.sh b/freecnt.sh new file mode 100755 index 0000000..d579669 --- /dev/null +++ b/freecnt.sh @@ -0,0 +1,4 @@ +#!/bin/bash +source /usr/share/cockpit/yottadb/envfile +source $yotta_inst/ydb_env_set +ydb <<< 'D ^%FREECNT' | awk '/^---/ { mrk=1;next } mrk==1 { sub(")","",$5);print $1":"$2":"$3":"$5":"$6;mrk=0 }' diff --git a/journfiles.sh b/journfiles.sh new file mode 100755 index 0000000..a75a383 --- /dev/null +++ b/journfiles.sh @@ -0,0 +1,4 @@ +#!/bin/bash +source /root/.local/share/cockpit/yottafree1/envfile +source $yotta_inst/ydb_env_set +find "$ydb_dir/$ydb_rel/g" -name "yottadb.mjl*" -exec ls -l '{}' \; | awk '{ print $9"@"$5"@"$6" "$7" "$8 }' diff --git a/locks.sh b/locks.sh new file mode 100755 index 0000000..1eb57cc --- /dev/null +++ b/locks.sh @@ -0,0 +1,4 @@ +#!/bin/bash +source /usr/share/cockpit/yottadb/envfile +source $yotta_inst/ydb_env_set +$ydb_dist/lke show -all 2>&1 | awk '/Owned/ { print $1":"$5}' diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..2e99889 --- /dev/null +++ b/manifest.json @@ -0,0 +1,10 @@ +{ + "version": 0, + + "tools": { + "yottafree": { + "label": "YottaDB", + "path": "yottafree.html" + } + } +} diff --git a/openports.sh b/openports.sh new file mode 100755 index 0000000..11eb4f7 --- /dev/null +++ b/openports.sh @@ -0,0 +1,2 @@ +#!/bin/bash +ss -lnp | awk '/yottadb/ { split($5,arr,":");printf "%s:",arr[4],split($7,arr,",");split(arr[2],arr1,"=");printf "%s",arr1[2];proc=arr1[2] } END { while("cat /proc/"proc"/net/netstat" | getline var) { } split(var,net," ");printf ":%s:%s",net[4],net[5];close("cat /proc/"proc"/net/netstat") }' diff --git a/yottafree.html b/yottafree.html new file mode 100644 index 0000000..b69cca6 --- /dev/null +++ b/yottafree.html @@ -0,0 +1,59 @@ + + + + YottaDB Statistics + + + + + + + +
+
+
+ +
+
+
+

Free Count

+
+ + +
RegionFreeTotal%FreeLocation
+
+
+
+

Processes

+
+ + +
PIDUSERPRNIVIRTRESSHRS%CPU%MEMTIME+
+
+
+
+

Open Ports

+
+ + +
PORTPIDIn Bound MultiCast PacketsOut Bound MultiCast Packets
+
+
+
+

Journal Files

+
+ + +
LocationSizeDate Created
+
+
+
+

Database Locks

+
+ + +
GlobalPID
+
+ + + diff --git a/yottafree.js b/yottafree.js new file mode 100644 index 0000000..c3cc751 --- /dev/null +++ b/yottafree.js @@ -0,0 +1,183 @@ +const yottatab = document.getElementById("yottatab"); +const yottatab1 = document.getElementById("yottatab2"); +const yottatab2 = document.getElementById("yottatab3"); +const yottatab3 = document.getElementById("yottatab4"); +const yottatab4 = document.getElementById("yottatab5"); +const button = document.getElementById("refresh"); + +function yottafree_run() { + var rowCount = yottatab1.rows.length; + for (var i = rowCount; i > 1; i--) { + yottatab1.deleteRow(i-1); + } + var rowCount = yottatab.rows.length; + for (var i = rowCount; i > 1; i--) { + yottatab.deleteRow(i-1); + } + var rowCount = yottatab2.rows.length; + for (var i = rowCount; i > 1; i--) { + yottatab2.deleteRow(i-1); + } + var rowCount = yottatab3.rows.length; + for (var i = rowCount; i > 1; i--) { + yottatab3.deleteRow(i-1); + } + var rowCount = yottatab4.rows.length; + for (var i = rowCount; i > 1; i--) { + yottatab4.deleteRow(i-1); + } + + + + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/freecnt.sh"]) + .stream(yottafree_output) + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/yottaprocs.sh"]) + .stream(yottaproc_output) + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/openports.sh"]) + .stream(yottaports_output) + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/journfiles.sh"]) + .stream(yottajourn_output) + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/locks.sh"]) + .stream(yottalocks_output) + +} + +function remlock_output(data) { + console.log(data); +} + +function remlock_fail(data) { + console.log(data); +} + + +function remlock(pid) { + cockpit.spawn(["/bin/bash", "-c", "/usr/share/cockpit/yottadb/clearlock.sh " + pid]) + .stream(remlock_output) + .catch(remlock_fail) + + +} + +function yottaports_output(data) { + portlines=data.split("\n"); + for (i=0;i"; + document.getElementById('lock'+i).addEventListener("click", function() { remlock(lockarray[1]); + setTimeout(() => { button.click(); }, 1000); + +}); + } + } +} + + +function yottajourn_output(data) { + const journlines=data.split("\n"); + for (i=0;i