View | Details | Raw Unified | Return to ticket 7306 | Differences between
and this patch

Collapse All | Expand All

(-)a/doc/man/man1/sdiag.1 (+9 lines)
Lines 277-282 Print description of options and exit. Link Here
277
Sort Remote Procedure Call (RPC) data by message type ID and user ID.
277
Sort Remote Procedure Call (RPC) data by message type ID and user ID.
278
278
279
.TP
279
.TP
280
\fB\-M\fR, \fB\-\-cluster\fR=<\fIstring\fR>
281
The cluster to issue commands to. Only one cluster name may be specified.
282
Note that the SlurmDBD must be up for this option to work properly.
283
284
.TP
280
\fB\-r\fR, \fB\-\-reset\fR
285
\fB\-r\fR, \fB\-\-reset\fR
281
Reset counters. Only supported for Slurm operators and administrators.
286
Reset counters. Only supported for Slurm operators and administrators.
282
287
Lines 302-307 Some \fBsdiag\fR options may be set via environment variables. These Link Here
302
environment variables, along with their corresponding options, are listed below.
307
environment variables, along with their corresponding options, are listed below.
303
(Note: commandline options will always override these settings)
308
(Note: commandline options will always override these settings)
304
.TP 20
309
.TP 20
310
\fBSLURM_CLUSTERS\fR
311
The cluster to issue commands to.
312
313
.TP 20
305
\fBSLURM_CONF\fR
314
\fBSLURM_CONF\fR
306
The location of the Slurm configuration file.
315
The location of the Slurm configuration file.
307
316
(-)a/src/sdiag/opts.c (-1 / +35 lines)
Lines 49-54 Link Here
49
static void  _help( void );
49
static void  _help( void );
50
static void  _usage( void );
50
static void  _usage( void );
51
51
52
static void _opt_env(void)
53
{
54
	char *env_val;
55
56
	if ((env_val = getenv("SLURM_CLUSTERS"))) {
57
		if (!(params.clusters = slurmdb_get_info_cluster(env_val))) {
58
			print_db_notok(env_val, 1);
59
			exit(1);
60
		}
61
	}
62
}
63
52
/*
64
/*
53
 * parse_command_line, fill in params data structure with data
65
 * parse_command_line, fill in params data structure with data
54
 */
66
 */
Lines 61-66 extern void parse_command_line(int argc, char **argv) Link Here
61
		{"help",	no_argument,	0,	'h'},
73
		{"help",	no_argument,	0,	'h'},
62
		{"reset",	no_argument,	0,	'r'},
74
		{"reset",	no_argument,	0,	'r'},
63
		{"sort-by-id",	no_argument,	0,	'i'},
75
		{"sort-by-id",	no_argument,	0,	'i'},
76
		{"cluster",     required_argument, 0,   'M'},
77
		{"clusters",    required_argument, 0,   'M'},
64
		{"sort-by-time",no_argument,	0,	't'},
78
		{"sort-by-time",no_argument,	0,	't'},
65
		{"sort-by-time2",no_argument,	0,	'T'},
79
		{"sort-by-time2",no_argument,	0,	'T'},
66
		{"usage",	no_argument,	0,	OPT_LONG_USAGE},
80
		{"usage",	no_argument,	0,	OPT_LONG_USAGE},
Lines 72-78 extern void parse_command_line(int argc, char **argv) Link Here
72
	params.mode = STAT_COMMAND_GET;
86
	params.mode = STAT_COMMAND_GET;
73
	params.sort = SORT_COUNT;
87
	params.sort = SORT_COUNT;
74
88
75
	while ((opt_char = getopt_long(argc, argv, "ahirtTV", long_options,
89
	/* get defaults from environment */
90
	_opt_env();
91
92
	while ((opt_char = getopt_long(argc, argv, "ahiM:rtTV", long_options,
76
				       &option_index)) != -1) {
93
				       &option_index)) != -1) {
77
		switch (opt_char) {
94
		switch (opt_char) {
78
			case (int)'a':
95
			case (int)'a':
Lines 85-90 extern void parse_command_line(int argc, char **argv) Link Here
85
			case (int)'i':
102
			case (int)'i':
86
				params.sort = SORT_ID;
103
				params.sort = SORT_ID;
87
				break;
104
				break;
105
			case (int)'M':
106
				if (params.clusters)
107
					FREE_NULL_LIST(params.clusters);
108
				if (!(params.clusters = slurmdb_get_info_cluster(optarg))) {
109
					print_db_notok(optarg, 0);
110
					exit(1);
111
				}
112
				break;
88
			case (int)'r':
113
			case (int)'r':
89
				params.mode = STAT_COMMAND_RESET;
114
				params.mode = STAT_COMMAND_RESET;
90
				break;
115
				break;
Lines 104-109 extern void parse_command_line(int argc, char **argv) Link Here
104
				break;
129
				break;
105
		}
130
		}
106
	}
131
	}
132
133
	if (params.clusters) {
134
		if (list_count(params.clusters) > 1) {
135
			fatal("Only one cluster can be used at a time with "
136
			      "sdiag");
137
		}
138
		working_cluster_rec = list_peek(params.clusters);
139
	}
107
}
140
}
108
141
109
142
Lines 119-124 Usage: sdiag [OPTIONS]\n\ Link Here
119
  -a              all statistics\n\
152
  -a              all statistics\n\
120
  -r              reset statistics\n\
153
  -r              reset statistics\n\
121
\nHelp options:\n\
154
\nHelp options:\n\
155
  --cluster       direct the request to a specific cluster\n\
122
  --help          show this help message\n\
156
  --help          show this help message\n\
123
  --sort-by-id    sort RPCs by id\n\
157
  --sort-by-id    sort RPCs by id\n\
124
  --sort-by-time  sort RPCs by total run time\n\
158
  --sort-by-time  sort RPCs by total run time\n\
(-)a/src/sdiag/sdiag.h (-1 / +1 lines)
Lines 40-45 Link Here
40
struct sdiag_parameters {
40
struct sdiag_parameters {
41
	int mode;
41
	int mode;
42
	int sort;
42
	int sort;
43
	List clusters;
43
};
44
};
44
45
45
typedef enum {
46
typedef enum {
46
- 

Return to ticket 7306