Beispiele:

Wir wollen nun einige Beispiele vorstellen. Eine Beispielkonifguration finden sie zudem unter: Kernel/Config/GenericAgent.pm.examples

Hier nun die möglichen Optionen:
   'name of job' => {
      # get all tickets with these properties 
      TicketNumber => '200%01',
      Queue => 'system queue',
      States => ['new', 'open'],
      Priorities => ['1 very low', '2 low', '3 normal'],
      Locks => ['unlock'],
      From => '%spam@example.com%',
      To => '%support@example.com%',
      Cc => '%client@example.com%',
      TicketFreeKey1 => 'Product',
      TicketFreeText1 => 'adasd',
      TicketFreeKey2 => 'Product',
      TicketFreeText2 => 'adasd',
      Subject => '%VIRUS 32%',
      Body => '%VIRUS 32%',
      CustomerID => '123',
      CustomerUserLogin => 'uid123',
      # tickets older the 60 minutes
      TicketCreateTimeOlderMinutes => 60,
      # tickets newer then 60 minutes
      TicketCreateTimeNewerMinutes => 60,
      # tickets with create time older then ....
      TicketCreateTimeOlderDate => '2004-01-19 00:00:01',
      # tickets with create time newer then ...
      TicketCreateTimeNewerDate => '2004-01-09 23:59:59',

      # or escalation tickets
      Escalation => 1,

      # new ticket properties (no option is required, use just the options
      # which should be changed!)
      New => {
        # new queue
        Queue => 'new system queue',
        # possible states (closed successful|closed unsuccessful|open|new|removed) 
        State => 'closed successful',
        Priority => '3 normal',
        # new ticket free text
        TicketFreeKey1 => 'Product123',
        TicketFreeText1 => 'adasd123',
        # new ticket owner (if needed)
        Owner => 'root@localhost',
        # set customer id and customer user
        CustomerID => '123',
        CustomerUserLogin => 'usd213',
        # if you want to add a Note
        Note => {
          From => 'GenericAgent',
          Subject => 'Your subject!',
          Body => 'Some comment!',
          ArticleType => 'note-internal', # note-internal|note-external|note-report
        },
        # your program (/path/to/your/program) will be executed like
        # "/path/to/your/program $TicketNumber $TicketID" ARG[0] will 
        # be the ticket number and ARG[1] the ticket id
        CMD => '/path/to/your/program',
        # DELETE ticket from database and filesystem
        Delete => 1,
     },

Spam Tickets schließen

Wenn Sie auf Ihrer System-E-Mail-Adresse Spam Nachrichten erhalten und Sie nicht viel Zeit damit verschwenden wollen, legen Sie einfach eine Queue (bspw. Spam) an und verschieben Sie diese Spam-Tickets in diese Queue. Wenn der GenericAgent.pl ausgeführt wird, werden alle offenen Tickets in dieser Queue automatisch geschlossen.

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   # --
   # [name of job] -> close all tickets in queue spam
   # --
   'close spam' => {
      # get all tickets with this properties  
      Queue => 'spam',
      States => ['new', 'open'],
      Locks => ['unlock'],
      # new ticket properties (no option is required, use just the options
      # which should be changed!)
      New => {
        # new queue
        Queue => 'spam',
        # possible states (closed successful|closed unsuccessful|open|new|removed) 
        State => 'closed successful',
        # new ticket owner (if needed)
        Owner => 'root@localhost',
        # if you want to add a Note
        Note => {
          From => 'GenericAgent',
          Subject => 'spam!',
          Body => 'Closed by GenericAgent.pl because it is spam!',
       },
     },
   },
[...]

Tickets löschen

Wenn Sie Tickets (aus der Datenbank und dem Dateiensystem) löschen möchten, verwenden Sie das folgende:

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   # --
   # [name of job] -> close and delete all tickets in queue delete
   # --
   'delete' => {
      # get all tickets with this properties  
      Queue => 'delete',
      States => ['new', 'open'],
      Locks => ['unlock'],
      # new ticket properties (no option is required, use just the options
      # witch should be changed!)
      New => {
        # DELETE!
        Delete => 1,
     },
   },
[...]

Tickets von "tricky" nach "experts" verschieben

Verschieben von Tickets aus der Queue "tricky" in die Queue "experts" und anhängen einer Notiz.

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   # --
   # [name of job] -> move all tickets from tricky to experts
   # --
   'move tickets from tricky to experts' => {
      # get all tickets with this properties  
      Queue => 'tricky',
      States => ['new', 'open'],
      Locks => ['unlock'],
      # new ticket properties
      New => {
        Queue => 'experts',
        Note => {
          From => 'GenericAgent',
          Subject => 'Moved!',
          Body => 'Moved from "tricky" to "experts" because it was not possible to find a sollution!',
          ArticleType => 'note-internal', # note-internal|note-external|note-report
        },
      },
   },
[...]

Verschieben von Tickets von abc nach experts und Änderung der Priorität

Verschieben von Tickets aus der Queue "abc" in die Queue "experts" und ändern der Priorität von "3 normal" auf "4 hoch".

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   # --
   # [name of job] -> move all tickets from abc to experts and change priority
   # --
   'move all abc priority "3 normal" tickets to experts and change priority'=> {
      # get all tickets with this properties  
      Queue => ['abc'],
      States => ['new', 'open'],
      Locks => ['unlock'],
      Priorities => ['3 normal'],
      # new ticket properties
      New => {
        Queue => 'experts',
        Priority => '4 high',
      },
   },
[...]

Verschieben von eskalierten Tickets nach experts und ausführend eines Kommandos

Wenn es eskalierte Tickets gibt, werden diese in die Queue experts verschoben und anschließend ein Kommando ausgeführt.

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   # --
   # [name of job] -> move all tickets from xyz to experts
   # --
   'move escalation ticket to experts and execute CMD' => {
      # get all tickets with this properties  
      Queue => 'xyz',
      Escalation => 1,
      # new ticket properties
      New => {
        Queue => 'experts',
        # your program (/path/to/your/program) will be executed like
        # "/path/to/your/program $TicketNumber $TicketID" ARG[0] will 
        # be the ticket number and ARG[1] the ticket id
        CMD => '/path/to/your/program',
      },
   },
[...]

Löschen aller Tickets mit dem Betreff "I love you" in der Queue "abc"

Löschen aller Tickets mit dem Betreff "I love you" in der Queue "abc".

Beispiel für die Konfigurationsdatei: Kernel/Config/GenericAgent.pm
[...]
   'delete all tickets with subject "VIRUS 32" in queue abc' => {
      # get all tickets with this properties  
      Queue => 'abc',
#      From => '%spam@example.com%',
#      To => '%support@example.com%',
#      Cc => '%client@example.com%',
      Subject => '%VIRUS 32%',
#      Body => '%testing case 1245%',
      # new ticket properties
      New => {
        # DELETE!
        Delete => 1,
      },
   },
[...]