#!/usr/bin/perl

# Arguments
# 0 = name of host in service definition
# 1 = name/description of service in service definition
# 2 = return code
# 3 = output

# [<timestamp>] PROCESS_SERVICE_CHECK_RESULT;<host_name>;<description>;<return_code>;<plugin_output>

my $host = $ARGV[0];
my $service = $ARGV[1];
my $value = $ARGV[2];
my $mesg = $ARGV[3];

my $time = time;

open CMD, ">>/var/lib/nagios2/rw/nagios.cmd" || die;
print CMD "[$time] PROCESS_SERVICE_CHECK_RESULT;$host;$service;$value;$mesg\n";
close CMD;
