Question1:
How to completely remove Alarms from Foglight?
Question2:
Is it possible to schedule the purging of Alarms?
Note: jmx-console usage only allows the 'foglight' user login. Contact Support if there are difficulties accessing the jmx-console.
Question1: How to Purge Alarms?
Note: All procedures below remove ALL alarm types (all severity, all cleared/uncleared, all acknowledged/unacknowledged) - there is no method to selectively purge Alarm types.
Purge all alarms using jmx-console:
1. http://fms_hostname:8080/jmx-console
2. service=Alarm
3. void purgeAllAlarms( )
4. Invoke
Purge alarms, date range, using jmx-console:
1. http://fms_hostname:8080/jmx-console
2. service=Alarm
3. void purgeAlarms( )
4. P1 - start datetime, P2 - end datetime
in the format: MonthName DayNumber, 4 Digit Year, HH:MM:SS GMT
example: January 1, 2020, 00:00:00 GMT (note purge occurs as of GMT time)
Purge alarms, date range, using script & Script Editor:
1. Go to Admin Console | Tooling | Script Editor | paste the following into 'Script' box | click 'Run' (note:Query or Object ID do NOT have to be filled in):
long now = System.currentTimeMillis()
Calendar threshold = Calendar.getInstance();
threshold .add(Calendar.DATE, -60)
server.get("AlarmService").purgeAlarms(new Date(0), threshold.getTime());
"done in "+(System.currentTimeMillis()-now)/1000+"s"
Purges alarms older than 60 days. To change days, modify the "-60" above before running.
Purge alarms, date range, using script & Command Line:
a. Place the following text into a .groovy file (simple text file). Name it purgeAlarm.groovy and save it in the \FMS_Home\bin\ directory.....
long now = System.currentTimeMillis()
Calendar threshold = Calendar.getInstance();
threshold .add(Calendar.DATE, -60)
server.get("AlarmService").purgeAlarms(new Date(0), threshold.getTime());
"done in "+(System.currentTimeMillis()-now)/1000+"s"
This purges alarms older than 60 days. To change number of days, modify the "-60" above before running.
b. Run the following command at the command prompt. Replace the '-pwd pass' and '-port port' for your environment.
Windows OS:
FMS_Home\bin\> fglcmd -usr foglight -pwd foglight -port 8080 -cmd script:run -f purgeAlarm.groovy
Unix OS:
FMS_Home\bin\> ./fglcmd.sh -usr foglight -pwd foglight -port 8080 -cmd script:run -f purgeAlarm.groovy
Results will show something like "done in 0.218s" if script ran correctly.
c. All Alarms greater than 60 days should now be gone from Alarms dashboards. Note: A few refreshes may be required in the Alarms dashboards for changes to be seen - alternately, sign out of Admin Console and back in, or try changing time ranges and/or filters on Alarms dashboards.
Question2: How to schedule Purge of Alarms?
Use the above procedure, "Purge alarms, date range, using script & Command Line" to create a script and setup the command to run on a scheduled basis in via OS (Windows=scheduled task, Unix=chron job). This can be done by the Operating System admin.
Purge of Alarms/Schedule of Purge from Foglight database also may be done by the database (Oracle or mysql) administrator.
Example for Oracle database, have DBA run/schedule sql statement :
truncate table alarm_alarm
If done/scheduled this way, this process is responsibility of the organization's DBA.
Also see:
SOL40652 - How to Purge Alarms from the GUI? How to Clear Alarms from command line? Do amount of Alarms cause my Alarms dashboard to slow down causing a slow UI?
SOL80646 - Get a count of the total number of Alarms stored in the Foglight database (acknowledged, cleared, current, historical, ect)?.
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center