#!/bin/sh
#
# Plugin to monitor the number of firebird processes.
#
# (c) GPL Tomas Pospisek <tpo_deb@sourcepole.ch>
#
# Usage: copy or link into /etc/lrrd/client.d/
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - used by lrrd-config)
#
# Magic markers (optional - used by lrrd-config and some installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf

if [ "$1" = "autoconf" ]; then
	echo yes
	exit 0
fi

if [ "$1" = "config" ]; then
    echo 'graph_title Number of firebird processes'
    echo 'graph_args --base 1000 -l 0'
    echo 'graph_vlabel summ of processes'
    echo 'ibguard.label ibguard'
    echo 'ibguard.draw LINE2'
    echo 'ibserver.label ibserver'
    echo 'ibserver.draw STACK'
    exit 0
fi

echo -n 'ibguard.value '
pgrep ibguard | grep -v grep | wc -l
echo -n 'ibserver.value '
pgrep ibserver | grep -v grep | wc -l
