svn commit: samba r8584 - in branches/SAMBA_4_0/source/scripting: bin libjs

tridge at samba.org tridge at samba.org
Tue Jul 19 06:18:48 GMT 2005


Author: tridge
Date: 2005-07-19 06:18:48 +0000 (Tue, 19 Jul 2005)
New Revision: 8584

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8584

Log:
added --nbt option to smbstatus for nbt server statistics





Modified:
   branches/SAMBA_4_0/source/scripting/bin/smbstatus
   branches/SAMBA_4_0/source/scripting/libjs/management.js


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/bin/smbstatus
===================================================================
--- branches/SAMBA_4_0/source/scripting/bin/smbstatus	2005-07-19 06:08:06 UTC (rev 8583)
+++ branches/SAMBA_4_0/source/scripting/bin/smbstatus	2005-07-19 06:18:48 UTC (rev 8584)
@@ -13,7 +13,8 @@
 
 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 @@
 	}
 }
 
+/*
+  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;

Modified: branches/SAMBA_4_0/source/scripting/libjs/management.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/management.js	2005-07-19 06:08:06 UTC (rev 8583)
+++ branches/SAMBA_4_0/source/scripting/libjs/management.js	2005-07-19 06:18:48 UTC (rev 8584)
@@ -70,3 +70,24 @@
 	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;
+}



More information about the samba-cvs mailing list