Projet

Général

Profil

Révision c2522f5b

IDc2522f5bd248c3999e819955f20832c8be133f44
Parent dec7c0c8
Enfant 30a78e2e

Ajouté par Lars Kruse il y a plus de 7 ans

jenkins_: emit warning in case of unknown 'mode'

Voir les différences:

plugins/jenkins/jenkins_
107 107
		print "build_stable.label stable\n";
108 108
		print "build_stable.type GAUGE\n";
109 109
		print "build_stable.colour 294D99\n";
110
		exit;
111
	}
112
	if( $type eq "queue" ) {
110
	} elsif( $type eq "queue" ) {
113 111
		print "graph_args --base 1000 -l 0\n";
114 112
		print "graph_title Jenkins Queue Length\n";
115 113
		print "graph_vlabel Number of Jobs in Queue\n";
......
117 115
		print "graph_info The Graph shows the Number of Jobs in the Build Queue\n";
118 116
		print "build_count.label Jobs in Queue\n";
119 117
		print "build_count.type GAUGE\n";
120
		exit;
121
	}
122
	if( $type eq "running" ) {
118
	} elsif( $type eq "running" ) {
123 119
		print "graph_args --base 1000 -l 0\n";
124 120
		print "graph_title Jenkins Builds Running\n";
125 121
		print "graph_vlabel Builds currently running\n";
......
127 123
		print "graph_info The Graph shows the Number of Builds, currently running\n";
128 124
		print "build_running.label running Builds\n";
129 125
		print "build_running.type GAUGE\n";
130
		exit;
126
	} else {
127
		warn "Unknown mode requested: $type\n";
131 128
	}
132 129
} else {
133 130
	my $cmd = "$wgetBin $auth -qO- $url:$port$context";
......
145 142
		foreach my $status (keys %{$counts}) {
146 143
			print "build_$status.value $counts->{$status}\n";
147 144
		}
148
		exit;
149
	}
150

  
151
	if( $type eq "running" ) {
145
	} elsif( $type eq "running" ) {
152 146
		my $result = `$cmd'/api/json?depth=$jobDepth&tree=$tree'`;
153 147
		my $parsed = decode_json($result);
154 148
		my $count = parse_running_builds($parsed->{'jobs'});
155 149
		print "build_running.value ", $count, "\n";
156
		exit;
157
	}
158

  
159
	if( $type eq "queue" ) {
150
	} elsif( $type eq "queue" ) {
160 151
		my $result = `$cmd/queue/api/json`;
161 152
		my $parsed = decode_json($result);
162 153
		print "build_count.value ", scalar( @{$parsed->{'items'}} ), "\n";
163
		exit;
154
	} else {
155
		warn "Unknown mode requested: $type\n";
164 156
	}
165 157
}
166 158

  

Formats disponibles : Unified diff