**v3 and above now allows you to pick a specific access layer**
**v4 added new functions thanks to user feedback. Now has the ability to navigate around section title headers and to handle of any size**
**v5 with a lot of work by Vincent Bacher he determined that some larger policies need a time specified to search. This version added in a 6 month limit on hits prior to the day you run it (Today - 6Months.)**
** v6 combined MDS & SMS into a single script. Added the ability to disable or delete rules based on UID or NAME. The disable script will add a commend 'Disabled by Zero Hits'
This is a simple shell script that will allow you to parse a specific rulebase for rules with a ZERO hit count. The results will be output into a single file of mgmt_cli commands to disable or delete those rules.
The script is setup to run on the Mgmt station itself and uses the 'mgmt_cli -r true' function and uses the -d DOMAIN flag to support SMS and MDS in a single script
It is highly recommended to run the 'DISABLE' version prior to running a 'DELETE' it will treat it as a staging for full deletion
How to Use
- Move script to the management station
- ./cleanup-zero-hits.sh
- Enter IP address of SMS or CMA you wish to check
- Follow remaining prompts for options
- uid or name
- The script will ask if you want to export with uid or name. UID is more accurate as it does not change with position. This will prevent a situation where another admin is adding/removing rules from the rulebase before you are able to run the output file.
You can take the delete/disable command file and run it.
- chmod 755 Output-Filename.txt
- ./Output-Filename.txt
Original files on github: GitHub - cpmidsouth/Delete-or-Disable-Zero-Hit-Rules: This script is designed to search a specifed r...
NOTE: If you use inline layers within the rulebase you will need to search those as a separate layer. This script is not effective in a rulebase where multiple targets within the same rulebase. I am working on that one. Thanks to Vincent Bacher for being my QA and spending way too much time testing with me.
Feedback welcome this was a simple project that came out of a client request.