CUSTOM_METRICS.md in instrumental_tools-1.0.0.rc2 vs CUSTOM_METRICS.md in instrumental_tools-1.0.0
- old
+ new
@@ -1,8 +1,8 @@
# Custom Metric Scripts
-You may have specific pieces of architecture that you would like `instrument_server` to monitor. As of version 0.7.0 of the `instrument_server` gem, you may pass the `-e` flag to `instrument_server` on startup to enable this functionality. There are several [examples](examples/) of scripts that you may use for your infrastructure, or you can [write your own](#writing_custom_scripts).
+You may have specific pieces of architecture that you would like `instrument_server` to monitor. As of version 1.0.0 of the `instrument_server` gem, you may pass the `-e` flag to `instrument_server` on startup to enable this functionality. There are several [examples](examples/) of scripts that you may use for your infrastructure, or you can [write your own](#writing_custom_scripts).
## Installing Custom Scripts
To install custom scripts, place them in the directory `$HOME/.instrumental_scripts`. The `instrument_server` process will create this directory if it doesn't exist the first time you run the process with script functionality enabled (`-e`). You may also specify a specific directory to the `instrument_server` process with the `-s` (`--script-location`) flag.
@@ -26,10 +26,16 @@
```
METRIC_NAME METRIC_VALUE
```
+or
+
+```
+METRIC_NAME METRIC_VALUE UNIX_TIME_IN_SECONDS
+```
+
For example, if a script named `application_load` were to report two metrics, `memory` and `load`, to the `instrument_server` process, its output should be:
```
memory 1024.0
load 0.7
@@ -40,9 +46,11 @@
```
HOST_NAME.SCRIPT_NAME.METRIC_NAME
```
Using the previous example, if the `application_load` script ran on a host named `app-0001`, its `memory` and `load` metrics would be submitted to Instrumental as `app-0001.application_load.memory` and `app-0001.application_load.load`.
+
+The optional third parameter of the above formats, `UNIX_TIME_IN_SECONDS`, represents the time under which the submitted metric should be measured. Generally you do not need to provide this value, as `instrument_server` will default to recording the time when it receives the metric from your script as the time under which the measurement should be recorded.
### Exit Codes
If you do not want the output of your script submitted to Instrumental, your process should exit with a non-zero exit code. Its `STDOUT` output will still be provided to your script on the next iteration.