| #!/bin/sh |
| |
| PROGRAM_DIR="`dirname \"$0\"`" |
| . "$PROGRAM_DIR/utils.sh" |
| load_config_file "$PROGRAM_DIR/performance-monitor.cfg" |
| load_config_file /etc/performance-monitor.cfg |
| handle_command_line_options "$@" |
| [ -z "$INTERVAL" ] && INTERVAL=5 |
| [ -n "$INTERFACE" ] && set_hostname_from_interface "$INTERFACE" |
| [ -z "$HOSTNAME" ] && HOSTNAME="`hostname`" |
| |
| while true; do |
| http_post "${INFLUXDB_BASE_URL}write?db=$INFLUXDB_DB_NAME" \ |
| "loadavg,host=$HOSTNAME `sed -r -e 's/^/avg1m=/' -e 's/ /,avg5m=/' -e 's/ /,avg15m=/' -e 's/ .+//' /proc/loadavg`" |
| sleep "$INTERVAL" |
| done |