EEM Script to reload router only once after tracked object is down.

event manager applet vpn_tunnel_unreachable
event track 456 state down
action 1.0 reload
I need it to reload only once if tracked object 456 is down. It should reload the router and then if the tracked object is still down it should go into dial backup as it normally would if it did not have the reload script.

I suggest reposting this question at the other Network Management subforum under Network Infrastructure to get the attention of the resident EEM guru.
http://forum.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Network%20Infrastructure&topic=Network%20Management&CommCmd=MB%3Fcmd%3Ddisplay_messages%26mode%3Dnew%26location%3D.ee71a02

Similar Messages

  • EEM script to Reload router 1 Time if Dial Fails

    We have a script we use to track objects and if access to these objects fails we reload the router 1 time (see it below). We want to now apply the same script in a different capacity for another customer for dial. If the router fails to connect after trying to round robin thru 4 toll free 800 numbers then reload the router.
    event manager applet vpn_tunnel_rebooter
    event none
    action 1.0 cli command "enable"
    action 2.0 cli command "config t"
    action 3.0 cli command "no event manager applet vpn_tunnel_unreachable"
    action 4.0 cli command "end"
    action 5.0 cli command "write mem"
    action 6.0 reload
    event manager applet vpn_tunnel_up
    event track 456 state up
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "event manager applet vpn_tunnel_unreachable"
    action 004 cli command "event track 456 state down"
    action 005 cli command "action 1.0 policy vpn_tunnel_rebooter"
    action 006 cli command "end"
    Any ideas on how we might accomplish this? I have very little EEM experience :)
    1) Current Object tracking tracks 3 objects, If access to all three is down we go into a 180 sec delay down timer. If they remain down we switch over to dial backup.
    2) We round robin between 4 dial numbers and if access to all 4 fails, we want to reload router "ONE" time
    3) When it comes back up and objects are still unavailable we attempt to dial the 4 numbers again and if it also fails to connect "DO NOT" reload this time.

    Okay, these policies should do what you want. They are all untested as I do not have a dial backup setup. First, you need to register the following applets:
    event manager applet remove-dial-backup-watch
    event syslog pattern "SYS-5-RESTART"
    action 1.0 cli command "enable"
    action 2.0 cli command "config t"
    action 3.0 cli command "no event manager policy tm_check_dial_backup.tcl"
    action 4.0 cli command "end"
    event manager applet watch-track-down
    event track 456 state down
    action 1.0 syslog msg "Track 456 is down, waiting to see if dial backup comes up"
    action 2.0 cli command "enable"
    action 3.0 cli command "config t"
    action 4.0 cli command "event manager policy tm_check_dial_backup.tcl"
    action 5.0 cli command "end"
    event manager applet watch-track-up
    event track 456 state up
    action 1.0 syslog msg "Track 456 is up, removing dial backup watcher"
    action 2.0 cli command "enable"
    action 3.0 cli command "config t"
    action 4.0 cli command "no event manager policy tm_check_dial_backup.tcl"
    action 5.0 cli command "end"
    Then, you need to set an environment variable for the Tcl policy:
    dial_backup_numbers : Comma-separated list of numbers to check
    For example:
    event manager environment dial_backup_numbers 18667143757,18003179379,18886601039,18004434603
    Then INSTALL but do NOT register the attached Tcl policy. That is, copy the attached Tcl policy to your EEM user policy directory, but do not register it.
    Then everything should just work.

  • Reload Router max. once/24 hr while other actions will run all the time within an EEM applet

    I have an EEM script which runs on a track when it goes down, within the actions i have different other things to check and take actions accordingly and they are working fine. I want to include a router reload within the same applet which should only trigger once within 24 hrs., no matter how many times the EEM runs during 24 hrs.
    Here is my current applet:
    event manager applet MyApplet authorization bypass
     event track 10 state down maxrun 3600
     action 1.0 cli command "enable"
     action 2.0 cli command "conf t"
     action 3.0 cli command "service internal"
     action 3.1 cli command "do test cellular 0 modem-power-cycle"
     action 3.2 cli command "no service internal"
     action 4.0 wait 720
     action 5.0 track read 10
     action 6.0 if $_track_state eq "down"
     action 6.1  cli command "int cell0"
     action 6.2  cli command "shut"
     action 6.3  cli command "controller cell 0"
     action 6.4  cli command "lte radio off"
     action 6.5  wait 60
     action 6.6  cli command "no lte radio off"
     action 6.7  cli command "int cell0"
     action 6.8  cli command "no shut"
     action 6.9 end
    At the end i want to add another wait of 10 sec. and check the track state again, if it is still Down I want to trigger a reload, but when router comes back after reload and my EEM triggers again, i don't want to reload if the last reload was triggered within last 24 hrs.

    The way you're using wait in this applet is not ideal.  It would be better, especially for the long wait, to have this broken up into multiple applets so that they can run asynchronously.  In fact, given what you want to do for this reload, that would be the better way to go.  If you configured a second applet at the end of this applet like:
    event manager environment q "
    action 7.0 cli command "event manager applet reload-countdown"
    action 7.1 cli command "event timer countdown 10"
    action 7.2 cli command "action 1.0 cli command enable"
    action 7.3 cli command "action 2.0 cli command $q config t$q"
    action 7.4 cli command "action 3.0 cli command $q no event manager applet reload-countdown$q"
    action 7.5 cli command "action 4.0 cli command end"
    action 7.6 cli command "action 5.0 cli command $q write mem$q"
    action 7.7 cli command "action 1.0 reload"
    Then you could have another applet that reacts to the tracked object coming up.  This applet would simply unconfigure the reload-countdown applet.  Thus, if the track comes back up, the reload will not happen.

  • EEM applet to reload router after ip is unreachable over time

    Hi
    I am trying to create an EEM applet that will track the reachability of a group of  IP addresses. The condition needs to be as followed:
    If the IP addresses become unreachable for about an 1 hour 15 minutes then reload the router. I have looked at the delay command using the IP SLA option but it only delays up to 180 seconds. Any Ideas?

    The applet that tracks your IP SLA objects (I'm guessing you have a tracked object that tracks a list of other objects) should configure another timer applet that counts down the time you want.  For example:
    event manager applet track-down event track 3 state down action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "event manager applet countdown" action 3.1 cli command "event timer countdown time 4500" action 3.2 cli command "action 1.0 reload" action 4.0 cli command "end"!event manager applet track-up event track 3 state up action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "no event manager applet countdown" action 4.0 cli command "end"

  • EEM scripting assistance: Switch, router and AP CDP

    We would like to create an EEM script which will let the switch populate the interface description based on the CDP neighbour, however, we want the script to only populate the interface if (and only if) the CDP is a Cisco wireless access point (AP), a Cisco Catalyst switch and a Cisco router.   We DO NOT want the interface description to be edited if the CDP neighbour is a Cisco phone or a Cisco DMP (for example). 
    This is our EEM script: 
    event manager applet update-port
    event none
    event neighbor-discovery interface regexp GigabitEthernet.* cdp add
    action 100 if $_nd_cdp_capabilities_string eq "Router" goto 200
    action 110 elseif $_nd_cdp_capabilities_string eq "Switch" goto 200
    action 120 if $_nd_cdp_capabilities_string eq "Switch" goto 200
    action 200 cli command "enable"
    action 210 cli command "config t"
    action 220 cli command "interface $_nd_local_intf_name"
    action 230 cli command "description $_nd_cdp_entry_name"
    action 400 else
    action 500 end
    And this is a sample of our “sh cdp neighbor” output:
    Switch#sh cdp n d
    Device ID: Wireless
    Entry address(es):
      IP address: <REMOVED>
    Platform: cisco AIR-CAP3602I-N-K9   ,  Capabilities: Router Trans-Bridge
    Interface: GigabitEthernet0/8,  Port ID (outgoing port): GigabitEthernet0.1
    Holdtime : 146 sec
    Version :
    Cisco IOS Software, C3600 Software (AP3G2-K9W8-M), Version 15.2(2)JB, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2012 by Cisco Systems, Inc.
    Compiled Mon 10-Dec-12 23:52 by prod_rel_team
    advertisement version: 2
    Duplex: full
    Power drawn: 15.400 Watts
    Power request id: 19701, Power management id: 2
    Power request levels are:15400 0 0 0 0
    Power Available TLV:
        Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
    Management address(es):
    Device ID: 00:0f:44:02:c5:29
    Entry address(es):
      IP address: <REMOVED>
    Platform: Cisco DMP 4310G,  Capabilities: Host
    Interface: GigabitEthernet0/3,  Port ID (outgoing port): eth0
    Holdtime : 157 sec
    Version :
    5.4
    advertisement version: 2
    Duplex: full
    Power Available TLV:
        Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
    Management address(es):
    Device ID: CALM040.mgmt.educ
    Entry address(es):
      IP address: <REMOVED>
    Platform: cisco WS-C3750E-24PD,  Capabilities: Switch IGMP
    Interface: GigabitEthernet0/10,  Port ID (outgoing port): GigabitEthernet1/0/22
    Holdtime : 126 sec
    Version :
    Cisco IOS Software, C3750E Software (C3750E-UNIVERSALK9-M), Version 15.0(2)SE, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2012 by Cisco Systems, Inc.
    Compiled Fri 27-Jul-12 23:26 by prod_rel_team
    advertisement version: 2
    Protocol Hello:  OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF0000000000000023AC075300FF0000
    VTP Management Domain: 'ACTEducation'
    Native VLAN: 99
    Duplex: full
    Power Available TLV:
        Power request id: 0, Power management id: 1, Power available: 0, Power management level: -1
    Management address(es):
      IP address: <REMOVED>
    Device ID: 00:0f:44:02:b6:31
    Entry address(es):
      IP address: <REMOVED>
    Platform: Cisco DMP 4310G,  Capabilities: Host
    Interface: GigabitEthernet0/2,  Port ID (outgoing port): eth0
    Holdtime : 169 sec
    Version :
    5.4
    advertisement version: 2
    Duplex: full
    Power Available TLV:
        Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
    Management address(es):
    Best Regards/Leo

    action 221 regexp "^([^\.])\." $_nd_cdp_entry_name match hostaction 230 cli command "description $host"
    Hi Joe,
    So the EEM is going to look like this: 
    event manager applet update-port
    event neighbor-discovery interface regexp GigabitEthernet.* cdp add
    action 100 regexp "(Switch|Router)" $_nd_cdp_capabilities_string
    action 110 if $_regexp_result eq 1
    action 200 cli command "enable"
    action 210 cli command "config t"
    action 220 cli command "interface $_nd_local_intf_name"
    action 230 regexp "^([^\.])\." $_nd_cdp_entry_name match host
    action 240 cli command "description $host"
    action 500 end
    Is this correct?

  • Nexus 5596 reloads with redundant PS after 1 PS breaks down

    Hi All,
    We have a Nexus N5K-C5596UP with redundant power supply. 2 x N55-PAC-1100W.
    Last week 1 of those PS broke down. When this happened the chassis reloaded. I wouldn't expect this to happen.
    Does anyone have an idea of why this happened?
    Our NX-OS version is n5000-uk9.5.2.1.N1.1a.
    Thanks,
    Joris

    Joris, good day.
    I suppose it's your case: http://www.cisco.com/c/en/us/support/docs/field-notices/638/fn63893.html
    Best regards,
    Zakhar Belyakov.

  • USB devices disapear and only reappear after a full power down

    Hi All
    Has anyone seen this before, The USB devices (Mouse/Kboard/ilok) started to be flaky and then disappeared. After a soft restart the Mouse and keyboard came back but not the Ilok. After a hard reset eg pulling power for 30sec everything has come back. Is this a sign of things to come, power supply issues etc?
    Thank you
    Mal

    In some cases, the keyboard plus mouse is right at the edge of acceptable power draw, and adding anything to the second keyboard outlet causes it to malfunction or over-power and drop out.
    The Mac Pro has separate power budgets for the front ports in total and the back ports in total, so one approach might be to plug in the other stuff on the other side.

  • Execute delay only once the entire time

    I need ideas on how to execute a delay only once after start (and that's it, no more calling the delay ever again after start) in a while loop without affecting other codes in that same loop...
    Something like this http://forums.ni.com/t5/LabVIEW/put-a-delay-for-executing-case-structure/m-p/1095396/highlight/true#... but it is not working

    Why? That makes no sense. You need to change the loop termination inside the subVI as I already mentioned.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    DelayMod.png ‏10 KB

  • Rings only once - still no fix for this flaw?

    Any help here appreciated.  I also have the problem where my 8310 rings only once after vibrating.  In fact it goes back to vibrating after ringing the one time.
    The suggestion to contact the carrier and lengthen the amount of time before sending to voicemail doesn't fix the problem, or even make an acceptable work-around in my opinion, because:
      - It does no change the problem because it has nothing to do with the problem (the problem is with the phone)
      - Even if it did work, it would inconvenience the caller to have to wait so long for me to either pick up or go to voicemail
      - It worked fine on the Pearl, which had a 15-second time
    The problem is that it goes:
    vibrate - vibrate - vibrate - ring - vibrate - vibrate  [off to voicemail] 
    15 seconds are enough time to what is normal and correct, but not happening for me:
    vibrate - vibrate - vibrate - ring - ring - ring  [off to voicemail]
    If the waiting time is increased to 30 seconds, there is just more of the same problem:
    vibrate - vibrate - vibrate - ring - vibrate - vibrate - vibrate - ring - vibrate  [30 seconds up, off to voicemail]
    Please tell me there is a solution to this apparent flaw.  I would have gotten a proper phone if I had known there would be this hassle by getting a new BB.  I feel like sending a bill to RIM for all my wasted time on this matter.
    What I don't get is that this apparent bug has been around for a long time, yet my Curve bought last week still has it, and I have not found a proper solution to the problem yet.  Either I am missing something or does BB not come out with patches for bugs / design flaws?

    OK, here's what makes no sense - my coworker has a 8310 just like mine, but his works fine - it vibrates first, then it rings multiple times as it should.  With the exact same settings in 'profiles', mine rings only once. 

  • IP SLA EEM to reload router after ping failure

    Hi,
    I have created the below configuration but it seems to be failing to trigger the reload. Anybody can please comment what is missing here?
    track 1 ip sla 10 reachability
    delay down 180 up 40  ***** this is in sec - since ping freq is 10 sec , after 18 ping failure and 3 mnts track reachability will be down - it will wait 40 sec before declaring UP *****
    ip sla 10
    icmp-echo 172.20.20.153
    threshold 450  **** in millisec it is threshold value - no action will be taken ****
    timeout 500  **** in millisec it is icmp timeout *****
    frequency 10  *** icmp ping every 10 sec *****
    ip sla schedule 10 life forever start-time now
    event manager applet Router-Reload
    event track 1 state down
    action 1.0 syslog msg "Reply timed out; Router will Reload"
    action 1.1 cli command "enable"
    action 1.2 cli command "reload"

    It worked. Thanks Joseph.
    So what was the issue with my approach. Is it the sequence number?

  • Need help in executing EEM applet only once

    Do we have any sample script for EEM applet counter ?  We want applet to execute once after reload after matching a string . We tried couple of solutions like “ server suspend  “( customer does not like server suspend)   and event counter ( this does not allow syslog string matching ). Please let me know if there are any options.
    At the router reload, match the string , bring down the interface and run this applet only once . I have been trying multiple messages in Bootup log for this for bringing the interface down.
    The issue we are facing is that most of the bootup log messages can be triggered when the router is up as well which will result in triggering of the applet which is what we want to avoid.
    event manager applet Interface_down
    event syslog pattern "SPA removed from subslot 0/0"
    trigger delay 10
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "shutdown"
    action 3.0 cli command "end"
    event manager applet Interface_up
    event syslog pattern "Bulk Sync succeeded"
    trigger delay 100
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "no shutdown"
    action 3.0 cli command "end"
    end

    This is a bit dirty but you can create an applet to run at startup that creates the event detection applet. Then at the end of the detection applet, have it remove itself from the running config. This means that the  applet running at startup will always create the event detection applet but the event detection applet will only ever run once for that router boot period as it deletes itself after first run.
    The problem is that when you want to have one applet create another applet, you have issues with the inverted commas being correctly configured for the second applet which will cause it to run once, but fail after that. The way you can get around this is to write the applet to a text file on the flash and then copy the contents of the text file to the running config at boot. This preserves the structure of the applet being created and ensures that it will function correctly.
    The following example builds the event detection applet at system restart (BUILDAPPLET)  by copying the file "eventapplet.txt" to running config. The event detection applet (EVENTDETECT) detects a syslog pattern, in this case exiting global config, and runs the applet sending a puts command and outputting HELLO. The event detection applet then removes itself from the running config.
    !# configure the router
    conf t
    !# turn off file prompting to let the BUILDAPPLET run when copying
    file prompt quiet
    !# create the applet that runs at system restart and copies the flash applet to the running config
    event manager applet BUILDAPPLET
     event syslog pattern "%SYS-5-RESTART"
     action 10 cli command "en"
     action 11 cli command "copy flash:eventapplet.txt running-config"
    !# exit
    end
    !######## Create the flash file containing your run once applet ########
    ! enter the tclsh so we can write our applet to a file - put your event detection applet in here between the {} that you want to run once
    tclsh
    puts [open "flash:eventapplet.txt" w+] {
    event manager applet EVENTDETECT
     event syslog pattern "%SYS-5-CONFIG_I"
     action 1.0 puts "HELLO"
     action 2.0 cli command "en"
     action 3.0 cli command "conf t"
     action 4.0 cli command "no event manager applet EVENTDETECT"

  • Why does my printer connected through time capsule only print once after powering on then never again?

    Hey,
    I have a TimeCapsule which is logging in to my wireless network (i.e. it's not extending it, neither is it serving its own network). I have a Brother HL-2030 connected to it (via USB). I have two issues:
    * the printer will only print directly after plugging in the USB cable to the TC, but only once. Subsequent attempts to print would not succeed. Disconnecting and reconnecting the USB cable will help, again, only once. The printer works flawlessly when directly connected to my MBP.
    * the TimeCapsule is not found by AirPort utility, and neither am I able to apply a software update to it. Configuring it to extend my WLAN does not work reliably.
    Does anyone have an idea what might be wrong here?
    Regards,
    Matthias

    Thanks for the hint. I had thought about that, too. It was the easiest to configure the network this way as the modem is provider pre-configured. But I need to see if I can get to bridged mode. There's an additional problem with the location of the device in the building...
    The printer had worked through the TC when it was the router (with my previous provider) and served the WLAN. Thus I don't see where the difference should be, particularly as I believe the printer is served via IP and thus it should IMHO not matter if the TC serves the WLAN + device or only the device.

  • Run same install scripts only once

    I recently found the install script mechanism quite inefficient (and I'm sure many other people have noticed it as well).
    for example,if I install the texlive-most group, after every package installed, mktexlsr would run once. But actually, the only one that is necessary is the last one.
    So I think if pacman could run every same install script only once, this would speed pacman up a lot (especially when you haven't upgrade for two months!)
    Last edited by darkraven (2011-01-23 03:25:03)

    Get coding:
    http://projects.archlinux.org/pacman.git/
    http://mailman.archlinux.org/mailman/listinfo/
    https://wiki.archlinux.org/index.php/Us … cman_Hooks

  • Whilst connected to internet itunes will only open once after rebooting and thereafter it will not open again until reboot. When reboot with internet off itunes will open repeatedly. Help

      This problem has only appeared in the past few days before that I had nio problems with itunes. Firstly I discovered that I could only open Itunes once after reboot - thereafter it would not reopen until I reboot again.  I have spent considerable hours yesterday talking to the Apple help by phone and tried all there suggestions including of course reinstalling itunes amongst other things.  Eventually I thought the problem had been solved when I discovered that I could suddenly open Itunes repeatedly without rebooting.  After a short time I then discovered that the reason it was working agai was that I had rebooted with the internet disconnected and itunes would open repeatedly as normal provide I left the internet disconnected.  When I reconnect to internet the problem resurfaces. HELP

    For those still wondering how to install ios 6.1 on 5th gen iPod, you need to download it off of apples official website and then shift click restore from backup and choose the downloaded ios 6.1
    apples one year warrant covers any hardware problems like these right?

  • Help: I want to auto schedule a load using file watcher but it runs only once for the first time and after that it is not running at all

    Hi All,
    I am trying  to execute the below code as provided from one of the blogs. i am able to run the job only once based on a file watcher object(i.e. for very first time) and after that the job is not running at all and if  i schedule the job to run automatically based on interval of 10 or more minutes it is executing properly). Please let me know or guide me if i have missed any step or configuration.that is needed.
    Version of Oracle 11.2.0.1.0
    OS : Windows 7 Prof
    Given all the necessary privileges
    BEGIN
      DBMS_SCHEDULER.CREATE_CREDENTIAL(
         credential_name => 'cred',
         username        => 'XXXX',
         password        => 'XXXX');
    END;
    CREATE TABLE ZZZZ (WHEN timestamp, file_name varchar2(100),
       file_size number, processed char(1));
    CREATE OR REPLACE PROCEDURE YYYY
      (payload IN sys.scheduler_filewatcher_result) AS
    BEGIN
      INSERT INTO ZZZZ VALUES
         (payload.file_timestamp,
          payload.directory_path || '/' || payload.actual_file_name,
          payload.file_size,
          'N');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_PROGRAM(
        program_name        => 'prog1',
        program_type        => 'stored_procedure',
        program_action      => 'YYYY',
        number_of_arguments => 1,
        enabled             => FALSE);
      DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
        program_name        => 'prog1',
        metadata_attribute  => 'event_message',
        argument_position   => 1);
      DBMS_SCHEDULER.ENABLE('prog1');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_FILE_WATCHER(
        file_watcher_name => 'file_watcher1',
        directory_path    => 'D:\AAAA',
        file_name         => '*.txt',
        credential_name   => 'cred',
        destination       => NULL,
        enabled           => FALSE);
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_JOB(
        job_name        => 'job1',
        program_name    => 'prog1',
        queue_spec      => 'file_watcher1',
        auto_drop       => FALSE,
        enabled         => FALSE);
      DBMS_SCHEDULER.SET_ATTRIBUTE('job1','PARALLEL_INSTANCES',TRUE);
    END;
    EXEC DBMS_SCHEDULER.ENABLE('file_watcher1,job1');
    Regards,
    kumar.

    Please post a copy and paste of a complete run of a test case, similar to what I have shown below.
    SCOTT@orcl12c> SELECT banner FROM v$version
      2  /
    BANNER
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    PL/SQL Release 12.1.0.1.0 - Production
    CORE    12.1.0.1.0    Production
    TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
    NLSRTL Version 12.1.0.1.0 - Production
    5 rows selected.
    SCOTT@orcl12c> CONN / AS SYSDBA
    Connected.
    SYS@orcl12c> -- set file watcher interval to one minute:
    SYS@orcl12c> BEGIN
      2    DBMS_SCHEDULER.SET_ATTRIBUTE
      3       ('file_watcher_schedule',
      4        'repeat_interval',
      5        'freq=minutely; interval=1');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SYS@orcl12c> CONNECT scott/tiger
    Connected.
    SCOTT@orcl12c> BEGIN
      2    -- create credential using operating system user and password (fill in your own):
      3    DBMS_SCHEDULER.CREATE_CREDENTIAL
      4       (credential_name     => 'cred',
      5        username          => '...',
      6        password          => '...');
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- create table to insert results into:
    SCOTT@orcl12c> CREATE TABLE ZZZZ
      2    (WHEN      timestamp,
      3      file_name varchar2(100),
      4      file_size number,
      5      processed char(1))
      6  /
    Table created.
    SCOTT@orcl12c> -- create procedure to insert results:
    SCOTT@orcl12c> CREATE OR REPLACE PROCEDURE YYYY
      2    (payload IN sys.scheduler_filewatcher_result)
      3  AS
      4  BEGIN
      5    INSERT INTO ZZZZ VALUES
      6        (payload.file_timestamp,
      7         payload.directory_path || '/' || payload.actual_file_name,
      8         payload.file_size,
      9         'N');
    10  END;
    11  /
    Procedure created.
    SCOTT@orcl12c> -- create program, define metadata, and enable:
    SCOTT@orcl12c> BEGIN
      2    DBMS_SCHEDULER.CREATE_PROGRAM
      3       (program_name          => 'prog1',
      4        program_type          => 'stored_procedure',
      5        program_action      => 'YYYY',
      6        number_of_arguments => 1,
      7        enabled          => FALSE);
      8    DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
      9       program_name         => 'prog1',
    10       metadata_attribute  => 'event_message',
    11       argument_position   => 1);
    12    DBMS_SCHEDULER.ENABLE ('prog1');
    13  END;
    14  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create file watcher:
      3    DBMS_SCHEDULER.CREATE_FILE_WATCHER
      4       (file_watcher_name   => 'file_watcher1',
      5        directory_path      => 'c:\my_oracle_files',
      6        file_name          => 'f*.txt',
      7        credential_name     => 'cred',
      8        destination          => NULL,
      9        enabled          => FALSE);
    10  END;
    11  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create job:
      3    DBMS_SCHEDULER.CREATE_JOB
      4       (job_name          => 'job1',
      5        program_name          => 'prog1',
      6        queue_spec          => 'file_watcher1',
      7        auto_drop          => FALSE,
      8        enabled          => FALSE);
      9    -- set attributes:
    10    DBMS_SCHEDULER.SET_ATTRIBUTE ('job1', 'PARALLEL_INSTANCES', TRUE);
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- enable:
    SCOTT@orcl12c> EXEC DBMS_SCHEDULER.enable ('file_watcher1, job1');
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- write file (file must not exist previously):
    SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY upncommon_dir AS 'c:\my_oracle_files'
      2  /
    Directory created.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file1.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    1 row selected.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file2.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    22-OCT-13 10.14.08.580000 PM
    c:\my_oracle_files/file2.txt
            57 N
    2 rows selected.

Maybe you are looking for