-
Notifications
You must be signed in to change notification settings - Fork 321
Description
Story: As an operator I'd like an easy way to scrape internal stats for use with external graphing (MRTG)
Proposal: I've implemented a new beacon type called SBEACON that replicates the functionality of IBEACON but only writes to /tmp/dw-stats.txt
case BEACON_STATS:
{
int last_minutes = 60;
FILE *statFile = fopen("/tmp/dw-stats.txt", "w");
if (statFile == NULL)
{
dw_printf("Error opening stats file!\n");
}
fprintf (statFile, "MSG_CNT=%d\r\nPKT_CNT=%d\r\nDIR_CNT=%d\r\nLOC_CNT=%d\r\nRF_CNT=%d\r\nUPL_CNT=%d\r\nDNL_CNT=%d\r\n",
igate_get_msg_cnt(),
igate_get_pkt_cnt(),
mheard_count(0,last_minutes),
mheard_count(g_igate_config_p->max_digi_hops,last_minutes),
mheard_count(8,last_minutes),
igate_get_upl_cnt(),
igate_get_dnl_cnt());
fclose(statFile);
strlcpy (beacon_text, "", sizeof(beacon_text)); // abort!
}
break;
I set this to beacon every 5mins and then I whipped up a few simple bash scripts to feed MRTG
#!/bin/bash
# APRS-IS Traffic - MRTG Script for DireWolf
source /tmp/dw-stats.txt
echo $DNL_CNT
echo $UPL_CNT
uptime -p
hostname -a
and
#!/bin/bash
# Local RF - MRTG Script for DireWolf
source /tmp/dw-stats.txt
echo $DIR_CNT
echo $LOC_CNT
uptime -p
hostname -a
You can see them in action at http://igate.nayr.net
I'd offer a merge request, but my solution is not windows compatible (hardcoded filename) and kinda stomps on the toes of beacons with this pseduo beacon, and feels hacky because well it is.. so I dont think you'll take it.. But I would like to discuss such functionality.. I noticed your collecting other stats but had a TODO on using em, perhaps a json/xml/csv file that contains all this info and is updated at a configured interval.. or some sort of external API to retrieve this at our own rates.