Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
7
Indexable
#!/bin/bash 

PLUGIN_VERSION="4" ###Mandatory - If any changes in the plugin metrics, increment the plugin version here.  
HEARTBEAT="true"  ###Mandatory - Setting this to true will alert you when there is a communication problem while posting plugin data to server
METRIC_UNITS={INODES-'%'} ###OPTIONAL - These units will be displayed in the Dashboard

### The getData method contains Sample data. User can enhance the code to fetch and Original data  
getData() 
{ 
df -i / |
if 
  read
  read filesystem inodes iused igree iuseperc mountpoint &&
  [ "${iuseperc%\%}" -gt 60 ]
then
  echo "INODES:${iuseperc//%/''}"  ###Separate metrics by '|'
fi
#echo "CPU:${iuseperc}|Memory:$Memory|Process:$Name"  ###Separate metrics by '|'
} 

mandatory_attributes="plugin_version:$PLUGIN_VERSION|heartbeat_required:$HEARTBEAT"
plugin_data=$(getData)
output="$mandatory_attributes|$plugin_data|units:$METRIC_UNITS" ###Separate metrics by '|'
#After fetching your custom attributes append it to the output. Also append units if you have defined METRIC_UNITS 
echo "$output"
Editor is loading...
Leave a Comment