#!/usr/bin/perl

use strict;
use NOCpulse::Notif::Alert;

my $CFG           = new NOCpulse::Config; 
my $QUEUE_DIR        = $CFG->get('notification', 'alert_queue_dir'); 
my $NEW_QUEUE_DIR    = "$QUEUE_DIR/.new";

  my $alert = NOCpulse::Notif::Alert->new(
  'checkCommand' => '27',
  'clusterDesc' => 'NPops-dev',
  'clusterId' => '10702',
  'commandLongName' => 'Load',
  'customerId' => '30',
#  'groupId' => '13558',
#  'groupName' => 'Karen_Bro_NoAck',
  'groupId' => '13682',
  'groupName' => 'Karen_Rot_First',
  'hostAddress' => '172.16.0.106',
  'hostName' => 'Velma.stage',
  'hostProbeId' => '22775',
  'mac' => '00:D0:B7:A9:C7:DE',
  'message' => 'The nocpulsed daemon is not responding: ssh_exchange_identification: Connection closed by remote host. Please make sure the daemon is running and the host is accessible from the satellite. Command was: /usr/bin/ssh -l nocpulse -p 4545 -i /var/lib/nocpulse/.ssh/nocpulse-identity -o BatchMode=yes 172.16.0.10 6 /bin/sh -s',
  'osName' => 'Linux System',
  'physicalLocationName' => 'for testing - don\'t delete me',
  'probeDescription' => 'Unix: Load',
  'probeGroupName' => 'unix',
  'probeId' => '22776',
  'probeType' => 'ServiceProbe',
  'snmp' => '',
  'snmpPort' => '',
  'state' => 'UNKNOWN',
  'subject' => '',
  'time' => time(),
  'type' => 'service'
);

  my $SERVER_ID='1';
  my $TICKETCOUNT=1;
  my $t = sprintf ("%02d_%010d_%06d_%03d", $SERVER_ID, time(), $$, $TICKETCOUNT );

  $alert->ticket_id($t);  
  my $new_file="$NEW_QUEUE_DIR/$t";
  my $file="$QUEUE_DIR/$t";
  $alert->store($new_file);
  rename($new_file,$file) || return "Unable to rename $new_file\n";

