opensampl.collect.microchip.tp4100.collect_4100
Collection script for Microchip TimeProvider® 4100 Devices
This tool utilizes the web interface that is accessible at the IP address of the device. See the user guide for how to configure access to the web interface.
TP4100Collector
Collector class for Microchip TimeProvider 4100 device data.
This class provides functionality to collect time and performance data from Microchip TP4100 devices via their web interface.
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
__init__(host, port=443, output_dir='./output', duration=600, channels=None, metrics=None, method='chart_data', save_full_status=False)
Initialize TP4100Collector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
str
|
IP address or hostname of the TP4100 device. |
required |
port
|
int
|
Port number for HTTPS connection (default: 443). |
443
|
output_dir
|
str
|
Directory path where collected data will be saved. |
'./output'
|
duration
|
int
|
Duration in seconds for data collection. |
600
|
channels
|
Optional[list[str]]
|
List of specific channels to collect data from. |
None
|
metrics
|
Optional[list[str]]
|
List of specific metrics to collect. |
None
|
method
|
Literal['chart_data', 'download_file']
|
Collection method - "chart_data" downloads chart data for specified duration (data showing in chart on Status Page), "download_file" downloads last 24 hours (same as "Save as"). |
'chart_data'
|
save_full_status
|
bool
|
Whether to save full status information. |
False
|
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
collect_chart_data(request_key, download_dict=None)
Collect chart data for a specific metric and channel.
Requests chart data from the device's web interface for the specified duration and saves it as a CSV file with YAML metadata headers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_key
|
tuple[MonitoringConfig, int, MetricInfo]
|
Tuple of (monitor_config, channel_id, metric). |
required |
download_dict
|
Optional[dict[str, Any]]
|
Optional additional request data to further configure API call |
None
|
Raises: Exception: If data collection or file writing fails.
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
collect_readings()
Collect readings from configured channels and metrics.
Determines which channels to monitor (either specified or all monitored), then collects data for each requested metric using the configured method.
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
download_files(request_key, download_dict=None)
Download data files directly from the device.
Downloads data files (typically last 24 hours) directly from the device, similar to using "Save as" on the Status Page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_key
|
tuple[MonitoringConfig, int, MetricInfo]
|
Tuple of (monitor_config, channel_id, metric). |
required |
download_dict
|
Optional[dict[str, Any]]
|
Optional download configuration parameters. |
None
|
Raises:
Type | Description |
---|---|
Exception
|
If download or file saving fails. |
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
get_filename(detail=None, extension='.txt')
Generate timestamped filename for probe connection
Format (no detail): {host}TP4100{timestamp}.{extension} Format (with detail): {host}TP4100{detail}_{timestamp}.{extension}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detail
|
Optional[str]
|
Optional string to include in filename. |
None
|
extension
|
str
|
File extension to use (default: '.txt'). |
'.txt'
|
Returns:
Name | Type | Description |
---|---|---|
str |
Generated filename with timestamp and optional metric info. |
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
get_monitored_channels()
Retrieve list of currently monitored channels from the device.
Returns:
Name | Type | Description |
---|---|---|
set |
Set of channel names that are currently being monitored. |
Raises:
Type | Description |
---|---|
Exception
|
If unable to retrieve channel information. |
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
login()
Authenticate with the TP4100 device web interface.
Raises:
Type | Description |
---|---|
Exception
|
If login fails or connection issues occur. |
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
main(host, port=443, output_dir='./output', duration=600, channels=None, metrics=None, method='chart_data', save_full_status=False)
Collect time data from Microchip TimeProvider 4100 devices.
This tool connects to TP4100 devices via their web interface and collects performance metrics and time data.
Source code in opensampl/collect/microchip/tp4100/collect_4100.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|