Thank you very much Phillip Stallcup, CCNA Enterprise Solutions Architect, Information Technology 405.951.2088 [integris-box-logo-email.gif]<http://integrisok.com/>
From: Cashell, Christopher P. [mailto:[email protected]] Sent: Wednesday, October 07, 2015 4:58 PM To: spectrum <[email protected]> Cc: Robert Hermann <[email protected]> Subject: [spectrum] Script: Remove Devices from Maintenance (was: RE: Removing devices from maintenance daily) I finally got around to reviewing and cleaning up my script for removing devices from maintenance. See the description in my previous e-mail (below) to see the details of what it does. We run the script daily from cron, using a cron job like this in /etc/cron.d/: [email protected]<mailto:[email protected]> SPECROOT=/opt/spectrum # Move devices without Notes from Maintenance to Hibernation @daily spectrum ( LOGDATE=$(date +\%Y\%m\%d-\%H\%M); $SPECROOT/custom/bin/maintenance-fixer.pl 2>&1 > $SPECROOT/custom/log/maintenance-fixer/maintenance-fixer-$LOGDATE.log ) The script typically takes a few minutes to run, but sometimes up to 15 minutes, in an environment with 16 SpectroSERVERs and over 6000 managed devices. As previously mentioned, it relies on Spectrum::CLI<https://urldefense.proofpoint.com/v2/url?u=http-3A__search.cpan.org_-7Eplonka_Spectrum-2DCLI-2D1.016_CLI.pm&d=AwMFAg&c=J7XjSMyoIdCxj32rtFyFO5ifGtdxQDmYNKjypEWQdbE&r=DUus6eH2hC3hCxOwVnMYVwPV4w93Z_CJWfcMryG2xHc&m=M8UdzP3GP2r6nExYkmBvEYGmj-99VT7koIZjSkjxKAg&s=5Ge8PEwimqUKS__KztJCNBqK5_Zr0k4wQhE5W1ZlQE4&e=> to greatly simplify the mess that is the Spectrum command line. If you haven't installed Spectrum::CLI (probably via CPAN), you should do that before running the script. A few other key notes: * I added .txt to the script name so stupid e-mail tools and clients (like Outlook) don't try to strip the attachment and prevent you from accessing it. You can remove the .txt extension if you want. * Your Spectrum Main Location Server (MLS) must be set in the script. Look for the constant variables near the top * You can change the amount of time the script allows a device to be in maintenance. The default is 3 days. Look for the constant variable near the MLS at the top to change it. * There is a spot in the get_landscapes() function where you can specify landscapes that you don't want to process, in case you need that functionality * Enabling "Debug" ($DBG) in the script is like a verbose mode. It will tell you what the script is doing as it goes. -- Christopher P. Cashell ________________________________ EIT Platform Engineering E-Mail: [email protected]<mailto:[email protected]> Infrastructure Monitoring, Management, and Automation Division EIT ~ Converging People and Technologies West Corporation<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.west.com_&d=AwMFAg&c=J7XjSMyoIdCxj32rtFyFO5ifGtdxQDmYNKjypEWQdbE&r=DUus6eH2hC3hCxOwVnMYVwPV4w93Z_CJWfcMryG2xHc&m=M8UdzP3GP2r6nExYkmBvEYGmj-99VT7koIZjSkjxKAg&s=cOjo7LDm1ojB0Zw_868CObk3MwLXFqfE9YQwKi23xUE&e=> ________________________________ From: Cashell, Christopher P. [mailto:[email protected]] Sent: Thursday, September 17, 2015 2:08 PM To: spectrum Cc: spectrum Subject: RE:[spectrum] Removing devices from maintenance daily I have a Perl script I wrote (written/used on Linux) that we run from cron for that. It uses the Spectrum::CLI Perl module and pulls a list of all devices in maintenance from all landscapes, checks to see if there is a notes field, and if there is no notes field and the device has been in maintenance for more than 3 days, it removes the device from maintenance by putting it into hibernation. For clarity, what it does: 1. Connect to MLS (configured in script) and pull a list of all landscapes a. filter out fault-tolerant "secondary" landscapes based on precedence b. filter out our dedicated TrapDirector landscape 2. Get a list of all devices in maintenance 3. Enrich the data for those devices (get model class, last polled time, notes field, and hibernation status) 4. Filter out devices that we are considering "out of scope" a. in hibernation b. with an entry in the notes field c. that don't have a "last polled" time d. interfaces (no reliable way to determine "last polled" time) e. devices in maintenance for less than 3 days 5. For any devices left, take them out of maintenance by putting them in "Hibernation" a. Hibernation will get them removed from Maintenance after 3 successful polls i. This prevents immediate "device unreachable" alerts for devices that are offline We run the script from cron daily. I need to review it to make sure there's no confidential information in it, but I can probably post it shortly. -- Christopher P. Cashell ________________________________ EIT Platform Engineering E-Mail: [email protected]<mailto:[email protected]> Infrastructure Monitoring, Management, and Automation Division EIT ~ Converging People and Technologies West Corporation<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.west.com_&d=AwMFAg&c=J7XjSMyoIdCxj32rtFyFO5ifGtdxQDmYNKjypEWQdbE&r=DUus6eH2hC3hCxOwVnMYVwPV4w93Z_CJWfcMryG2xHc&m=M8UdzP3GP2r6nExYkmBvEYGmj-99VT7koIZjSkjxKAg&s=cOjo7LDm1ojB0Zw_868CObk3MwLXFqfE9YQwKi23xUE&e=> ________________________________ From: Stallcup, Phillip L [mailto:[email protected]] Sent: Wednesday, September 16, 2015 9:11 AM To: spectrum Subject: [spectrum] Removing devices from maintenance daily We have a problem with devices/interfaces being put in maintenance, various reasons, but mostly to stop paging, and then being forgotten. I have a Global Collaction that collects these, so they can be more easily seen, however I'm looking for a way to remove everything that's in this GC from maintenance once per day (say 8:00 am). Anyone have any ideas? Phillip Stallcup, CCNA Enterprise Solutions Architect, Information Technology 405.951.2088 [cid:[email protected]][cid:[email protected]]<http://integrisok.com/> ________________________________ This e-mail may contain identifiable health information that is subject to protection under state and federal law. This information is intended to be for the use of the individual named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited and may be punishable by law. If you have received this electronic transmission in error, please notify us immediately by electronic mail (reply). * --To unsubscribe from spectrum, send email to [email protected]<mailto:[email protected]> with the body: unsubscribe spectrum [email protected]<mailto:[email protected]> * --To unsubscribe from spectrum, send email to [email protected]<mailto:[email protected]> with the body: unsubscribe spectrum [email protected]<mailto:[email protected]> * --To unsubscribe from spectrum, send email to [email protected]<mailto:[email protected]> with the body: unsubscribe spectrum [email protected]<mailto:[email protected]> --- To unsubscribe from spectrum, send email to [email protected] with the body: unsubscribe spectrum [email protected]
