Index of /files/code/mrtg-rmt

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[   ]mrtg-rmt-1.5.tar.gz 2006-12-31 21:43 2.9K 
[   ]mrtg-rmt-1.6.tar.gz 2007-07-11 22:21 3.4K 
[   ]mrtg-rmt-1.7.tar.gz 2008-06-17 22:13 3.5K 
[   ]mrtg-rmt-1.8.4.tar.gz 2008-12-23 15:19 3.8K 
[   ]mrtg-rmt-1.8.tar.gz 2008-11-27 19:21 3.8K 
[   ]mrtg-rmt-1.8.3.tar.gz 2008-11-27 22:26 3.8K 
[   ]mrtg-rmt-1.8.2.tar.gz 2008-11-27 22:24 3.8K 
[   ]mrtg-rmt-1.8.1.tar.gz 2008-11-27 21:33 3.8K 
[   ]mrtg-rmt-1.9.tar.gz 2009-01-19 21:00 4.3K 
[   ]mrtg-rmt-1.10.tar.gz 2009-02-12 19:52 4.4K 
[   ]mrtg-rmt-1.29.tar.gz 2021-01-03 15:26 5.1K 
[   ]mrtg-rmt-1.31.tar.gz 2021-05-23 14:07 5.2K 
[   ]mrtg-rmt-1.30.tar.gz 2021-04-11 19:57 5.2K 
[   ]mrtg-rmt-1.11.tar.gz 2009-04-12 22:47 5.2K 
[   ]mrtg-rmt-1.32.tar.gz 2023-03-19 15:25 5.4K 
[   ]mrtg-rmt-1.12.tar.gz 2009-09-18 13:03 5.4K 
[   ]mrtg-rmt-1.33.tar.gz 2024-01-06 22:26 5.5K 
[   ]mrtg-rmt-1.35.tar.gz 2024-11-24 18:45 5.5K 
[   ]mrtg-rmt-1.34.tar.gz 2024-09-29 23:33 5.5K 
[   ]mrtg-rmt-1.36.tar.gz 2024-11-26 21:11 5.5K 
[   ]mrtg-rmt.tar.gz 2024-11-26 21:11 5.5K 
[   ]mrtg-rmt-1.13.tar.gz 2009-10-02 16:51 5.6K 
[   ]mrtg-rmt-1.14.tar.gz 2010-02-03 20:46 5.6K 
[   ]mrtg-rmt-1.16.tar.gz 2010-04-01 00:52 5.8K 
[   ]mrtg-rmt-1.15.tar.gz 2010-03-28 20:29 5.8K 
[   ]mrtg-rmt-1.17.tar.gz 2010-07-13 00:05 5.8K 
[   ]mrtg-rmt-1.18.tar.gz 2011-05-29 15:40 5.8K 
[   ]mrtg-rmt-1.19.tar.gz 2011-05-29 15:41 5.8K 
[   ]mrtg-rmt-1.20.tar.gz 2011-05-29 15:48 5.9K 
[   ]mrtg-rmt-1.28.tar.gz 2020-11-12 23:41 6.0K 
[   ]mrtg-rmt-1.27.tar.gz 2020-11-12 23:41 6.0K 
[   ]mrtg-rmt-1.21.tar.gz 2011-07-03 16:28 6.1K 
[   ]mrtg.cfg 2009-04-13 11:17 6.2K 
[   ]mrtg-rmt-1.23.tar.gz 2011-08-24 20:43 6.2K 
[   ]mrtg-rmt-1.22.tar.gz 2011-08-05 18:34 6.2K 
[   ]mrtg-rmt-1.24.tar.gz 2011-09-04 22:02 6.3K 
[   ]mrtg-rmt-1.25.tar.gz 2012-01-16 23:46 6.3K 
[   ]mrtg-rmt-1.26.tar.gz 2017-10-17 17:49 6.4K 

mrtg-rmt is a Perl daemon that responds to certain queries for
statistics.  Most of this data is not available via conventional means,
such as SNMP, or is returned in a value not suitable for MRTG.

Listening on a default port of 249, it waits for a connection from
netcat, run via MRTG, then spits out MRTG-compatible output, which might
be something like this:

26
100
 21:23:47 up 21 days,  6:19, 19 users,  load average: 0.00, 0.00, 0.00
tacolinux.prolixium.com

It can monitor the following things, currently:

* TemperatureMonitor output on OS X
  Syntax: "tm,$sensorIN,$sensorOUT"
  Details: It parses output from the tempmonitor CLI utlity
  Example:

% echo 'tm,CPU Core 1,CPU Core 2'|nc localhost 249
31
35
19:23  up 3 days,  8:18, 7 users, load averages: 0.21 0.15 0.12
apple.prolixium.com

* HDD temperature from the "Temperature_Celsius" S.M.A.R.T. data
  Syntax: "ht,$devIN,$devOUT"
  Details: It actually runs $smartctl -a [dev] and parses the output
  Example:

% echo 'ht,/dev/hda,/dev/hdb'|nc localhost 249
37
34
 21:30:00 up 366 days, 10:54,  2 users,  load average: 0.02, 0.02, 0.00
nonce.prolixium.com

* Any two values from the lm-sensors 'sensors' output
  Syntax: "ls,$chipIN,$sensorIN,$chipOUT,$sensorOUT"
  Details: It runs $sensors and parses the output
  Example:

% echo ls,w83781d-isa-0290,temp1,w83781d-isa-0290,temp2|nc localhost 249
35
34
 21:31:44 up 102 days, 39 min,  2 users,  load average: 0.07, 0.02, 0.00
atlantis.prolixium.com

* Smart/USB APC UPS percent load/charge or battery/utility voltage
  Syntax: "apcpercent" or "apcvoltage"
  Details: It runs $apcaccess and parses the output
  Example:

% echo apcvoltage|nc localhost 249
26
123
 21:35:57 up 102 days, 43 min,  2 users,  load average: 0.00, 0.00, 0.00
atlantis.prolixium.com

* Disk sectors read/written
  Syntax: "ds,$node"
  Details: Parses data from /sys/block/$node/stat
  Example:

% echo ds,hda|nc localhost 249
117137495
1578784088
 21:38:51 up 366 days, 11:03,  2 users,  load average: 0.17, 0.05, 0.01
nonce.prolixium.com

* Cisco WAP client bitrate
  Syntax: "wap,$hostname,$community,$mac"
  Details: Actually walks the WAP, finds the right MAC, converts the bitrate
  Example:

% echo 'wap,orthogonality,ieW5ooz5,00:17:ab:dd:85:64'|nc localhost 249
54
0
11:17AM  up 60 days,  1:59, 19 users, load averages: 0.06, 0.03, 0.00
dax.prolixium.com

Usage for mrtg-rmt is pretty simple.  To run it as a daemon, do:

# ./mrtg-rmt.pl -d

To specify a port, and run it in the foreground:

% ./mrtg-rmt.pl -p 1024

For a sample MRTG configuration file, look at the mrtg.cfg in this
directory.

If you want to use the "as" target, get apple_sensors from:

https://github.com/fermion-star/apple_sensors

Then, patch with the following:

diff --git a/temp_sensor.m b/temp_sensor.m
index fda7d58..7f6ddce 100644
--- a/temp_sensor.m
+++ b/temp_sensor.m
@@ -233,7 +233,7 @@ int main () {
     dumpNames(thermalNames, "C");
     printf("\n"); fflush(stdout);
 
-    while (1) {
+//    while (1) {
         CFArrayRef currentValues = getPowerValues(currentSensors);
         CFArrayRef voltageValues = getPowerValues(voltageSensors);
         CFArrayRef thermalValues = getThermalValues(thermalSensors);
@@ -244,11 +244,11 @@ int main () {
 //        dumpValues(currentValues);
         dumpValues(thermalValues);
         printf("\n"); fflush(stdout);
-        usleep(500000); // usleep - suspend execution for microsecond intervals
+//        usleep(500000); // usleep - suspend execution for microsecond intervals
         CFRelease(currentValues);
         CFRelease(voltageValues);
         CFRelease(thermalValues);
-    }
+//    }
 
 #if 0
     NSLog(@"%@\n", CFArrayGetValueAtIndex(currentNames, 0));

This is the only way I've found to query the Apple Silicon sensors from
the command line, unfortunately.