summaryrefslogtreecommitdiff
path: root/testprogs/ejs/nbtstats
blob: 20bc781f03c387ce9d05c2831a38dfe651e76d12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env smbscript
/*
	demonstrate access to irpc calls from ejs
*/	

var options = new Object();

ok = GetOptions(ARGV, options,
		"POPT_AUTOHELP",
		"POPT_COMMON_SAMBA");
if (ok == false) {
   println("Failed to parse options: " + options.ERROR);
   return -1;
}

var conn = new Object();
var irpc = irpc_init();

status = irpc_connect(conn, "nbt_server");
assert(status.is_ok == true);

io = new Object();
io.input = new Object();
io.input.level = irpc.NBTD_INFO_STATISTICS;
status = irpc.nbtd_information(conn, io);
assert(status.is_ok == true);
assert(io.results.length == 1);

print("nbt_server statistics:\n");
stats = io.results[0].info.stats;

for (r in stats) {
    print("\t" + r + ":\t" + stats[r] + "\n");
}
return 0;