Project

General

Profile

« Previous | Next » 

Revision 12c82b37

Added by sbeaver about 10 years ago

View differences:

usr/local/www/status_ntpd.php
32 32
*/
33 33
/*
34 34
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/ntpd	/usr/local/sbin/ntpq
35
	pfSense_MODULE:	ntpd
35
	pfSense_MODULE: ntpd
36 36
*/
37 37

  
38 38
##|+PRIV
......
107 107
			$tmp = $tmp[1];
108 108
			if (substr($tmp, 0, 6) == '$GPRMC') {
109 109
				$gps_vars = explode(",", $tmp);
110
				$gps_ok  = ($gps_vars[2] == "A");
110
				$gps_ok	 = ($gps_vars[2] == "A");
111 111
				$gps_lat_deg = substr($gps_vars[3], 0, 2);
112 112
				$gps_lat_min = substr($gps_vars[3], 2) / 60.0;
113 113
				$gps_lon_deg = substr($gps_vars[5], 0, 3);
......
118 118
				$gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1);
119 119
			}elseif (substr($tmp, 0, 6) == '$GPGGA') {
120 120
				$gps_vars = explode(",", $tmp);
121
				$gps_ok  = $gps_vars[6];
121
				$gps_ok	 = $gps_vars[6];
122 122
				$gps_lat_deg = substr($gps_vars[2], 0, 2);
123 123
				$gps_lat_min = substr($gps_vars[2], 2) / 60.0;
124 124
				$gps_lon_deg = substr($gps_vars[4], 0, 3);
......
132 132
				$gps_sat = $gps_vars[7];
133 133
			}elseif (substr($tmp, 0, 6) == '$GPGLL') {
134 134
				$gps_vars = explode(",", $tmp);
135
				$gps_ok  = ($gps_vars[6] == "A");
135
				$gps_ok	 = ($gps_vars[6] == "A");
136 136
				$gps_lat_deg = substr($gps_vars[1], 0, 2);
137 137
				$gps_lat_min = substr($gps_vars[1], 2) / 60.0;
138 138
				$gps_lon_deg = substr($gps_vars[3], 0, 3);
......
144 144
			}
145 145
		}
146 146
	}
147

  
148 147
}
149 148

  
150 149
if (isset($config['ntpd']['gps']['type']) && ($config['ntpd']['gps']['type'] == 'SureGPS') && (isset($gps_ok))) {
......
163 162

  
164 163
$pgtitle = array(gettext("Status"),gettext("NTP"));
165 164
$shortcut_section = "ntp";
165

  
166 166
include("head.inc");
167 167
?>
168
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
169
<?php include("fbegin.inc"); ?>
170
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="status ntpd">
171
<tr><td><div id="mainarea">
172
	<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="heading">
173
		<tr><td class="listtopic">Network Time Protocol Status</td></tr>
174
	</table>
175
	<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
176
	<thead>
177
	<tr>
178
		<th class="listhdrr"><?=gettext("Status"); ?></th>
179
		<th class="listhdrr"><?=gettext("Server"); ?></th>
180
		<th class="listhdrr"><?=gettext("Ref ID"); ?></th>
181
		<th class="listhdrr"><?=gettext("Stratum"); ?></th>
182
		<th class="listhdrr"><?=gettext("Type"); ?></th>
183
		<th class="listhdrr"><?=gettext("When"); ?></th>
184
		<th class="listhdrr"><?=gettext("Poll"); ?></th>
185
		<th class="listhdrr"><?=gettext("Reach"); ?></th>
186
		<th class="listhdrr"><?=gettext("Delay"); ?></th>
187
		<th class="listhdrr"><?=gettext("Offset"); ?></th>
188
		<th class="listhdr"><?=gettext("Jitter"); ?></th>
189
	</tr>
190
	</thead>
191
	<tbody>
192
	<?php if (isset($config['ntpd']['noquery'])): ?>
193
	<tr><td class="listlr" colspan="11" align="center">
194
		Statistics unavailable because ntpq and ntpdc queries are disabled in the <a href="services_ntpd.php">NTP service settings</a>.
195
	</td></tr>
196
	<?php elseif (count($ntpq_servers) == 0): ?>
197
	<tr><td class="listlr" colspan="11" align="center">
198
		No peers found, <a href="status_services.php">is the ntp service running?</a>.
199
	</td></tr>
200
	<?php else: ?>
201
	<?php $i = 0; foreach ($ntpq_servers as $server): ?>
202
	<tr>
203
	<td class="listlr nowrap">
204
		<?=$server['status'];?>
205
	</td>
206
	<td class="listr">
207
		<?=$server['server'];?>
208
	</td>
209
	<td class="listr">
210
		<?=$server['refid'];?>
211
	</td>
212
	<td class="listr">
213
		<?=$server['stratum'];?>
214
	</td>
215
	<td class="listr">
216
		<?=$server['type'];?>
217
	</td>
218
	<td class="listr">
219
		<?=$server['when'];?>
220
	</td>
221
	<td class="listr">
222
		<?=$server['poll'];?>
223
	</td>
224
	<td class="listr">
225
		<?=$server['reach'];?>
226
	</td>
227
	<td class="listr">
228
		<?=$server['delay'];?>
229
	</td>
230
	<td class="listr">
231
		<?=$server['offset'];?>
232
	</td>
233
	<td class="listr">
234
		<?=$server['jitter'];?>
235
	</td>
236
	</tr>
237
<?php $i++; endforeach; endif; ?>
238
	</tbody>
239
	</table>
240
<?php if (($gps_ok) && ($gps_lat) && ($gps_lon)): ?>
241
	<?php $gps_goo_lnk = 2; ?>
242
	<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="gps status">
243
	<thead>
244
	<tr>
245
		<th class="listhdrr"><?=gettext("Clock Latitude"); ?></th>
246
		<th class="listhdrr"><?=gettext("Clock Longitude"); ?></th>
247
		<?php if (isset($gps_alt)) { echo '<th class="listhdrr">' . gettext("Clock Altitude") . '</th>'; $gps_goo_lnk++;}?>
248
		<?php if (isset($gps_sat) || isset($gps_satview)) { echo '<th class="listhdrr">' . gettext("Satellites") . '</th>'; $gps_goo_lnk++;}?>
249
	</tr>
250
	</thead>
251
	<tbody>
252
		<tr>
253
			<td class="listlr" align="center"><?php echo sprintf("%.5f", $gps_lat); ?> (<?php echo sprintf("%d", $gps_lat_deg); ?>&deg; <?php echo sprintf("%.5f", $gps_lat_min*60); ?><?php echo $gps_vars[4]; ?>)</td>
254
			<td class="listlr" align="center"><?php echo sprintf("%.5f", $gps_lon); ?> (<?php echo sprintf("%d", $gps_lon_deg); ?>&deg; <?php echo sprintf("%.5f", $gps_lon_min*60); ?><?php echo $gps_vars[6]; ?>)</td>
255
			<?php if (isset($gps_alt)) { echo '<td class="listlr" align="center">' . $gps_alt . ' ' . $gps_alt_unit . '</td>';}?>
256
			<?php 
257
			if (isset($gps_sat) || isset($gps_satview)) {
258
				echo '<td class="listr" align="center">';
259
				if (isset($gps_satview)) {echo 'in view ' . intval($gps_satview);}
260
				if (isset($gps_sat) && isset($gps_satview)) {echo ', ';}
261
				if (isset($gps_sat)) {echo 'in use ' . $gps_sat;}
262
				echo '</td>';
263
			}
264
			?>
265
		</tr>
266
		<tr>
267
			<td class="listlr" colspan="<?php echo $gps_goo_lnk; ?>" align="center"><a target="_gmaps" href="http://maps.google.com/?q=<?php echo $gps_lat; ?>,<?php echo $gps_lon; ?>">Google Maps Link</a></td>
268
		</tr>
269
	</tbody>
270
	</table>
271
<?php endif; ?>
272
</div></td></tr>
273
</table>
274
<?php include("fend.inc"); ?>
275
</body>
276
</html>
168

  
169
<div class="panel panel-default">
170
	<div class="panel-heading">Network Time Protocol Status</div>
171
	<div class="panel-body">
172
		<table class="table table-striped table-hover table-condensed">
173
			<thead>
174
				<tr>
175
					<th><?=gettext("Status"); ?></th>
176
					<th><?=gettext("Server"); ?></th>
177
					<th><?=gettext("Ref ID"); ?></th>
178
					<th><?=gettext("Stratum"); ?></th>
179
					<th><?=gettext("Type"); ?></th>
180
					<th><?=gettext("When"); ?></th>
181
					<th><?=gettext("Poll"); ?></th>
182
					<th><?=gettext("Reach"); ?></th>
183
					<th><?=gettext("Delay"); ?></th>
184
					<th><?=gettext("Offset"); ?></th>
185
					<th><?=gettext("Jitter"); ?></th>
186
				</tr>
187
			</thead>
188
			<tbody>
189
				<?php if (isset($config['ntpd']['noquery'])): ?>
190
				<tr>
191
					<td class="warning" colspan="11">
192
						Statistics unavailable because ntpq and ntpdc queries are disabled in the <a href="services_ntpd.php">NTP service settings</a>.
193
					</td>
194
				</tr>
195
				<?php elseif (count($ntpq_servers) == 0): ?>
196
				<tr>
197
					<td class="warning" colspan="11">
198
						No peers found, <a href="status_services.php">is the ntp service running?</a>
199
					</td>
200
				</tr>
201
				<?php else:
202

  
203
					$i = 0;
204
					foreach ($ntpq_servers as $server): ?>
205
						<tr>
206
							<td><?=$server['status']?></td>
207
							<td><?=$server['server']?></td>
208
							<td><?=$server['refid']?></td>
209
							<td><?=$server['stratum']?></td>
210
							<td><?=$server['type']?></td>
211
							<td><?=$server['when']?></td>
212
							<td><?=$server['poll']?></td>
213
							<td><?=$server['reach']?></td>
214
							<td><?=$server['delay']?></td>
215
							<td><?=$server['offset']?></td>
216
							<td><?=$server['jitter']?></td>
217
						</tr> <?php
218
					   $i++;
219
				   endforeach;
220
			   endif;
221
?>
222
			</tbody>
223
		</table>
224
	</div>
225
</div>
226

  
227

  
228
<?php
229

  
230
// GPS satellite information (if available)
231
if (($gps_ok) && ($gps_lat) && ($gps_lon)):
232
	$gps_goo_lnk = 2; ?>
233

  
234
	<div class="panel panel-default">
235
		<div class="panel-heading">GPS information</div>
236
		<div class="panel-body">
237
			<table class="table table-striped table-hover table-condensed">
238
				<thead>
239
				<tr>
240
					<th>
241
						 <?=gettext("Clock Latitude"); ?>
242
					</th>
243
					<th>
244
						<?=gettext("Clock Longitude"); ?>
245
					</th>
246
					<?php if (isset($gps_alt)) { ?>
247
						 <th>
248
							 <?=gettext("Clock Altitude")?>
249
						 </th>
250
						 <?php $gps_goo_lnk++;
251
					 }
252

  
253
					 if (isset($gps_sat) || isset($gps_satview)) { ?>
254
						<th>
255
							<?=gettext("Satellites")?>
256
						</th> <?php
257
						$gps_goo_lnk++;
258
					 }?>
259
					</tr>
260
				</thead>
261

  
262
				<tbody>
263
					<tr>
264
						<td>
265
							<?=printf("%.5f", $gps_lat); ?> (<?=printf("%d", $gps_lat_deg); ?>&deg; <?=printf("%.5f", $gps_lat_min*60); ?><?=$gps_vars[4]; ?>)
266
						</td>
267
						<td>
268
							<?=printf("%.5f", $gps_lon); ?> (<?=printf("%d", $gps_lon_deg); ?>&deg; <?=printf("%.5f", $gps_lon_min*60); ?><?=$gps_vars[6]; ?>)
269
						</td>
270

  
271
						<?php if (isset($gps_alt)) { ?>
272
							<td>
273
								<?=$gps_alt . ' ' . $gps_alt_unit?>
274
							</td>
275
							}
276

  
277
						if (isset($gps_sat) || isset($gps_satview)) { ?>
278
							<td align="center"> <?php
279
								if (isset($gps_satview)) {
280
									print('in view ' . intval($gps_satview));
281
								}
282

  
283
							if (isset($gps_sat) && isset($gps_satview)) {
284
								print(', ');
285
							}
286
							if (isset($gps_sat)) {
287
								print('in use ' . $gps_sat);
288
							} ?>
289
							</td> <?php
290
						}
291
						?>
292
					</tr>
293
					<tr>
294
						<td colspan="<?=$gps_goo_lnk; ?>"><a target="_gmaps" href="http://maps.google.com/?q=<?=$gps_lat; ?>,<?=$gps_lon; ?>">Google Maps Link</a></td>
295
					</tr>
296
				</tbody>
297
			</table>
298
		</div>
299
	</div>
300

  
301
<?php	endif;
302

  
303
include("foot.inc"); ?>

Also available in: Unified diff