summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-19 06:18:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:41 -0500
commitcb060f8bac4114766a1945c2929a75848d0d7185 (patch)
tree853c4cadbb0d324729660e83c06f0d982a77ca7e /source4
parentef948e53b7a4099663f55a9b1b3a23c6aa100b28 (diff)
downloadsamba-cb060f8bac4114766a1945c2929a75848d0d7185.tar.gz
samba-cb060f8bac4114766a1945c2929a75848d0d7185.tar.bz2
samba-cb060f8bac4114766a1945c2929a75848d0d7185.zip
r8584: added --nbt option to smbstatus for nbt server statistics
(This used to be commit 26a676a4e3596d34aee391bf132f2525972c81df)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/smbstatus29
-rw-r--r--source4/scripting/libjs/management.js21
2 files changed, 47 insertions, 3 deletions
diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus
index eaf3aa1616..df8864f7e8 100755
--- a/source4/scripting/bin/smbstatus
+++ b/source4/scripting/bin/smbstatus
@@ -13,7 +13,8 @@ var options = new Object();
ok = GetOptions(ARGV, options,
"POPT_AUTOHELP",
- "POPT_COMMON_SAMBA");
+ "POPT_COMMON_SAMBA",
+ "nbt");
if (ok == false) {
println("Failed to parse options: " + options.ERROR);
return -1;
@@ -62,8 +63,30 @@ function show_trees()
}
}
+/*
+ show nbtd information
+*/
+function show_nbt()
+{
+ var stats = nbtd_statistics();
+ if (stats == undefined) {
+ println("nbt server not running");
+ return;
+ }
+ var r;
+ println("NBT server statistics:");
+ for (r in stats) {
+ print("\t" + r + ":\t" + stats[r] + "\n");
+ }
+ println("");
+}
-show_sessions();
-show_trees();
+
+if (options['nbt'] != undefined) {
+ show_nbt();
+} else {
+ show_sessions();
+ show_trees();
+}
return 0;
diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js
index d989541661..8b04247248 100644
--- a/source4/scripting/libjs/management.js
+++ b/source4/scripting/libjs/management.js
@@ -70,3 +70,24 @@ function smbsrv_trees()
ret.length = count;
return ret;
}
+
+/*
+ return nbtd statistics
+*/
+function nbtd_statistics()
+{
+ var conn = new Object();
+ var irpc = irpc_init();
+ status = irpc_connect(conn, "nbt_server");
+ if (status.is_ok != true) {
+ return undefined;
+ }
+
+ var io = irpcObj();
+ io.input.level = irpc.NBTD_INFO_STATISTICS;
+ status = irpc.nbtd_information(conn, io);
+ if (status.is_ok != true) {
+ return undefined;
+ }
+ return io.results[0].info.stats;
+}