Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[SOLVED]Enable/Disable a QoS rule automatically

Hi All,

You've probably seen my approach to Download Throttling - for example, where the customer needs to reserve 5000 kbps for VoIP on a 50 Mbps downlink:
[LIST=1]Limit inbound VoIP traffic to 100000 kbps
  • Limit Any-Any-Any to 45000 kbps
[/LIST]
At several clients where they have two different ISPs, using Uplink Balancing, one WAN connection is dedicated to VoIP and the other to all other traffic.  The problem is what to do with the second rule above on the non-VoIP interface.  If you leave it enabled, then you permanently reduce the downlink for non-VoIP traffic to 45000 kbps.  If you leave it disabled and the VoIP WAN connection fails, VoIP is not guaranteed any downlink bandwidth on the non-VoIP WAN connection.

I made a Download Throttling rule named "Test" and was able to enable/disable from the command line with:

 cc change_object REF_QosIngTest status 1
cc change_object REF_QosIngTest status 0


I got the link status of the interface with:

cc get_object REF_uKneYMaTmg | grep 'link'


When a WAN connection fails, SNMP and email messages "[WARN-032] Internet uplink is down" are sent.  Is there a way to piggyback the enabling command onto those actions or to capture the same signal and execute a script or ...?

Cheers - Bob


This thread was automatically locked due to age.
Parents
  • I didn't see a way to hook into /usr/local/bin/notifier.plx with a cursory glance on my home system.

    You don't want to add another system to take a trap and act upon it?

    With bash (by no means a complete list):

    Get object REF_uKneYMaTmg, grep for text, toss the output and act upon the exit code of grep:
    (cc get_object REF_uKneYMaTmg | grep "'link' => 1" )> /dev/null && echo true


    In the case of grep there is also -q which saves the redirection to /dev/null:
    cc get_object REF_uKneYMaTmg | grep -q "'link' => 1" && echo true


    Also "if... then... else":
     if ( cc get_object REF_uKneYMaTmg  | grep -q "'link' => 1" ) ; then echo link is one ; else echo link is not one ; fi


    To cron or daemonize/psudo-daemonize depends on the sensitivity to delay between the change in condition and action.

    In addition to bash, perl is present and on newer versions of UTM python is installed too.
Reply
  • I didn't see a way to hook into /usr/local/bin/notifier.plx with a cursory glance on my home system.

    You don't want to add another system to take a trap and act upon it?

    With bash (by no means a complete list):

    Get object REF_uKneYMaTmg, grep for text, toss the output and act upon the exit code of grep:
    (cc get_object REF_uKneYMaTmg | grep "'link' => 1" )> /dev/null && echo true


    In the case of grep there is also -q which saves the redirection to /dev/null:
    cc get_object REF_uKneYMaTmg | grep -q "'link' => 1" && echo true


    Also "if... then... else":
     if ( cc get_object REF_uKneYMaTmg  | grep -q "'link' => 1" ) ; then echo link is one ; else echo link is not one ; fi


    To cron or daemonize/psudo-daemonize depends on the sensitivity to delay between the change in condition and action.

    In addition to bash, perl is present and on newer versions of UTM python is installed too.
Children
No Data
Share Feedback
×

Submitted a Tech Support Case lately from the Support Portal?