05-13-2014 02:57 PM
Hi, can some-one please assist with suggestions for an EEM script to monitor the Cellular RSSI which the results can be checked by the script for IP routes to be removed and added for traffic to be sent to the same end-point for an IPsec tunnel but through alternate paths.
I have a c9141 router connecting Cellular and establishing an IPsec tunnel to an ASA. If the NextG signal fails, I wish the connection to fail over to a Satellite path but still to the same end point.
Many Thanks
David
05-13-2014 04:22 PM
This is what I have so far :
event manager applet watch-signal
event timer watchdog time 120
action 001 cli command "enable"
action 002 cli command "show cell 0 radio"
action 003 regexp "Current RSSI = dBm" "$_cli_result" match dBm
action 004 if $_regexp_result eq 1
action 005 if $dBm le 90
action 006 cli command "ip route 0.0.0.0 0.0.0.0 cellular 0/0/0"
action 007 cli command "ip route 203.8.129.90 255.255.255.255 cellular 0/0/0"
action 008 else
action 009 cli command "ip route 0.0.0.0 0.0.0.0 192.168.5.1"
action 010 cli command "ip route 203.8.129.90 255.255.255.255 192.168.5.1"
action 011 end
action 012 end
action 013 end
but I can't get it to work
05-14-2014 06:34 AM
Action 002 you have "cell 0" while other actions call out "cellular 0/0/0". What error messages are returned when you run the policy?
05-14-2014 07:00 AM
05-14-2014 04:10 PM
Hi Daniel,
Firstly, thank you for taking the time to reply. I had spotted the Cell 0 mistake and that had subsequently been updated.
The script now looks like this :
event manager applet watch-signal
event timer watchdog time 60 maxrun 120
action 001 cli command "enable"
action 002 cli command "show cellular 0/0/0 all | inc Current RSSI"
action 003 regexp "Current RSSI = (-[0-9]+)dBm" "$_cli_result dBm
action 004 if $_regexp_result le 90
action 005 if $dBm le -90
action 006 cli command "configure terminal"
action 007 cli command "ip route 0.0.0.0 0.0.0.0 cellular 0/0/0"
action 008 cli command "ip route 203.8.129.90 255.255.255.255 cellular 0/0/0"
action 009 else
action 010 if $dBm ge -90
action 011 cli command "ip route 0.0.0.0 0.0.0.0 192.168.5.1"
action 012 cli command "ip route 203.8.129.90 255.255.255.255 192.168.5.1"
action 013 end
action 014 end
action 015 end
If I run a debug event manager all, the below are the results with what appear to be and end with normal exit and no errors. The script simply closes without moving onto action 006 thru 008 which I expect to do:
*May 15 09:02:53.465: Popping tag <fh_fd_publish_none_spec> off stack
*May 15 09:02:53.465: close tag is </fh_fd_publish_none_spec>
*May 15 09:02:53.465: Popping tag <fh_publish_event_spec> off stack
*May 15 09:02:53.465: close tag is </fh_publish_event_spec>
*May 15 09:02:53.465: EEM: policy_dir xml builtin: name:_event_type value:131
*May 15 09:02:53.465: EEM: policy_dir xml builtin: name:_event_type_string value:none
*May 15 09:02:53.465: EEM: policy_dir xml builtin: name:_event_severity value:severity-normal
*May 15 09:02:53.465: EEM: policy_dir xml builtin: name:_none_argc value:0
*May 15 09:02:53.465: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : CTL : cli_open called.
*May 15 09:02:53.465: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : OUT : reeve000mwwr01#
*May 15 09:02:53.465: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : IN : reeve000mwwr01#enable
*May 15 09:02:53.465: cli_history_entry_add: free_hist_list size=0, hist_list size=7
*May 15 09:02:53.465: eem_no_scan flag set, skipping scan of command_string=check_eem_cli_policy_handler
*May 15 09:02:53.477: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : OUT : reeve000mwwr01#
*May 15 09:02:53.477: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : IN : reeve000mwwr01#show cellular 0/0/0 all | inc Current RSSI
*May 15 09:02:53.481: cli_history_entry_add: free_hist_list size=0, hist_list size=7
*May 15 09:02:53.481: eem_no_scan flag set, skipping scan of command_string=check_eem_cli_policy_handler
*May 15 09:02:53.489: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : OUT : Current RSSI = -76 dBm
*May 15 09:02:53.489: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : OUT : reeve000mwwr01#
*May 15 09:02:53.489: %HA_EM-6-LOG: watch-signal : DEBUG(cli_lib) : : CTL : cli_close called.
*May 15 09:02:53.489: fh_server: fh_io_msg: received msg FH_MSG_CALLBACK_DONE from client 2930 pclient 2
*May 15 09:02:53.489: fh_io_msg: EEM callback policy watch-signal has ended with normal exit status of 0x0
*May 15 09:02:53.489: EEM fms_remote_chkpt_add_event_hist(), data_len = 2980, buf_size = 2992
*May 15 09:02:53.489: fh_send_none_fd_msg: msg_type=18
*May 15 09:02:53.489: fh_fd_none_publish_done: rc=0, re=280C71D4
*May 15 09:02:53.489: fh_fd_none_publish_done: rc=0, publish_expired=0
*May 15 09:02:53.489: sid=51, ptp=0x280C6314, connp=0x2802D32C
*May 15 09:02:53.489: none_conn_tm_remove: re=0x280C71D4, ptp=0x280C6314
*May 15 09:02:53.489: fh_fd_none_conn_tm_free: ptp=0x280C6314
*May 15 09:02:53.489: fh_send_none_fd_msg: sval=0
*May 15 09:02:53.489: EEM: server decrements in use thread: jobid=2928 rule id=3 in use thread=0.
*May 15 09:02:53.489: fh_schedule_callback: fh_schedule_callback: cc=313D0DC0 prev_epc=30050C0C; epc=0
*May 15 09:02:53.489: EEM server schedules callbacks: policy_type: 2
*May 15 09:02:53.489: fh_schedule_policy: prev_epc=0x0; epc=0x0
*May 15 09:02:53.489: EEM server schedules scripts
*May 15 09:02:53.489: fh_server: fh_io_msg: received msg FH_MSG_API_CLOSE from client 2930 pclient 2
*May 15 09:02:53.489: fh_io_msg: received FH_MSG_API_CLOSE client=2930
*May 15 09:02:53.489: fh_fd_match_event: re=0x280C71D4, policyname=watch-signal, parameters=, get_tty=1
*May 15 09:03:00.001: fh_fd_timer_process_async
*May 15 09:03:00.001: cron_tick: num_matches 0
05-14-2014 04:34 PM
Still not quite right. Try this.
event manager applet watch-signal
event timer watchdog time 60 maxrun 120
action 001 cli command "enable"
action 002 cli command "show cellular 0/0/0 all | inc Current RSSI"
action 003 regexp "Current RSSI = (-[0-9]+) dBm" $_cli_result dBm
action 005 cli command "configure terminal"
action 006 if $dBm le -90
action 007 cli command "ip route 0.0.0.0 0.0.0.0 cellular 0/0/0"
action 008 cli command "ip route 203.8.129.90 255.255.255.255 cellular 0/0/0"
action 009 else
action 011 cli command "ip route 0.0.0.0 0.0.0.0 192.168.5.1"
action 012 cli command "ip route 203.8.129.90 255.255.255.255 192.168.5.1"
action 013 end
11-22-2016 08:17 AM
did you actually get this to work? I am seeing issue in evaluating the (-) value. It doesn't seem to matter whether we use le or ge the negative number. I am using this to determine which SIM/provider to use via route injection.
11-22-2016 09:31 AM
I had a typo above. Updated with this policy.
=================
event manager applet watch-signal
event timer watchdog time 60 maxrun 120
action 010 cli command "enable"
action 020 cli command "show cellular 0/0/0 all | inc Current RSSI"
action 030 regexp "Current RSSI = (-[0-9]+) dBm" "$_cli_result" match dBm
action 040 cli command "configure terminal"
action 050 if $dBm ge "-90"
action 055 puts "DBM = $dBm, match >= -90"
action 070 cli command "ip route 203.8.129.90 255.255.255.255 cellular 0/0/0"
action 080 else
action 085 puts "DBM = $dBm, match < -90"
action 100 cli command "ip route 203.8.129.90 255.255.255.255 192.168.5.1"
action 110 end
===========================
When policy runs it displays a message with the value of RSSI.
Nov 22 18:14:07: %HA_EM-6-LOG: watch-signal: DBM = -62, match >= -90
C1921#sh run | inc 203.8.129.90
ip route 203.8.129.90 255.255.255.255 Cellular0/0/0
11-22-2016 04:18 PM
Thanks for the response. The platform I am working on is a little different as it has two internal modems that are active/active (IR829). We are trying to pick an RSSI value to go with and impact traffic paths via static routes. Obviously we will change the run times, but are still hitting an issue where the second variable doesn't seem to populate; therefore the comparison cannot happen. Any ideas or obvious things stick out here? We also put some cleanup commands in so you don't end up with two floating static routes. I was also trying to find the OID for RSSI per modem on this platform, but can't find it online anywhere.
event manager applet BESTRSSI
event timer watchdog time 60 maxrun 120
action 010 cli command "enable"
action 020 cli command "show cellular 0/0 all | inc Current RSSI"
action 030 regexp "Current RSSI = (-[0-9]+) dBm" "$_cli_result" match VZW
action 040 puts "RSSI for cellular 0/0 $VZW"
action 050 cli command "show cellular 1/0 all | inc Current RSSI"
action 060 regexp "Current RSSI = (-[0-9]+) dBm" "$_cli_result" match ATT
action 070 puts "RSSI for cellular 1/0 $ATT"
action 080 cli command "configure terminal"
action 090 if $ATT le $VZW
action 100 cli command "ip route 0.0.0.0 0.0.0.0 cellular 0/0"
action 110 cli command "no ip route 0.0.0.0 0.0.0.0 cellular 1/0"
action 120 else
action 130 cli command "ip route 0.0.0.0 0.0.0.0 cellular 1/0"
action 140 cli command "no ip route 0.0.0.0 0.0.0.0 cellular 0/0 "
action 150 end
11-22-2016 04:45 PM
Nothing stands out, and looks like it should work. ATT RSSI is not getting populated?
Enable "debug event manager all" and run the EEM policy.
11-22-2016 07:12 PM
you got it Daniel. For some reason I get a message about "unable to find variable ATT" or something similar. I will post again tomorrow when I am back on the gear.
01-03-2018 11:59 PM
Did this actually worked?
Tried the script suggested but I am getting this error:
%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: dBm
event manager applet watch-signal
event timer watchdog time 60 maxrun 120
action 001 cli command "enable"
action 002 cli command "show cellular 0 all | inc Current RSSI"
action 003 regexp "Current RSSI(RSCP) = (-[0-9]+) dBm" "$_cli_result" match dBm
action 004 if $dBm ge "-93"
action 005 puts "DBM = $dBm, match >= -93"
action 006 cli command "configure terminal"
action 007 cli command "show cell 0 all | inc SIM"
action 008 regexp "Active SIM = ([0-9])" $_cli_result match slot
action 009 if $slot eq 1
action 010 cli command "cellular 0 lte sim activate slot 0"
action 011 else
action 012 cli command "cellular 0 lte sim activate slot 1"
action 013 end
action 014 end
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide