Sample Scripts to put a sample value into the specified Custom Meter


  • Example of putting a sample value into the specified custom meter
  • The following sample scripts run on your linux servers. They are able to gather "load average" and "memory usage" of the machine and put these values into the specified custom meter by using the SDPF Monitoring API.


This document and scripts are made for Linux environment.

1. Get Custom Meter Scripts

Download and Extract custom_meter_scripts.tar.gz on the server which you want to monitor by the custom meter.

tar zxvf custom_meter_scripts.tar.gz


To excute the scripts, the server need to have reachability to SDPF Keystone and Monitoring API Endpoints.

2. Set your account information for the setup.conf

Some account information (API key, API secret key, Tenant name, Keystone endpoint, Monitoring endpoint) are required to use the scripts. Enter the following parameters to the config file "setup.conf".

AUTH_URL={keystone_api_endpoint (ex.}
MONITORING_URL={monitoring_api_endpoint (ex.}


Remove the end of "/" from the endpoint URL.

3. Set sample value information for the scripts

The send_custom_meter command in the "bin/" directory is able to send a sample value with the SDPF Monitoring API according to the "setup.conf" settings.
Get sample value you want to put into the custom meter by using any commands and pass it to the *send_custom_meter* command by using pipe "|".
Additionally, Set the value for the following arguments of the send_custom_meter command to specify (or define) the custom meter you want put the value into.
  • (First argument) resource_id
  • (Second argument) custom_meter_name
  • (Third argument) custom_meter_type
  • (Fourth argument) custom_meter_unit

For example, the following script gets load_average by using uptime command and puts the value into the custom meter "load_average_01".


# File name:

source ./setup.conf

uptime | awk {'print $10'} | tr -d , | send_custom_meter nova_test01 load_average_01 gauge count

4. Get the authentication token (only at the first time)

Execute to get an authentication token. When succeeds, a token is stored in the "token" file.


5. Edit crontab and send the sample value periodically

Execute the scripts periodically and put the sample value into the custom meter in order to monitor the server permanently. Configuration example of crontab is as follow.

# put load_average at 5 minutes intervals

*/5 * * * * cd $SCRIPT_ROOT; sh