#!/usr/bin/perl use strict; my $process=$ARGV[0]; my $warning=$ARGV[1]; my $critical=$ARGV[2]; my $vserver=$ARGV[3]; my $nr=`sudo vps aux | awk '{print \$4,\$13}' | grep "$vserver $process" | wc -l`; $nr=sprintf("%d", $nr); if($nr > $critical){ print "Number of processes: $nr"; exit(2); } if($nr > $warning){ print "Number of processes: $nr"; exit(1); } print "Processes below threshold"; exit(0);