Functions
FIXME
There are a number of remstats-supplied functions which may be useful in
munging collected data for user-defined RRDs. The data
directive in an
RRD definition allows you to specify a function like:
data myvar=&myfunc(collector-var-name) ...
The functions which might be of use are:
-
siunits - converts large numbers to short strings. E.G. "
1200000
"
would be rendered as "1.2M
".
-
timestamp - converts a unix timestamp (seconds since Jan 1 1970) into
a more comprehensible form "
YYYY-MM-DD hh:mm:ss
".
-
timestamp2 - converts a unix timestamp (seconds since Jan 1 1970) into
a different, more comprehensible form "
YYYYMMDD-hhmmss
".
-
si_to_number - converts SI units (as produced by
siunits
above
to a bare number.
-
m_or_km_to_km - converts a number of meters or kilometers to kilometers.
Specifically, "
1.2km
" is converted to "1.2
", but "2500m
" is
converted to "2.5
".
-
sec_to_dhms - converts a number of seconds into a string like
"
2d12:10:14
", meaning "2 days 12 hours 10 minutes and 14 seconds".
-
to_filename - the remstats file-name numger, it converts a string to
one containing no characters which will give problems in file-names, by
removing such characters.
-
cisco_modem_protocol - converts protocol names from a Cisco Access
Server to numbers.
-
cisco_modem_modulation - converts modulation names from a Cisco Access
Server to numbers.
-
cisco_modem_state - converts modem state names from a Cisco Access
Server to numbers.
-
apcups_battery_status - converts battery status numbers from an
APCC UPS (from SNMP) to a string indicating the status.
-
snmpiftype - convert an SNMP interface type to a short name.
-
snmpifstatus - convert an SNMP interface status to a short string.
-
to_ifname - munge an interface name to lower-case and remove all
characters except letters, digits, colon (:), underscore (_), hyphen (-)
and period (.). This is not intended to make a safe file-name (note the
colon), but rather to get names that can be dealt with more easily.
If you want to add your own functions, use the private.pl file.
[