add uptime as metric
This commit is contained in:
parent
a43227fb47
commit
88aef600c8
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -5,7 +5,9 @@
|
||||
"files.associations": {
|
||||
"http_metrics.h": "c",
|
||||
"outputs.h": "c",
|
||||
"task.h": "c"
|
||||
"task.h": "c",
|
||||
"metrics.h": "c",
|
||||
"freertos.h": "c"
|
||||
},
|
||||
"idf.openOcdConfigs": [
|
||||
"board/esp32-wrover-kit-3.3v.cfg"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include "freertos/timers.h"
|
||||
#include "nvs_flash.h"
|
||||
|
||||
#include "metrics.h"
|
||||
#include "outputs.h"
|
||||
|
@ -1,3 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_event.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/sys.h>
|
||||
#include <lwip/api.h>
|
||||
#include <lwip/netdb.h>
|
||||
|
||||
#include "metrics.h"
|
||||
#include "outputs.h"
|
||||
#include "inputs.h"
|
||||
@ -46,6 +64,11 @@ void taskMetrics(void *pvParameters)
|
||||
|
||||
u16MetricCounter = 0U;
|
||||
|
||||
/*Uptime*/
|
||||
strcpy(aMetrics[u16MetricCounter].caMetricName, "uptime_seconds");
|
||||
aMetrics[u16MetricCounter].fMetricValue = (esp_timer_get_time() / 1000000U);
|
||||
u16MetricCounter++;
|
||||
|
||||
/*Wifi RSSI*/
|
||||
wifi_ap_record_t ap;
|
||||
esp_wifi_sta_get_ap_info(&ap);
|
||||
|
@ -1,26 +1,7 @@
|
||||
#ifndef H_HTTPS_METRICS
|
||||
#define H_HTTPS_METRICS
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include <esp_http_server.h>
|
||||
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_event.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_netif.h"
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/sys.h>
|
||||
#include <lwip/api.h>
|
||||
#include <lwip/netdb.h>
|
||||
|
||||
#define WIFI_CONNECTED_BIT BIT0
|
||||
#define WIFI_FAIL_BIT BIT1
|
||||
#define HTML_RESPONSE_SIZE 256U
|
||||
@ -37,6 +18,4 @@ void initMetrics(void);
|
||||
|
||||
void connect_wifi(void);
|
||||
httpd_handle_t setup_server(void);
|
||||
void vSetMetrics(sMetric *paMetrics, uint16_t u16Size);
|
||||
|
||||
#endif /* H_HTTPS_METRICS */
|
||||
void vSetMetrics(sMetric *paMetrics, uint16_t u16Size);
|
Loading…
Reference in New Issue
Block a user