Posts

Showing posts from March, 2012

vFoglight Cisco UCS Cartridge

Here is all of the code which you will need to get things running. I have stopped the development of this cartridge and turning it over to capable hands at Quest. Below are the files

Cisco UCS Files

vFoglight Alarms with Counts (Groovy Script)

Using the script editor located in Administration > Tooling > Script Console. Best to go ahead and save these for running at a later date when you need them. This will give you all of the alarms in the system along with the number of times it has triggered.
alarmService = server.get("AlarmService") currentAlarms = alarmService.getCurrentAlarms(); def alarms = [] as TreeMap; def result = new StringBuilder(); for (currentAlarm in currentAlarms) { def alarmName = currentAlarm.getSourceName() def alarmEntry = alarms[alarmName] if(alarmEntry == null) { alarms[alarmName] = 1 } else { alarms[alarmName] = alarmEntry + 1 } } for (alarm in alarms.entrySet()) { result.append(alarm.getKey()).append(" ").append(alarm.getValue()).append("\n") } return result

vFoglight Purge Stale Objects (Groovy Script)

Using the script editor located in Administration > Tooling > Script Console. Best to go ahead and save these for running at a later date when you need them. On line "10" you can enter the number of days to go back to remove the script below will purge objects "30" days old. Also on line "17" you can show the items to purge instead of deleting them.
// Script Purpose: Remove Stale Objects from vFoglight Database // Script Platform: Foglight Managment Servers running on Windows or Linux // Script Created by: chris.walker@quest.com // Script Last Updated: 10.13.2011 // Script Version: 11.10.13 // Please see PDF documentation that should have come with this script for usage information // Note: The script formating was compressed to save page space in the PDF. Sorry this does make it harder to read. // Modify the line below to change the number of days staleDays='30';// Exmple: Deleted object with stale data that is older than "30" …

vFoglight Purge Alarms (Groovy Script)

Using the script editor located in Administration > Tooling > Script Console. Best to go ahead and save these for running at a later date when you need them. On line "4" you can enter the number of day to go back and delete. This script will only remove 10,000 alarms at a time so you might want to make a rule to prune down the alarms.
def alarmSvc = server.AlarmService; def LOG = org.apache.log4j.Logger.getLogger("Alarm Purge Rule") def now = new Date(); def cutoff = now - 180; def Anchor = now - 2000; def alarms = alarmSvc.getAlarms(Anchor, cutoff); for (alarm in alarms) { alarmSvc.purgeAlarm(alarm.getID()); } LOG.info("Purged " + alarms.size() + " alarms older than " + cutoff); return "Purged " + alarms.size() + " alarms older than " + cutoff;

vFoglight Count Alarms (Groovy Script)

Using the script editor located in Administration > Tooling > Script Console. Best to go ahead and save these for running at a later date when you need them.
import groovy.sql.Sql; import com.quest.nitro.service.util.JDBCHelper; msg = new StringBuilder(); try{ sql = new Sql(JDBCHelper.getDataSource()); msg.append("Alarms Table Count: \n") msg.append(sql.rows("select count(*) from alarm_alarm")); }catch (Exception ex){ msg.append("Exception"+ex); } return msg.toString();