NetBurner 3.5.6
PDF Version
Diagnostics (DIAG)

Classes

class  DiagItemClass
 Base class for all diagnostic items. More...
 
class  DiagCallBack
 Callback-based diagnostic item that calls a custom function to generate diagnostic content. More...
 
class  DiagVarMon
 Monitor and report the value of numeric variables. More...
 
class  DiagStrMon
 Monitor and report string values. More...
 
class  DiagPtrMon
 Monitor and report pointer values. More...
 

Typedefs

typedef void diagcallback(int sock)
 Callback function type for custom diagnostic reports.
 

Functions

bool SendDiagReport (const char *pUrl, const char *pUser=0, const char *pPass=0)
 Send the complete diagnostic report to an external URL via HTTP POST.
 
bool SendDiagReport (ParsedURI &uri, const char *pUser=0, const char *pPass=0)
 Send the complete diagnostic report to an external URL via HTTP POST.
 
void InitPlatformDiag ()
 Initialize platform-specific diagnostics.
 

Detailed Description

#include< diagnostics.h>


The functions in this header are used to add diagnostic reports to the diagnostics tab under the config page when diagnostics.h is included and EnableSystemDiagnostics() is called.

The resulting JSON blob can be accessed directly (replace 10.1.1.100 with your IP or dns name) http://10.1.1.100:20034/DIAG

You can also access subgroups directly from the diagnostics: http://10.1.1.100:20034/DIAG/Buffers or http://10.1.1.100:20034/DIAG/Tasks

Examples
If I have a uint32_t called myVar I want to monitor:
DiagVarMon MyVarMon("MyVarName", myVar);
Monitor and report the value of numeric variables.
Definition diagnostics.h:97
If I have char buffer holding the name opf the current mode:
DiagStrMon MyStrMon("CurMode", cur_mode);
Monitor and report string values.
Definition diagnostics.h:242
If I want to output a complex JSON object for a custom report, I can write a routine that outputs this object to an fd:
void MyCustomReport(int fd);
DiagCallBack MyReporter("MyReportName", MyCustomReport);
Callback-based diagnostic item that calls a custom function to generate diagnostic content.
Definition diagnostics.h:80

Typedef Documentation

◆ diagcallback

typedef void diagcallback(int sock)

#include <diagnostics.h>

Callback function type for custom diagnostic reports.

This function type is used to create custom diagnostic output functions that can be called when the diagnostic system needs to output data for a specific diagnostic item.

Parameters
sockFile descriptor to write diagnostic output to

Function Documentation

◆ InitPlatformDiag()

void InitPlatformDiag ( )

#include <diagnostics.h>

Initialize platform-specific diagnostics.

This function is called by EnableSystemDiagnostics() to allow platforms to register their own diagnostic items. The default implementation is weak-linked and does nothing. Platforms can override this by providing their own implementation without weak linkage.

◆ SendDiagReport() [1/2]

bool SendDiagReport ( const char * pUrl,
const char * pUser = 0,
const char * pPass = 0 )

#include <diagnostics.h>

Send the complete diagnostic report to an external URL via HTTP POST.

This function collects all diagnostic data and sends it as a JSON payload via HTTP POST to the specified URL. This is useful for remote monitoring and logging of device diagnostics.

Parameters
pUrlTarget URL to send the diagnostic data to
pUserOptional username for HTTP authentication
pPassOptional password for HTTP authentication
Returns
true if the report was sent successfully, false otherwise
See also
SendDiagReport(ParsedURI&, const char*, const char*)

◆ SendDiagReport() [2/2]

bool SendDiagReport ( ParsedURI & uri,
const char * pUser = 0,
const char * pPass = 0 )

#include <diagnostics.h>

Send the complete diagnostic report to an external URL via HTTP POST.

This function collects all diagnostic data and sends it as a JSON payload via HTTP POST to the specified URL using a ParsedURI object.

Parameters
uriParsedURI object containing the target URL
pUserOptional username for HTTP authentication
pPassOptional password for HTTP authentication
Returns
true if the report was sent successfully, false otherwise
See also
SendDiagReport(const char*, const char*, const char*)