blob: 51ed0aae85d5d2ed3abc392e2219af48cfff9dde [file] [log] [blame] [raw]
#!/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
count=0
for f in /proc/*; do
[ -h "$f" ] && continue
[ -d "$f" ] || continue
[ -f "$f/status" ] || continue
count=$((count+1))
done
echo $count
http_post "${INFLUXDB_BASE_URL}write?db=$INFLUXDB_DB_NAME" \
"procstat,host=$HOSTNAME nproc=$count"
sleep "$INTERVAL"
done