minor alarm log improvements
Costa Tsaousis (ktsaou) committed
Oct 29, 2016 at 16:36 UTC
54a5aa95836fdbfce7467247f35ac71ba49aa2e7
1 file changed
+67
-3
web/index.html
+67
-3
@@ -1426,7 +1426,17 @@
1426
return;
1427
}
1428
1429
+ function alarmid4human(id) {
1430
+ if(id === 0)
1431
+ return '-';
1432
+
1433
+ return id.toString();
1434
+ }
1435
+
1436
function timestamp4human(timestamp, space) {
1437
+ if(timestamp === 0)
1438
+ return '-';
1439
+
1440
if(typeof space === 'undefined')
1441
space = ' ';
1442
@@ -1738,15 +1748,19 @@
1748
title: 'Event Date',
1749
valign: 'middle',
1750
titleTooltip: 'The date and time the even took place',
1741
- switchable: false,
1742
- sortable: true,
1751
formatter: function(value, row, index) { return timestamp4human(value, ' '); },
1752
+ align: 'center',
1753
+ valign: 'middle',
1754
+ switchable: false,
1755
+ sortable: true
1756
},
1757
{
1758
field: 'hostname',
1759
title: 'Host',
1760
valign: 'middle',
1761
titleTooltip: 'The host that generated this event',
1762
+ align: 'center',
1763
+ valign: 'middle',
1764
visible: false,
1765
sortable: true
1766
},
@@ -1754,6 +1768,8 @@
1768
field: 'unique_id',
1769
title: 'Unique ID',
1770
titleTooltip: 'The host unique ID for this event',
1771
+ formatter: function(value, row, index) { return alarmid4human(value); },
1772
+ align: 'center',
1773
valign: 'middle',
1774
visible: false,
1775
sortable: true
@@ -1762,6 +1778,8 @@
1778
field: 'alarm_id',
1779
title: 'Alarm ID',
1780
titleTooltip: 'The ID of the alarm that generated this event',
1781
+ formatter: function(value, row, index) { return alarmid4human(value); },
1782
+ align: 'center',
1783
valign: 'middle',
1784
visible: false,
1785
sortable: true
@@ -1770,6 +1788,8 @@
1788
field: 'alarm_event_id',
1789
title: 'Alarm Event ID',
1790
titleTooltip: 'The incremental ID of this event for the given alarm',
1791
+ formatter: function(value, row, index) { return alarmid4human(value); },
1792
+ align: 'center',
1793
valign: 'middle',
1794
visible: false,
1795
sortable: true
@@ -1778,6 +1798,7 @@
1798
field: 'chart',
1799
title: 'Chart',
1800
titleTooltip: 'The chart the alarm is attached to',
1801
+ align: 'center',
1802
valign: 'middle',
1803
switchable: false,
1804
sortable: true
@@ -1786,6 +1807,7 @@
1807
field: 'family',
1808
title: 'Family',
1809
titleTooltip: 'The family of the chart the alarm is attached to',
1810
+ align: 'center',
1811
valign: 'middle',
1812
visible: false,
1813
sortable: true
@@ -1797,6 +1819,7 @@
1819
formatter: function(value, row, index) {
1820
return value.toString().replace(/_/g, ' ');
1821
},
1822
+ align: 'center',
1823
valign: 'middle',
1824
switchable: false,
1825
sortable: true
@@ -1805,6 +1828,10 @@
1828
field: 'old_value',
1829
title: 'Old Value',
1830
titleTooltip: 'The value of the alarm, just before this event',
1831
+ formatter: function(value, row, index) {
1832
+ return ((value !== null)?Math.round(value * 100) / 100:'NaN').toString();
1833
+ },
1834
+ align: 'center',
1835
valign: 'middle',
1836
visible: false,
1837
sortable: true
@@ -1814,7 +1841,7 @@
1841
title: 'Value',
1842
titleTooltip: 'The value of the alarm, that triggered this event',
1843
formatter: function(value, row, index) {
1817
- return ((value !== null)?Math.floor(value):'NaN').toString();
1844
+ return ((value !== null)?Math.round(value * 100) / 100:'NaN').toString();
1845
},
1846
align: 'right',
1847
valign: 'middle',
@@ -1824,6 +1851,7 @@
1851
field: 'units',
1852
title: 'Units',
1853
titleTooltip: 'The units of the value of the alarm',
1854
+ align: 'left',
1855
valign: 'middle',
1856
sortable: true
1857
},
@@ -1831,6 +1859,7 @@
1859
field: 'old_status',
1860
title: 'Old Status',
1861
titleTooltip: 'The status of the alarm, just before this event',
1862
+ align: 'center',
1863
valign: 'middle',
1864
visible: false,
1865
sortable: true
@@ -1839,6 +1868,7 @@
1868
field: 'status',
1869
title: 'Status',
1870
titleTooltip: 'The status of the alarm, that was set due to this event',
1871
+ align: 'center',
1872
valign: 'middle',
1873
switchable: false,
1874
sortable: true
@@ -1848,6 +1878,7 @@
1878
title: 'Last Duration',
1879
titleTooltip: 'The duration the alarm was at its previous state, just before this event',
1880
formatter: function(value, row, index) { return seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' }); },
1881
+ align: 'center',
1882
valign: 'middle',
1883
visible: false,
1884
sortable: true
@@ -1857,6 +1888,7 @@
1888
title: 'Raised Duration',
1889
titleTooltip: 'The duration the alarm was raised, just before this event',
1890
formatter: function(value, row, index) { return seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' }); },
1891
+ align: 'center',
1892
valign: 'middle',
1893
visible: false,
1894
sortable: true
@@ -1865,6 +1897,7 @@
1897
field: 'recipient',
1898
title: 'Recipient',
1899
titleTooltip: 'The recipient of this event',
1900
+ align: 'center',
1901
valign: 'middle',
1902
visible: false,
1903
sortable: true
@@ -1873,6 +1906,13 @@
1906
field: 'processed',
1907
title: 'Processed Status',
1908
titleTooltip: 'True when this event is processed',
1909
+ formatter: function(value, row, index) {
1910
+ if(value === true)
1911
+ return 'DONE';
1912
+ else
1913
+ return 'PENDING';
1914
+ },
1915
+ align: 'center',
1916
valign: 'middle',
1917
visible: false,
1918
sortable: true
@@ -1881,6 +1921,13 @@
1921
field: 'updated',
1922
title: 'Updated Status',
1923
titleTooltip: 'True when this event has been updated by another event',
1924
+ formatter: function(value, row, index) {
1925
+ if(value === true)
1926
+ return 'UPDATED';
1927
+ else
1928
+ return 'CURRENT';
1929
+ },
1930
+ align: 'center',
1931
valign: 'middle',
1932
visible: false,
1933
sortable: true
@@ -1889,6 +1936,8 @@
1936
field: 'updated_by_id',
1937
title: 'Updated By ID',
1938
titleTooltip: 'The unique ID of the event that obsoleted this one',
1939
+ formatter: function(value, row, index) { return alarmid4human(value); },
1940
+ align: 'center',
1941
valign: 'middle',
1942
visible: false,
1943
sortable: true
@@ -1897,6 +1946,8 @@
1946
field: 'updates_id',
1947
title: 'Updates ID',
1948
titleTooltip: 'The unique ID of the event obsoleted because of this event',
1949
+ formatter: function(value, row, index) { return alarmid4human(value); },
1950
+ align: 'center',
1951
valign: 'middle',
1952
visible: false,
1953
sortable: true
@@ -1905,6 +1956,7 @@
1956
field: 'exec',
1957
title: 'Script',
1958
titleTooltip: 'The script to handle the event notification',
1959
+ align: 'center',
1960
valign: 'middle',
1961
visible: false,
1962
sortable: true
@@ -1914,6 +1966,7 @@
1966
title: 'Script Run At',
1967
titleTooltip: 'The date and time the script has been ran',
1968
formatter: function(value, row, index) { return timestamp4human(value, ' '); },
1969
+ align: 'center',
1970
valign: 'middle',
1971
visible: false,
1972
sortable: true
@@ -1922,6 +1975,13 @@
1975
field: 'exec_code',
1976
title: 'Script Return Value',
1977
titleTooltip: 'The return code of the script',
1978
+ formatter: function(value, row, index) {
1979
+ if(value === 0)
1980
+ return 'OK (returned 0)';
1981
+ else
1982
+ return 'FAILED (with code ' + value.toString() + ')';
1983
+ },
1984
+ align: 'center',
1985
valign: 'middle',
1986
visible: false,
1987
sortable: true
@@ -1931,6 +1991,7 @@
1991
title: 'Script Delay',
1992
titleTooltip: 'The hysteresis of the notification',
1993
formatter: function(value, row, index) { return seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' }); },
1994
+ align: 'center',
1995
valign: 'middle',
1996
visible: false,
1997
sortable: true
@@ -1940,6 +2001,7 @@
2001
title: 'Script Delay Run At',
2002
titleTooltip: 'The date and time the script should be run, after hysteresis',
2003
formatter: function(value, row, index) { return timestamp4human(value, ' '); },
2004
+ align: 'center',
2005
valign: 'middle',
2006
visible: false,
2007
sortable: true
@@ -1948,6 +2010,7 @@
2010
field: 'info',
2011
title: 'Description',
2012
titleTooltip: 'A short description of the alarm',
2013
+ align: 'center',
2014
valign: 'middle',
2015
visible: false,
2016
sortable: true
@@ -1956,6 +2019,7 @@
2019
field: 'source',
2020
title: 'Alarm Source',
2021
titleTooltip: 'The source of configuration of the alarm',
2022
+ align: 'center',
2023
valign: 'middle',
2024
visible: false,
2025
sortable: true