tof_dataclasses/
alerts.rs

1//! The alerts are just clues to trigger an individual to respond to a certain situation
2//!
3
4// kudos Grace!! (who else ^^ ) 
5//so these are the alerts relating to the tof:
6//-- RB rate = 0 (and if its two we'll know a RAT crashed)
7//-- RB temp (from RBMoni)  too cold < -40C
8//-- RB temp (from RBMoni) too warm > 80C
9//-- RAT labjack temp too cold < -40C
10//-- RAT labjack temp too warm > 80C
11//-- CAT labjack temp too cold < ?
12//-- CAT labjack temp too warm > ?
13//-- tofcpu temp too cold (from db?) < -40C
14//-- tofcpu temp too warm (from db?) > 95C
15//-- tofcpu temp too cold (CPUMoni) < -40C
16//-- tofcpu temp too warm (CPUMoni) > 95C
17//-- MTB FPGA temp too cold (MTBMoni) < -40C
18//-- MTB FPGA temp too warm (MTBMoni) > 80C
19//-- tofcpu cpu usage (from db?) > 90%
20//-- MTB rate (db) > depends
21//-- MTB rate (db) == 0
22//-- MTB lost rate (db) > MTB rate
23
24use std::fmt;
25use std::collections::HashMap;
26
27use std::time::Instant;
28use std::fs::File;
29use std::io::{
30  Read,
31  Write
32};
33
34use serde_json::json;
35
36use crate::serialization::SerializationError;
37
38/// helper function to parse output for TofBot
39fn remove_from_word(s: String, word: &str) -> String {
40  if let Some(index) = s.find(word) {
41    // Keep everything up to the found index (not including the word itself)
42    s[..index].to_string()
43  } else {
44    // If the word isn't found, return the original string
45    s
46  }
47}
48
49/// How did whatever went wrong,
50/// go bad?
51#[derive(Debug, Copy, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
52pub enum OutOfBound {
53  TooHigh,
54  TooLow,
55  TooLowOrTooHigh,
56  TooOld,
57  Zero,
58  Unknown,
59}
60
61impl fmt::Display for OutOfBound {
62  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63    let repr : &str;
64    match self {
65      OutOfBound::Unknown         => repr = "Unknown",
66      OutOfBound::TooHigh         => repr = "TooHigh",
67      OutOfBound::TooLowOrTooHigh => repr = "TooLowOrTooHigh",
68      OutOfBound::TooLow          => repr = "TooLow",
69      OutOfBound::TooOld          => repr = "TooOld",
70      OutOfBound::Zero            => repr = "Zero",
71    };
72    write!(f, "{}", repr)
73  }
74}
75
76#[derive(Debug, Copy, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
77pub enum Shifters {
78  Unknown,
79  Grace,
80  Kazu,
81  Achim,
82  TofBot,
83}
84
85pub trait Pageable {
86  fn page(&self, content : String);
87
88  fn resolve(&self) {
89  }
90}
91
92impl fmt::Display for Shifters {
93  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
94    let repr : &str;
95    match self {
96      Shifters::Unknown => repr = "Unknown",
97      Shifters::Grace   => repr = "Grace",
98      Shifters::Kazu    => repr = "Kazu",
99      Shifters::Achim   => repr = "Achim",
100      Shifters::TofBot  => repr = "TofBot",
101    };
102    write!(f, "{}", repr)
103  }
104}
105
106impl Pageable for Shifters {
107
108  fn page(&self, content : String) {
109    match self {
110      Shifters::Grace => {
111      }
112      Shifters::Kazu  => {
113      }
114      Shifters::Achim => {
115      }
116      Shifters::TofBot => {
117        // currently silence TofBot
118        // Achim's channel
119        //let url     = "https://hooks.slack.com/services/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";
120        // TofBot channel
121        //let url     = "https://hooks.slack.com/services/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";
122        let message = format!("\u{1F916}\u{1F680}\u{1F388} [LIFTOF (Bot)]\n {}",content);
123        let clean_message = remove_from_word(message, "tofbot_webhook");
124        let data = json!({
125          "text" : clean_message
126        });
127        match serde_json::to_string(&data) {
128          Err(err) => {
129            error!("Can not convert .json to string! {err}");
130          }
131          Ok(data_string) => {
132            warn!("Alert system disabled! Not paging TofBot with {}", data_string);
133        //    match ureq::post(url)
134        //        .set("Content-Type", "application/json")
135        //        .send_string(&data_string) {
136        //      Err(err) => { 
137        //        error!("Unable to send {} to TofBot! {err}", data_string);
138        //      }
139        //      Ok(response) => {
140        //        match response.into_string() {
141        //          Err(err) => {
142        //            error!("Not able to read response! {err}");
143        //          }
144        //          Ok(body) => {
145        //            info!("TofBot responded with {}", body);
146        //          }
147        //        }
148        //      }
149        //    }
150          }
151        }
152      }
153      _ => error!("Can't page unknown shifter!"),
154    }
155  }
156
157
158  fn resolve(&self) {
159    match self {
160      Shifters::Grace => {
161      }
162      Shifters::Kazu  => {
163      }
164      Shifters::Achim => {
165      }
166      Shifters::TofBot => {
167      }
168      _ => error!("Can't page unknown shifter!"),
169    }
170  }
171}
172
173/// How did whatever went wrong,
174/// go bad?
175#[derive(Debug, Copy, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
176pub enum Variable {
177  Unknown,
178  TriggerRate,
179  Telemetry,
180  LostTriggerRate,
181  FPGATemp,
182  CoreTemp,
183  LabjackTemp,
184  AvailableDiskSpace,
185  DataMangling,
186  MoniData,
187}
188
189impl fmt::Display for Variable {
190  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
191    let repr : &str;
192    match self {
193      Variable::Unknown            => repr = "Unknown",
194      Variable::TriggerRate        => repr = "TriggerRate",
195      Variable::Telemetry          => repr = "Telemetry",
196      Variable::LostTriggerRate    => repr = "LostTriggerRate",
197      Variable::CoreTemp           => repr = "CoreTemp",
198      Variable::FPGATemp           => repr = "FPGATemp",
199      Variable::LabjackTemp        => repr = "LabjackTemp",
200      Variable::AvailableDiskSpace => repr = "AvailableDiskSpace",
201      Variable::DataMangling       => repr = "DataMangling",
202      Variable::MoniData           => repr = "MoniData",
203    };
204    write!(f, "{}", repr)
205  }
206}
207
208/// How did whatever went wrong,
209/// go bad?
210#[derive(Debug, Copy, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
211pub enum Component {
212  MTB,
213  CPU,
214  CAT,
215  System,
216  RAT(u8),
217  RB(u8),
218}
219
220impl fmt::Display for Component {
221  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
222    let repr : String;
223    match self {
224      Component::MTB      => repr = String::from("MTB"),
225      Component::CPU      => repr = String::from("CPU"),
226      Component::CAT      => repr = String::from("CAT"),
227      Component::RAT(rid) => repr = format!("RAT{:02}", rid),
228      Component::RB(rid)  => repr = format!("RB{:02}", rid),
229      Component::System   => repr = String::from("System"),
230    };
231    write!(f, "{}", repr)
232  }
233}
234
235
236
237/// Alerts are clues to trigger a 
238/// reaction of an individual, so 
239/// they are designed for humans, 
240/// but should be issued by a 
241/// machine
242///
243/// ISSUES: The design choice of going with 
244/// a &str here and carry the livetime around
245/// is admittedly a bit questionable, especially
246/// since we might want to create similar 
247/// alerts automatically (which I did not think 
248/// of earlier)
249#[derive(Debug, Clone)]
250pub struct TofAlert<'a> {
251  /// a unique identifier so that we can 
252  /// look this up in settings
253  pub key          : &'a str,
254  /// description of what had happened
255  pub descr        : &'a str,
256  /// recommended course of action
257  pub whattodo     : Vec<&'a str>,
258  /// The configurable part of the alerm, 
259  /// subscirbers, bounds and is the alarm 
260  /// armed
261  pub config       : TofAlertConfig,
262  /// The variable which is an issue, e.g Rate
263  pub variable     : Variable,
264  /// The part of the TofSystem which caused the 
265  /// issue
266  pub component    : Component, 
267  /// How did the variable get out-of-bounds? 
268  /// E.g. too high, too low?
269  pub outofbound   : OutOfBound,
270  /// When did this issue occur?
271  pub triggered    : Option<Instant>,
272  /// How often did this alert page?
273  pub n_paged      : u32,
274}
275
276impl TofAlert<'_> {
277  
278  pub fn acknowledge(&mut self) {
279    self.triggered = None;
280  }
281
282  pub fn has_triggered(&self) -> bool {
283    self.triggered.is_some()
284  }
285
286  //pub fn annoy(&self) {
287  //  if self.triggered.is_some() && self.armed {
288  //    for person in &self.config.subscribers {
289  //      person.page();
290  //    }
291  //  }
292  //}
293  pub fn format_page(&self) -> String {
294    let mut page_text = format!("<< Alert {} triggered!\n", self.key);
295    page_text += &self.get_text();
296    page_text += ">>";
297    page_text
298  }
299
300  pub fn get_text(&self) -> String {
301    let mut repr = format!("< {} | {} | {}", self.component, self.variable, self.outofbound);
302    //repr    += &(format!(" -- descr : {}", self.descr));
303    //repr    += &(format!(" -- action: {}", self.whattodo));
304    //repr    += &(format!(" -- pages : "));
305    //for shifter in &self.subscribers {
306    //  repr += &(format!(" {} ", shifter)); 
307    //}
308    repr    += ">";
309    repr
310  }
311  //pub fn new() -> Self {
312  //  Self {
313  //    message      : String::from(""),
314  //    variable     :
315  //    outofbound   : OutOfBound::Unknown,
316  //    acknowledged : false
317  //  }
318  //}
319
320  // FIXME find a solution for the unwraps
321  pub fn trigger(&mut self, val : f32) {
322    let mut triggered = false;
323    match self.outofbound {
324      OutOfBound::TooHigh => {
325        match self.config.max_allowed {
326          None => {
327            error!("Set condition for {} as 'TooHigh', but 'max_allowed' is not specified", self.key);
328          }
329          Some(max_allowed) => {
330            if val > max_allowed {
331              warn!("Alarm {} triggered at {}!", self.key, max_allowed);
332              triggered = true;
333            }
334          }
335        }
336      }
337      OutOfBound::TooLow  => {
338        match self.config.min_allowed {
339          None => {
340            error!("Set condition for {} as 'TooLow', but 'min_allowed' is not specified", self.key);
341          }
342          Some(min_allowed) => {
343            if val < min_allowed {
344              warn!("Alarm {} triggered at {}!", self.key, min_allowed);
345              triggered = true;
346            }
347          }
348        }
349      }
350      OutOfBound::TooLowOrTooHigh => {
351        if val < self.config.min_allowed.unwrap() 
352        || val > self.config.max_allowed.unwrap() {
353          //warn!("Alarm {} triggered at {}!", self.key, max_allowed);
354          triggered = true;
355        }
356      }
357      OutOfBound::TooOld  => {
358        match self.config.max_allowed {
359          None => {
360            error!("Set condition for {} as 'TooOld', but 'max_allowed' is not specified", self.key);
361          }
362          Some(max_allowed) => {
363            if val > max_allowed {
364              warn!("Alarm {} triggered at {}!", self.key, max_allowed);
365              triggered = true;
366            }
367          }
368        }
369      }
370      OutOfBound::Zero    => {
371        if val == 0.0 {
372          triggered = true;
373        }
374      }
375      OutOfBound::Unknown => (),  
376    }
377    if triggered {
378      self.triggered = Some(Instant::now());
379    }
380  }
381 
382  pub fn page(&mut self) {
383    let content = self.format_page();
384    self.n_paged += 1;
385    for person in &self.config.subscribers {
386      match person {
387        Shifters::TofBot => {
388          // always page TofBot
389          person.page(content.clone());
390        }
391        _ => {
392          if self.config.armed {
393            // person who might need sleep, only 
394            // page them when the alert is armed
395            person.page(content.clone());
396          }
397        }
398      }
399    }
400  }
401
402
403  pub fn configure_from_manifest(&mut self, manifest : &TofAlertManifest)  {
404    match manifest.get(self.key) {
405      Some(cfg) => {
406        self.config = cfg;
407      }
408      None => {
409        error!("No entry for {} found in the alert manifest!", self.key);
410      }
411    }
412  }
413}
414
415impl PartialEq for TofAlert<'_> {
416  fn eq(&self, other: &Self) -> bool {
417    self.variable      == other.variable
418    && self.component  == other.component
419    && self.outofbound == other.outofbound
420  }
421}
422
423impl fmt::Display for TofAlert<'_> {
424  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
425    let repr = self.get_text();
426    write!(f, "{}", repr)
427  }
428}
429
430///// Create the temperature and rate alerts for a RB
431//pub fn alert_factory_rb<'a>(rb_id      : u8) -> (TofAlert<'a>, TofAlert<'a>) {
432//  let rate_alert = TofAlert {
433//    key          : &(format!("RB{:02}_rate_zero", rb_id)),
434//    descr        : &(format!("RB{:02} is not triggering!", rb_id)),
435//    whattodo     : vec!["1) Run restart", "2) Restart liftof-rb", "3) Soft reboot RB", "4) Soft reboot MTB", "5) Hard reboot RAT",  "6) Hard reboot MTB"],
436//    config       : TofAlertConfig::new(),
437//    variable     : Variable::TriggerRate,
438//    outofbound   : OutOfBound::Zero,
439//    component    : Component::RB(rb_id),
440//    triggered    : None,
441//  };
442//  
443//  let temp_alert = TofAlert {
444//    key          : format!("RB{:02}_temp", rb_id).as_str(),
445//    descr        : format!("RB{:02} (FPGA) temperature is out of bounds!", rb_id).as_str(),
446//    whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
447//    config       : TofAlertConfig::new(),
448//    variable     : Variable::TriggerRate,
449//    outofbound   : OutOfBound::Zero,
450//    component    : Component::RB(rb_id),
451//    triggered    : None,
452//  };
453//  (rate_alert, temp_alert)
454//}
455
456
457
458//}
459//
460///// Create an alert for mtb temperature out of range
461//pub fn alert_factory_rb_temp<'a>(rb_id       : u8,
462//                                 subscribers : Vec<Shifters>,
463//                                 outofbound  : OutOfBound) -> TofAlert<'a> {
464//  TofAlert {
465//    key          : "rb_temp",
466//    descr        : "RB (FPGA) Temperature out of bounds!!",
467//    whattodo     : vec!["This is critical! Check with everyone and then shut off this RB!"],
468//    config       : TofAlertConfig::new(),
469//    variable     : Variable::FPGATemp,
470//    outofbound   : outofbound,
471//    component    : Component::RB(rb_id),
472//    acknowledged : false,
473//    created      : Instant::now(),
474//  }
475//}
476//
477///// Create an alert for the case where the MTB is not triggering
478//pub fn alert_factory_mtb_rate_zero<'a>(subscribers : Vec<Shifters>) -> TofAlert<'a> {
479//  TofAlert {
480//    key          : "mtb_rate_zero",
481//    descr        : "MTB is not triggering!",
482//    whattodo     : vec!["1) Check about TIU status", "2) Run restart", "3) If SSH available, debug with pybindings", "4) Soft reboot MTB", "5) Hard reboot MTB"],
483//    config       : TofAlertConfig::new(),
484//    variable     : Variable::TriggerRate,
485//    outofbound   : OutOfBound::Zero,
486//    component    : Component::MTB,
487//    acknowledged : false,
488//    created      : Instant::now(),
489//  }
490//}
491//
492///// Create an alert for mtb temperature out of range
493//pub fn alert_factory_mtb_temp<'a>(subscribers : Vec<Shifters>,
494//                                  outofbound  : OutOfBound) -> TofAlert<'a> {
495//  TofAlert {
496//    key          : "mtb_fpga_temp",
497//    descr        : "MTB Temperature out of bounds!!",
498//    whattodo     : vec!["This is critical! Check with everyone and then shut off the MTB!"],
499//    config       : TofAlertConfig::new(),
500//    variable     : Variable::FPGATemp,
501//    outofbound   : outofbound,
502//    component    : Component::MTB,
503//    acknowledged : false,
504//    created      : Instant::now(),
505//  }
506//}
507//
508///// Create an alert for mtb temperature out of range
509//pub fn alert_factory_mtb_lost_rate<'a>(subscribers : Vec<Shifters>,
510//                                       outofbound  : OutOfBound) -> TofAlert<'a> {
511//  TofAlert {
512//    key          : "mtb_lost_rate",
513//    descr        : "MTB Lost rate is whacky!!",
514//    whattodo     : vec!["Unclear course of action. Check with tracker, maybe nothing can be done!"],
515//    config       : TofAlertConfig::new(),
516//    variable     : Variable::LostTriggerRate,
517//    outofbound   : outofbound,
518//    component    : Component::MTB,
519//    acknowledged : false,
520//    created      : Instant::now(),
521//  }
522//}
523
524/// Configure alerts from a .toml file
525#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
526pub struct TofAlertConfig {
527  pub subscribers : Vec<Shifters>,
528  pub armed       : bool,
529  pub min_allowed : Option<f32>,
530  pub max_allowed : Option<f32>,
531  pub non_zero    : Option<bool>,
532}
533
534impl TofAlertConfig {
535  pub fn new() -> Self {
536    Self {
537      subscribers : vec![Shifters::Grace,
538                         Shifters::Kazu,
539                         Shifters::Achim,
540                         Shifters::TofBot],
541      armed       : false,
542      min_allowed : Some(-40.0),
543      max_allowed : Some(80.0),
544      non_zero    : Some(false),
545    }
546  }
547}
548
549
550
551/// Describes a .toml file with alert. 
552/// settings
553#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
554pub struct TofAlertManifest {
555  pub data_mangling   : TofAlertConfig,
556  pub miss_tofevid    : TofAlertConfig,
557  pub tofev_vs_merge  : TofAlertConfig,
558  pub notof_vs_merge  : TofAlertConfig,
559  pub frac_interest   : TofAlertConfig,
560  pub mtb_lost_rate   : TofAlertConfig,
561  pub mtb_fpga_temp   : TofAlertConfig,
562  pub mtb_rate_zero   : TofAlertConfig,
563  pub mtb_hk_too_old  : TofAlertConfig,
564  pub cpu_core0_temp  : TofAlertConfig,
565  pub cpu_core1_temp  : TofAlertConfig,
566  pub cpu_hk_too_old  : TofAlertConfig,
567  pub cpu_disk        : TofAlertConfig,
568  pub rb01_temp       : TofAlertConfig,
569  pub rb02_temp       : TofAlertConfig,  
570  pub rb03_temp       : TofAlertConfig,  
571  pub rb04_temp       : TofAlertConfig, 
572  pub rb05_temp       : TofAlertConfig, 
573  pub rb06_temp       : TofAlertConfig, 
574  pub rb07_temp       : TofAlertConfig,
575  pub rb08_temp       : TofAlertConfig, 
576  pub rb09_temp       : TofAlertConfig, 
577  pub rb11_temp       : TofAlertConfig, 
578  pub rb13_temp       : TofAlertConfig,
579  pub rb14_temp       : TofAlertConfig, 
580  pub rb15_temp       : TofAlertConfig, 
581  pub rb16_temp       : TofAlertConfig, 
582  pub rb17_temp       : TofAlertConfig, 
583  pub rb18_temp       : TofAlertConfig, 
584  pub rb19_temp       : TofAlertConfig, 
585  pub rb20_temp       : TofAlertConfig, 
586  pub rb21_temp       : TofAlertConfig, 
587  pub rb22_temp       : TofAlertConfig, 
588  pub rb23_temp       : TofAlertConfig, 
589  pub rb24_temp       : TofAlertConfig, 
590  pub rb25_temp       : TofAlertConfig, 
591  pub rb26_temp       : TofAlertConfig, 
592  pub rb27_temp       : TofAlertConfig, 
593  pub rb28_temp       : TofAlertConfig, 
594  pub rb29_temp       : TofAlertConfig, 
595  pub rb30_temp       : TofAlertConfig, 
596  pub rb31_temp       : TofAlertConfig, 
597  pub rb32_temp       : TofAlertConfig, 
598  pub rb33_temp       : TofAlertConfig, 
599  pub rb34_temp       : TofAlertConfig, 
600  pub rb35_temp       : TofAlertConfig, 
601  pub rb36_temp       : TofAlertConfig, 
602  pub rb39_temp       : TofAlertConfig, 
603  pub rb40_temp       : TofAlertConfig, 
604  pub rb41_temp       : TofAlertConfig, 
605  pub rb42_temp       : TofAlertConfig, 
606  pub rb44_temp       : TofAlertConfig, 
607  pub rb46_temp       : TofAlertConfig, 
608  pub rb01_rate_zero  : TofAlertConfig, 
609  pub rb02_rate_zero  : TofAlertConfig,  
610  pub rb03_rate_zero  : TofAlertConfig,  
611  pub rb04_rate_zero  : TofAlertConfig, 
612  pub rb05_rate_zero  : TofAlertConfig, 
613  pub rb06_rate_zero  : TofAlertConfig, 
614  pub rb07_rate_zero  : TofAlertConfig, 
615  pub rb08_rate_zero  : TofAlertConfig, 
616  pub rb09_rate_zero  : TofAlertConfig, 
617  pub rb11_rate_zero  : TofAlertConfig, 
618  pub rb13_rate_zero  : TofAlertConfig, 
619  pub rb14_rate_zero  : TofAlertConfig, 
620  pub rb15_rate_zero  : TofAlertConfig, 
621  pub rb16_rate_zero  : TofAlertConfig, 
622  pub rb17_rate_zero  : TofAlertConfig, 
623  pub rb18_rate_zero  : TofAlertConfig, 
624  pub rb19_rate_zero  : TofAlertConfig, 
625  pub rb20_rate_zero  : TofAlertConfig, 
626  pub rb21_rate_zero  : TofAlertConfig, 
627  pub rb22_rate_zero  : TofAlertConfig, 
628  pub rb23_rate_zero  : TofAlertConfig, 
629  pub rb24_rate_zero  : TofAlertConfig, 
630  pub rb25_rate_zero  : TofAlertConfig, 
631  pub rb26_rate_zero  : TofAlertConfig, 
632  pub rb27_rate_zero  : TofAlertConfig, 
633  pub rb28_rate_zero  : TofAlertConfig, 
634  pub rb29_rate_zero  : TofAlertConfig, 
635  pub rb30_rate_zero  : TofAlertConfig, 
636  pub rb31_rate_zero  : TofAlertConfig, 
637  pub rb32_rate_zero  : TofAlertConfig, 
638  pub rb33_rate_zero  : TofAlertConfig, 
639  pub rb34_rate_zero  : TofAlertConfig, 
640  pub rb35_rate_zero  : TofAlertConfig, 
641  pub rb36_rate_zero  : TofAlertConfig, 
642  pub rb39_rate_zero  : TofAlertConfig, 
643  pub rb40_rate_zero  : TofAlertConfig, 
644  pub rb41_rate_zero  : TofAlertConfig, 
645  pub rb42_rate_zero  : TofAlertConfig, 
646  pub rb44_rate_zero  : TofAlertConfig, 
647  pub rb46_rate_zero  : TofAlertConfig, 
648  pub rb01_hk_too_old : TofAlertConfig, 
649  pub rb02_hk_too_old : TofAlertConfig,  
650  pub rb03_hk_too_old : TofAlertConfig,  
651  pub rb04_hk_too_old : TofAlertConfig, 
652  pub rb05_hk_too_old : TofAlertConfig, 
653  pub rb06_hk_too_old : TofAlertConfig, 
654  pub rb07_hk_too_old : TofAlertConfig, 
655  pub rb08_hk_too_old : TofAlertConfig, 
656  pub rb09_hk_too_old : TofAlertConfig, 
657  pub rb11_hk_too_old : TofAlertConfig, 
658  pub rb13_hk_too_old : TofAlertConfig, 
659  pub rb14_hk_too_old : TofAlertConfig, 
660  pub rb15_hk_too_old : TofAlertConfig, 
661  pub rb16_hk_too_old : TofAlertConfig, 
662  pub rb17_hk_too_old : TofAlertConfig, 
663  pub rb18_hk_too_old : TofAlertConfig, 
664  pub rb19_hk_too_old : TofAlertConfig, 
665  pub rb20_hk_too_old : TofAlertConfig, 
666  pub rb21_hk_too_old : TofAlertConfig, 
667  pub rb22_hk_too_old : TofAlertConfig, 
668  pub rb23_hk_too_old : TofAlertConfig, 
669  pub rb24_hk_too_old : TofAlertConfig, 
670  pub rb25_hk_too_old : TofAlertConfig, 
671  pub rb26_hk_too_old : TofAlertConfig, 
672  pub rb27_hk_too_old : TofAlertConfig, 
673  pub rb28_hk_too_old : TofAlertConfig, 
674  pub rb29_hk_too_old : TofAlertConfig, 
675  pub rb30_hk_too_old : TofAlertConfig, 
676  pub rb31_hk_too_old : TofAlertConfig, 
677  pub rb32_hk_too_old : TofAlertConfig, 
678  pub rb33_hk_too_old : TofAlertConfig, 
679  pub rb34_hk_too_old : TofAlertConfig, 
680  pub rb35_hk_too_old : TofAlertConfig, 
681  pub rb36_hk_too_old : TofAlertConfig, 
682  pub rb39_hk_too_old : TofAlertConfig, 
683  pub rb40_hk_too_old : TofAlertConfig, 
684  pub rb41_hk_too_old : TofAlertConfig, 
685  pub rb42_hk_too_old : TofAlertConfig, 
686  pub rb44_hk_too_old : TofAlertConfig, 
687  pub rb46_hk_too_old : TofAlertConfig, 
688}
689
690impl TofAlertManifest {
691  pub fn new() -> Self {
692    Self {
693      data_mangling   : TofAlertConfig::new(),
694      miss_tofevid    : TofAlertConfig::new(),
695      tofev_vs_merge  : TofAlertConfig::new(),
696      notof_vs_merge  : TofAlertConfig::new(),
697      frac_interest   : TofAlertConfig::new(),
698      mtb_lost_rate   : TofAlertConfig::new(),
699      mtb_fpga_temp   : TofAlertConfig::new(),
700      mtb_rate_zero   : TofAlertConfig::new(),
701      mtb_hk_too_old  : TofAlertConfig::new(),
702      cpu_core0_temp  : TofAlertConfig::new(),
703      cpu_core1_temp  : TofAlertConfig::new(),
704      cpu_hk_too_old  : TofAlertConfig::new(),
705      cpu_disk        : TofAlertConfig::new(),
706      rb01_temp       : TofAlertConfig::new(),
707      rb02_temp       : TofAlertConfig::new(),  
708      rb03_temp       : TofAlertConfig::new(),  
709      rb04_temp       : TofAlertConfig::new(), 
710      rb05_temp       : TofAlertConfig::new(), 
711      rb06_temp       : TofAlertConfig::new(), 
712      rb07_temp       : TofAlertConfig::new(),
713      rb08_temp       : TofAlertConfig::new(), 
714      rb09_temp       : TofAlertConfig::new(), 
715      rb11_temp       : TofAlertConfig::new(), 
716      rb13_temp       : TofAlertConfig::new(),
717      rb14_temp       : TofAlertConfig::new(), 
718      rb15_temp       : TofAlertConfig::new(), 
719      rb16_temp       : TofAlertConfig::new(), 
720      rb17_temp       : TofAlertConfig::new(), 
721      rb18_temp       : TofAlertConfig::new(), 
722      rb19_temp       : TofAlertConfig::new(), 
723      rb20_temp       : TofAlertConfig::new(), 
724      rb21_temp       : TofAlertConfig::new(), 
725      rb22_temp       : TofAlertConfig::new(), 
726      rb23_temp       : TofAlertConfig::new(), 
727      rb24_temp       : TofAlertConfig::new(), 
728      rb25_temp       : TofAlertConfig::new(), 
729      rb26_temp       : TofAlertConfig::new(), 
730      rb27_temp       : TofAlertConfig::new(), 
731      rb28_temp       : TofAlertConfig::new(), 
732      rb29_temp       : TofAlertConfig::new(), 
733      rb30_temp       : TofAlertConfig::new(), 
734      rb31_temp       : TofAlertConfig::new(), 
735      rb32_temp       : TofAlertConfig::new(), 
736      rb33_temp       : TofAlertConfig::new(), 
737      rb34_temp       : TofAlertConfig::new(), 
738      rb35_temp       : TofAlertConfig::new(), 
739      rb36_temp       : TofAlertConfig::new(), 
740      rb39_temp       : TofAlertConfig::new(), 
741      rb40_temp       : TofAlertConfig::new(), 
742      rb41_temp       : TofAlertConfig::new(), 
743      rb42_temp       : TofAlertConfig::new(), 
744      rb44_temp       : TofAlertConfig::new(), 
745      rb46_temp       : TofAlertConfig::new(), 
746      rb01_rate_zero  : TofAlertConfig::new(), 
747      rb02_rate_zero  : TofAlertConfig::new(),  
748      rb03_rate_zero  : TofAlertConfig::new(),  
749      rb04_rate_zero  : TofAlertConfig::new(), 
750      rb05_rate_zero  : TofAlertConfig::new(), 
751      rb06_rate_zero  : TofAlertConfig::new(), 
752      rb07_rate_zero  : TofAlertConfig::new(), 
753      rb08_rate_zero  : TofAlertConfig::new(), 
754      rb09_rate_zero  : TofAlertConfig::new(), 
755      rb11_rate_zero  : TofAlertConfig::new(), 
756      rb13_rate_zero  : TofAlertConfig::new(), 
757      rb14_rate_zero  : TofAlertConfig::new(), 
758      rb15_rate_zero  : TofAlertConfig::new(), 
759      rb16_rate_zero  : TofAlertConfig::new(), 
760      rb17_rate_zero  : TofAlertConfig::new(), 
761      rb18_rate_zero  : TofAlertConfig::new(), 
762      rb19_rate_zero  : TofAlertConfig::new(), 
763      rb20_rate_zero  : TofAlertConfig::new(), 
764      rb21_rate_zero  : TofAlertConfig::new(), 
765      rb22_rate_zero  : TofAlertConfig::new(), 
766      rb23_rate_zero  : TofAlertConfig::new(), 
767      rb24_rate_zero  : TofAlertConfig::new(), 
768      rb25_rate_zero  : TofAlertConfig::new(), 
769      rb26_rate_zero  : TofAlertConfig::new(), 
770      rb27_rate_zero  : TofAlertConfig::new(), 
771      rb28_rate_zero  : TofAlertConfig::new(), 
772      rb29_rate_zero  : TofAlertConfig::new(), 
773      rb30_rate_zero  : TofAlertConfig::new(), 
774      rb31_rate_zero  : TofAlertConfig::new(), 
775      rb32_rate_zero  : TofAlertConfig::new(), 
776      rb33_rate_zero  : TofAlertConfig::new(), 
777      rb34_rate_zero  : TofAlertConfig::new(), 
778      rb35_rate_zero  : TofAlertConfig::new(), 
779      rb36_rate_zero  : TofAlertConfig::new(), 
780      rb39_rate_zero  : TofAlertConfig::new(), 
781      rb40_rate_zero  : TofAlertConfig::new(), 
782      rb41_rate_zero  : TofAlertConfig::new(), 
783      rb42_rate_zero  : TofAlertConfig::new(), 
784      rb44_rate_zero  : TofAlertConfig::new(), 
785      rb46_rate_zero  : TofAlertConfig::new(), 
786      rb01_hk_too_old : TofAlertConfig::new(), 
787      rb02_hk_too_old : TofAlertConfig::new(),  
788      rb03_hk_too_old : TofAlertConfig::new(),  
789      rb04_hk_too_old : TofAlertConfig::new(), 
790      rb05_hk_too_old : TofAlertConfig::new(), 
791      rb06_hk_too_old : TofAlertConfig::new(), 
792      rb07_hk_too_old : TofAlertConfig::new(), 
793      rb08_hk_too_old : TofAlertConfig::new(), 
794      rb09_hk_too_old : TofAlertConfig::new(), 
795      rb11_hk_too_old : TofAlertConfig::new(), 
796      rb13_hk_too_old : TofAlertConfig::new(), 
797      rb14_hk_too_old : TofAlertConfig::new(), 
798      rb15_hk_too_old : TofAlertConfig::new(), 
799      rb16_hk_too_old : TofAlertConfig::new(), 
800      rb17_hk_too_old : TofAlertConfig::new(), 
801      rb18_hk_too_old : TofAlertConfig::new(), 
802      rb19_hk_too_old : TofAlertConfig::new(), 
803      rb20_hk_too_old : TofAlertConfig::new(), 
804      rb21_hk_too_old : TofAlertConfig::new(), 
805      rb22_hk_too_old : TofAlertConfig::new(), 
806      rb23_hk_too_old : TofAlertConfig::new(), 
807      rb24_hk_too_old : TofAlertConfig::new(), 
808      rb25_hk_too_old : TofAlertConfig::new(), 
809      rb26_hk_too_old : TofAlertConfig::new(), 
810      rb27_hk_too_old : TofAlertConfig::new(), 
811      rb28_hk_too_old : TofAlertConfig::new(), 
812      rb29_hk_too_old : TofAlertConfig::new(), 
813      rb30_hk_too_old : TofAlertConfig::new(), 
814      rb31_hk_too_old : TofAlertConfig::new(), 
815      rb32_hk_too_old : TofAlertConfig::new(), 
816      rb33_hk_too_old : TofAlertConfig::new(), 
817      rb34_hk_too_old : TofAlertConfig::new(), 
818      rb35_hk_too_old : TofAlertConfig::new(), 
819      rb36_hk_too_old : TofAlertConfig::new(), 
820      rb39_hk_too_old : TofAlertConfig::new(), 
821      rb40_hk_too_old : TofAlertConfig::new(), 
822      rb41_hk_too_old : TofAlertConfig::new(), 
823      rb42_hk_too_old : TofAlertConfig::new(), 
824      rb44_hk_too_old : TofAlertConfig::new(), 
825      rb46_hk_too_old : TofAlertConfig::new(), 
826    }
827  }
828
829  pub fn keys(&self) -> Vec<&'static str> {
830    let keys = vec!["data_mangling",  
831                    "miss_tofevid",   
832                    "tofev_vs_merge", 
833                    "notof_vs_merge", 
834                    "frac_interest",  
835                    "mtb_lost_rate",
836                    "mtb_fpga_temp",
837                    "mtb_rate_zero",
838                    "mtb_hk_too_old",
839                    "cpu_core0_temp",
840                    "cpu_core1_temp",
841                    "cpu_hk_too_old",
842                    "cpu_disk",
843                    "rb01_temp",
844                    "rb02_temp",  
845                    "rb03_temp",  
846                    "rb04_temp", 
847                    "rb05_temp", 
848                    "rb06_temp", 
849                    "rb07_temp",
850                    "rb08_temp", 
851                    "rb09_temp", 
852                    "rb11_temp", 
853                    "rb13_temp",
854                    "rb14_temp", 
855                    "rb15_temp", 
856                    "rb16_temp", 
857                    "rb17_temp", 
858                    "rb18_temp", 
859                    "rb19_temp", 
860                    "rb20_temp", 
861                    "rb21_temp", 
862                    "rb22_temp", 
863                    "rb23_temp", 
864                    "rb24_temp", 
865                    "rb25_temp", 
866                    "rb26_temp", 
867                    "rb27_temp", 
868                    "rb28_temp", 
869                    "rb29_temp", 
870                    "rb30_temp", 
871                    "rb31_temp", 
872                    "rb32_temp", 
873                    "rb33_temp", 
874                    "rb34_temp", 
875                    "rb35_temp", 
876                    "rb36_temp", 
877                    "rb39_temp", 
878                    "rb40_temp", 
879                    "rb41_temp", 
880                    "rb42_temp", 
881                    "rb44_temp", 
882                    "rb46_temp", 
883                    "rb01_rate_zero", 
884                    "rb02_rate_zero",  
885                    "rb03_rate_zero",  
886                    "rb04_rate_zero", 
887                    "rb05_rate_zero", 
888                    "rb06_rate_zero", 
889                    "rb07_rate_zero", 
890                    "rb08_rate_zero", 
891                    "rb09_rate_zero", 
892                    "rb11_rate_zero", 
893                    "rb13_rate_zero", 
894                    "rb14_rate_zero", 
895                    "rb15_rate_zero", 
896                    "rb16_rate_zero", 
897                    "rb17_rate_zero", 
898                    "rb18_rate_zero", 
899                    "rb19_rate_zero", 
900                    "rb20_rate_zero", 
901                    "rb21_rate_zero", 
902                    "rb22_rate_zero", 
903                    "rb23_rate_zero", 
904                    "rb24_rate_zero", 
905                    "rb25_rate_zero", 
906                    "rb26_rate_zero", 
907                    "rb27_rate_zero", 
908                    "rb28_rate_zero", 
909                    "rb29_rate_zero", 
910                    "rb30_rate_zero", 
911                    "rb31_rate_zero", 
912                    "rb32_rate_zero", 
913                    "rb33_rate_zero", 
914                    "rb34_rate_zero", 
915                    "rb35_rate_zero", 
916                    "rb36_rate_zero", 
917                    "rb39_rate_zero", 
918                    "rb40_rate_zero", 
919                    "rb41_rate_zero", 
920                    "rb42_rate_zero", 
921                    "rb44_rate_zero", 
922                    "rb46_rate_zero", 
923                    "rb01_hk_too_old", 
924                    "rb02_hk_too_old",  
925                    "rb03_hk_too_old",  
926                    "rb04_hk_too_old", 
927                    "rb05_hk_too_old", 
928                    "rb06_hk_too_old", 
929                    "rb07_hk_too_old", 
930                    "rb08_hk_too_old", 
931                    "rb09_hk_too_old", 
932                    "rb11_hk_too_old", 
933                    "rb13_hk_too_old", 
934                    "rb14_hk_too_old", 
935                    "rb15_hk_too_old", 
936                    "rb16_hk_too_old", 
937                    "rb17_hk_too_old", 
938                    "rb18_hk_too_old", 
939                    "rb19_hk_too_old", 
940                    "rb20_hk_too_old", 
941                    "rb21_hk_too_old", 
942                    "rb22_hk_too_old", 
943                    "rb23_hk_too_old", 
944                    "rb24_hk_too_old", 
945                    "rb25_hk_too_old", 
946                    "rb26_hk_too_old", 
947                    "rb27_hk_too_old", 
948                    "rb28_hk_too_old", 
949                    "rb29_hk_too_old", 
950                    "rb30_hk_too_old", 
951                    "rb31_hk_too_old", 
952                    "rb32_hk_too_old", 
953                    "rb33_hk_too_old", 
954                    "rb34_hk_too_old", 
955                    "rb35_hk_too_old", 
956                    "rb36_hk_too_old", 
957                    "rb39_hk_too_old", 
958                    "rb40_hk_too_old", 
959                    "rb41_hk_too_old", 
960                    "rb42_hk_too_old", 
961                    "rb44_hk_too_old", 
962                    "rb46_hk_too_old", 
963                    ];
964    return keys;
965  }
966
967  pub fn get(&self, key :  &str) -> Option<TofAlertConfig> {
968    match key {
969      "data_mangling"   => Some(self.data_mangling.clone()),  
970      "miss_tofevid"    => Some(self.miss_tofevid.clone()),   
971      "tofev_vs_merge"  => Some(self.tofev_vs_merge.clone()), 
972      "notof_vs_merge"  => Some(self.notof_vs_merge.clone()), 
973      "frac_interest"   => Some(self.frac_interest.clone()),  
974      "mtb_lost_rate"   => Some(self.mtb_lost_rate.clone()),
975      "mtb_fpga_temp"   => Some(self.mtb_fpga_temp.clone()),
976      "mtb_rate_zero"   => Some(self.mtb_rate_zero.clone()),
977      "mtb_hk_too_old"  => Some(self.mtb_hk_too_old.clone()),
978      "cpu_core0_temp"  => Some(self.cpu_core0_temp.clone()),
979      "cpu_core1_temp"  => Some(self.cpu_core1_temp.clone()),
980      "cpu_hk_too_old"  => Some(self.cpu_hk_too_old.clone()),
981      "cpu_disk"        => Some(self.cpu_disk.clone()),
982      "rb01_temp"       => Some(self.rb01_temp.clone()),
983      "rb02_temp"       => Some(self.rb02_temp.clone()),  
984      "rb03_temp"       => Some(self.rb03_temp.clone()),  
985      "rb04_temp"       => Some(self.rb04_temp.clone()), 
986      "rb05_temp"       => Some(self.rb05_temp.clone()), 
987      "rb06_temp"       => Some(self.rb06_temp.clone()), 
988      "rb07_temp"       => Some(self.rb07_temp.clone()),
989      "rb08_temp"       => Some(self.rb08_temp.clone()), 
990      "rb09_temp"       => Some(self.rb09_temp.clone()), 
991      "rb11_temp"       => Some(self.rb11_temp.clone()), 
992      "rb13_temp"       => Some(self.rb13_temp.clone()),
993      "rb14_temp"       => Some(self.rb14_temp.clone()), 
994      "rb15_temp"       => Some(self.rb15_temp.clone()), 
995      "rb16_temp"       => Some(self.rb16_temp.clone()), 
996      "rb17_temp"       => Some(self.rb17_temp.clone()), 
997      "rb18_temp"       => Some(self.rb18_temp.clone()), 
998      "rb19_temp"       => Some(self.rb19_temp.clone()), 
999      "rb20_temp"       => Some(self.rb20_temp.clone()), 
1000      "rb21_temp"       => Some(self.rb21_temp.clone()), 
1001      "rb22_temp"       => Some(self.rb22_temp.clone()), 
1002      "rb23_temp"       => Some(self.rb23_temp.clone()), 
1003      "rb24_temp"       => Some(self.rb24_temp.clone()), 
1004      "rb25_temp"       => Some(self.rb25_temp.clone()), 
1005      "rb26_temp"       => Some(self.rb26_temp.clone()), 
1006      "rb27_temp"       => Some(self.rb27_temp.clone()), 
1007      "rb28_temp"       => Some(self.rb28_temp.clone()), 
1008      "rb29_temp"       => Some(self.rb29_temp.clone()), 
1009      "rb30_temp"       => Some(self.rb30_temp.clone()), 
1010      "rb31_temp"       => Some(self.rb31_temp.clone()), 
1011      "rb32_temp"       => Some(self.rb32_temp.clone()), 
1012      "rb33_temp"       => Some(self.rb33_temp.clone()), 
1013      "rb34_temp"       => Some(self.rb34_temp.clone()), 
1014      "rb35_temp"       => Some(self.rb35_temp.clone()), 
1015      "rb36_temp"       => Some(self.rb36_temp.clone()), 
1016      "rb39_temp"       => Some(self.rb39_temp.clone()), 
1017      "rb40_temp"       => Some(self.rb40_temp.clone()), 
1018      "rb41_temp"       => Some(self.rb41_temp.clone()), 
1019      "rb42_temp"       => Some(self.rb42_temp.clone()), 
1020      "rb44_temp"       => Some(self.rb44_temp.clone()), 
1021      "rb46_temp"       => Some(self.rb46_temp.clone()), 
1022      "rb01_rate_zero"  => Some(self.rb01_rate_zero.clone()), 
1023      "rb02_rate_zero"  => Some(self.rb02_rate_zero.clone()),  
1024      "rb03_rate_zero"  => Some(self.rb03_rate_zero.clone()),  
1025      "rb04_rate_zero"  => Some(self.rb04_rate_zero.clone()), 
1026      "rb05_rate_zero"  => Some(self.rb05_rate_zero.clone()), 
1027      "rb06_rate_zero"  => Some(self.rb06_rate_zero.clone()), 
1028      "rb07_rate_zero"  => Some(self.rb07_rate_zero.clone()), 
1029      "rb08_rate_zero"  => Some(self.rb08_rate_zero.clone()), 
1030      "rb09_rate_zero"  => Some(self.rb09_rate_zero.clone()), 
1031      "rb11_rate_zero"  => Some(self.rb11_rate_zero.clone()), 
1032      "rb13_rate_zero"  => Some(self.rb13_rate_zero.clone()), 
1033      "rb14_rate_zero"  => Some(self.rb14_rate_zero.clone()), 
1034      "rb15_rate_zero"  => Some(self.rb15_rate_zero.clone()), 
1035      "rb16_rate_zero"  => Some(self.rb16_rate_zero.clone()), 
1036      "rb17_rate_zero"  => Some(self.rb17_rate_zero.clone()), 
1037      "rb18_rate_zero"  => Some(self.rb18_rate_zero.clone()), 
1038      "rb19_rate_zero"  => Some(self.rb19_rate_zero.clone()), 
1039      "rb20_rate_zero"  => Some(self.rb20_rate_zero.clone()), 
1040      "rb21_rate_zero"  => Some(self.rb21_rate_zero.clone()), 
1041      "rb22_rate_zero"  => Some(self.rb22_rate_zero.clone()), 
1042      "rb23_rate_zero"  => Some(self.rb23_rate_zero.clone()), 
1043      "rb24_rate_zero"  => Some(self.rb24_rate_zero.clone()), 
1044      "rb25_rate_zero"  => Some(self.rb25_rate_zero.clone()), 
1045      "rb26_rate_zero"  => Some(self.rb26_rate_zero.clone()), 
1046      "rb27_rate_zero"  => Some(self.rb27_rate_zero.clone()), 
1047      "rb28_rate_zero"  => Some(self.rb28_rate_zero.clone()), 
1048      "rb29_rate_zero"  => Some(self.rb29_rate_zero.clone()), 
1049      "rb30_rate_zero"  => Some(self.rb30_rate_zero.clone()), 
1050      "rb31_rate_zero"  => Some(self.rb31_rate_zero.clone()), 
1051      "rb32_rate_zero"  => Some(self.rb32_rate_zero.clone()), 
1052      "rb33_rate_zero"  => Some(self.rb33_rate_zero.clone()), 
1053      "rb34_rate_zero"  => Some(self.rb34_rate_zero.clone()), 
1054      "rb35_rate_zero"  => Some(self.rb35_rate_zero.clone()), 
1055      "rb36_rate_zero"  => Some(self.rb36_rate_zero.clone()), 
1056      "rb39_rate_zero"  => Some(self.rb39_rate_zero.clone()), 
1057      "rb40_rate_zero"  => Some(self.rb40_rate_zero.clone()), 
1058      "rb41_rate_zero"  => Some(self.rb41_rate_zero.clone()), 
1059      "rb42_rate_zero"  => Some(self.rb42_rate_zero.clone()), 
1060      "rb44_rate_zero"  => Some(self.rb44_rate_zero.clone()), 
1061      "rb46_rate_zero"  => Some(self.rb46_rate_zero.clone()), 
1062      "rb01_hk_too_old" => Some(self.rb01_hk_too_old.clone()), 
1063      "rb02_hk_too_old" => Some(self.rb02_hk_too_old.clone()),  
1064      "rb03_hk_too_old" => Some(self.rb03_hk_too_old.clone()),  
1065      "rb04_hk_too_old" => Some(self.rb04_hk_too_old.clone()), 
1066      "rb05_hk_too_old" => Some(self.rb05_hk_too_old.clone()), 
1067      "rb06_hk_too_old" => Some(self.rb06_hk_too_old.clone()), 
1068      "rb07_hk_too_old" => Some(self.rb07_hk_too_old.clone()), 
1069      "rb08_hk_too_old" => Some(self.rb08_hk_too_old.clone()), 
1070      "rb09_hk_too_old" => Some(self.rb09_hk_too_old.clone()), 
1071      "rb11_hk_too_old" => Some(self.rb11_hk_too_old.clone()), 
1072      "rb13_hk_too_old" => Some(self.rb13_hk_too_old.clone()), 
1073      "rb14_hk_too_old" => Some(self.rb14_hk_too_old.clone()), 
1074      "rb15_hk_too_old" => Some(self.rb15_hk_too_old.clone()), 
1075      "rb16_hk_too_old" => Some(self.rb16_hk_too_old.clone()), 
1076      "rb17_hk_too_old" => Some(self.rb17_hk_too_old.clone()), 
1077      "rb18_hk_too_old" => Some(self.rb18_hk_too_old.clone()), 
1078      "rb19_hk_too_old" => Some(self.rb19_hk_too_old.clone()), 
1079      "rb20_hk_too_old" => Some(self.rb20_hk_too_old.clone()), 
1080      "rb21_hk_too_old" => Some(self.rb21_hk_too_old.clone()), 
1081      "rb22_hk_too_old" => Some(self.rb22_hk_too_old.clone()), 
1082      "rb23_hk_too_old" => Some(self.rb23_hk_too_old.clone()), 
1083      "rb24_hk_too_old" => Some(self.rb24_hk_too_old.clone()), 
1084      "rb25_hk_too_old" => Some(self.rb25_hk_too_old.clone()), 
1085      "rb26_hk_too_old" => Some(self.rb26_hk_too_old.clone()), 
1086      "rb27_hk_too_old" => Some(self.rb27_hk_too_old.clone()), 
1087      "rb28_hk_too_old" => Some(self.rb28_hk_too_old.clone()), 
1088      "rb29_hk_too_old" => Some(self.rb29_hk_too_old.clone()), 
1089      "rb30_hk_too_old" => Some(self.rb30_hk_too_old.clone()), 
1090      "rb31_hk_too_old" => Some(self.rb31_hk_too_old.clone()), 
1091      "rb32_hk_too_old" => Some(self.rb32_hk_too_old.clone()), 
1092      "rb33_hk_too_old" => Some(self.rb33_hk_too_old.clone()), 
1093      "rb34_hk_too_old" => Some(self.rb34_hk_too_old.clone()), 
1094      "rb35_hk_too_old" => Some(self.rb35_hk_too_old.clone()), 
1095      "rb36_hk_too_old" => Some(self.rb36_hk_too_old.clone()), 
1096      "rb39_hk_too_old" => Some(self.rb39_hk_too_old.clone()), 
1097      "rb40_hk_too_old" => Some(self.rb40_hk_too_old.clone()), 
1098      "rb41_hk_too_old" => Some(self.rb41_hk_too_old.clone()), 
1099      "rb42_hk_too_old" => Some(self.rb42_hk_too_old.clone()), 
1100      "rb44_hk_too_old" => Some(self.rb44_hk_too_old.clone()), 
1101      "rb46_hk_too_old" => Some(self.rb46_hk_too_old.clone()), 
1102      _                => None
1103    }
1104  }
1105  
1106  pub fn from_toml(filename : &str) -> Result<Self, SerializationError> {
1107    match File::open(filename) {
1108      Err(err) => {
1109        println!("Unable to open {}! {}", filename, err);
1110        return Err(SerializationError::TomlDecodingError);
1111      }
1112      Ok(mut file) => {
1113        let mut toml_string = String::from("");
1114        match file.read_to_string(&mut toml_string) {
1115          Err(err) => {
1116            println!("Unable to read {}! {}", filename, err);
1117            return Err(SerializationError::TomlDecodingError);
1118          }
1119          Ok(_) => {
1120            match toml::from_str::<TofAlertManifest>(&toml_string) {
1121              Err(err) => {
1122                println!("Can't interpret toml! {}", err);
1123                return Err(SerializationError::TomlDecodingError);
1124              }
1125              Ok(manifest) => {
1126                Ok(manifest)
1127              }
1128            }
1129          }
1130        }
1131      }
1132    }
1133  }
1134  
1135  pub fn to_toml(&self, mut filename : String) {
1136    if !filename.ends_with(".toml") {
1137      filename += ".toml";
1138    }
1139    info!("Will write to file {}!", filename);
1140    match File::create(&filename) {
1141      Err(err) => {
1142        error!("Unable to open file {}! {}", filename, err);
1143      }
1144      Ok(mut file) => {
1145        match toml::to_string_pretty(&self) {
1146          Err(err) => {
1147            error!("Unable to serialize toml! {err}");
1148          }
1149          Ok(toml_string) => {
1150            match file.write_all(toml_string.as_bytes()) {
1151              Err(err) => error!("Unable to write to file {}! {}", filename, err),
1152              Ok(_)    => debug!("Wrote settings to {}!", filename)
1153            }
1154          }
1155        }
1156      }
1157    }
1158  }
1159  
1160}
1161
1162
1163/// Load all alerts from the manifest
1164pub fn load_alerts<'a>(manifest : TofAlertManifest) -> HashMap<&'a str, TofAlert<'a>> {
1165  let mut alerts = HashMap::from([("mtb_rate_zero", TofAlert {
1166                                                        key          : "mtb_rate_zero",
1167                                                        descr        : "MTB is not triggering!",
1168                                                        whattodo     : vec!["1) Check about TIU status", "2) Run restart", "3) If SSH available, debug with pybindings", "4) Soft reboot MTB", "5) Hard reboot MTB"],
1169                                                        config       : TofAlertConfig::new(),
1170                                                        variable     : Variable::TriggerRate,
1171                                                        outofbound   : OutOfBound::Zero,
1172                                                        component    : Component::MTB,
1173                                                        n_paged      : 0,
1174                                                        triggered    : None}),
1175                                   ("mtb_lost_rate", TofAlert { 
1176                                                        key          : "mtb_lost_rate",
1177                                                        descr        : "MTB Lost rate is whacky!!",
1178                                                        whattodo     : vec!["Unclear course of action. Check with tracker, maybe nothing can be done!"],
1179                                                        config       : TofAlertConfig::new(),
1180                                                        variable     : Variable::LostTriggerRate,
1181                                                        outofbound   : OutOfBound::TooHigh,
1182                                                        component    : Component::MTB,
1183                                                        n_paged      : 0,
1184                                                        triggered    : None}),
1185                                    ("mtb_fpga_temp", TofAlert {
1186                                                        key          : "mtb_fpga_temp",
1187                                                        descr        : "MTB Temperature out of bounds!!",
1188                                                        whattodo     : vec!["This is critical! Check with everyone and then shut off the MTB!"],
1189                                                        config       : TofAlertConfig::new(),
1190                                                        variable     : Variable::FPGATemp,
1191                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1192                                                        component    : Component::MTB,
1193                                                        n_paged      : 0,
1194                                                        triggered    : None}),
1195                                    ("mtb_hk_too_old" , TofAlert {
1196                                                        key          : "mtb_hk_too_old", 
1197                                                        descr        : "MTBMoniData is out-of-date!",
1198                                                        whattodo     : vec!["Critical! This most likely means we are not triggering!" ,  "1) Check with tracker", "2) Run restart", "3) Soft reboot MTB", "4) Powercycle CAT"],
1199                                                        config       : TofAlertConfig::new(),
1200                                                        variable     : Variable::MoniData,
1201                                                        outofbound   : OutOfBound::TooOld,
1202                                                        component    : Component::RB(40),
1203                                                        n_paged      : 0,
1204                                                        triggered    : None}),
1205                                    ("cpu_core0_temp", TofAlert {
1206                                                        key          : "cpu_core0_temp",
1207                                                        descr        : "CPU Core0 temperatrue is out of bounds!",
1208                                                        whattodo     : vec!["This is critical! Check with everyone and then stop the run and likely turn off the CAT!"],
1209                                                        config       : TofAlertConfig::new(),
1210                                                        variable     : Variable::CoreTemp,
1211                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1212                                                        component    : Component::CPU,
1213                                                        n_paged      : 0,
1214                                                        triggered    : None}),
1215                                    ("cpu_core1_temp", TofAlert {
1216                                                        key          : "cpu_core1_temp",
1217                                                        descr        : "CPU Core1 temperatrue is out of bounds!",
1218                                                        whattodo     : vec!["This is critical! Check with everyone and then stop the run and likely turn off the CAT!"],
1219                                                        config       : TofAlertConfig::new(),
1220                                                        variable     : Variable::CoreTemp,
1221                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1222                                                        component    : Component::CPU,
1223                                                        n_paged      : 0,
1224                                                        triggered    : None}),
1225                                    ("cpu_disk", TofAlert {
1226                                                        key          : "cpu_disk",
1227                                                        descr        : "The disks on the TOF CPU are getting full.",
1228                                                        whattodo     : vec!["This is a general issue and need to be discussed in ops","No immediate action necessary"],
1229                                                        config       : TofAlertConfig::new(),
1230                                                        variable     : Variable::AvailableDiskSpace,
1231                                                        outofbound   : OutOfBound::TooHigh,
1232                                                        component    : Component::CPU,
1233                                                        n_paged      : 0,
1234                                                        triggered    : None}),
1235                                    ("cpu_hk_too_old" , TofAlert {
1236                                                        key          : "cpu_hk_too_old", 
1237                                                        descr        : "CPUMoniData is out-of-date!",
1238                                                        whattodo     : vec!["If everything else is fine, this is non-critical", "Typicallly, if this is an issue, there might be other, more severe issues!"],
1239                                                        config       : TofAlertConfig::new(),
1240                                                        variable     : Variable::MoniData,
1241                                                        outofbound   : OutOfBound::TooOld,
1242                                                        component    : Component::RB(40),
1243                                                        n_paged      : 0,
1244                                                        triggered    : None}),
1245                                    ("data_mangling", TofAlert {
1246                                                        key          : "data_mangling",
1247                                                        descr        : "Data mangling (intermix of RB channels on one or several RBs) is excessive!",
1248                                                        whattodo     : vec!["This is a general issue!","No immediate action necessary","Options have to be discussed"],
1249                                                        config       : TofAlertConfig::new(),
1250                                                        variable     : Variable::DataMangling,
1251                                                        outofbound   : OutOfBound::TooHigh,
1252                                                        component    : Component::System,
1253                                                        n_paged      : 0,
1254                                                        triggered    : None}),
1255                                    ("miss_tofevid", TofAlert {
1256                                                        key          : "miss_tofevid",
1257                                                        descr        : "The Tof system is missing event ids in an excessive amount!",
1258                                                        whattodo     : vec!["This is nist likely related to ","No immediate action necessary","Options have to be discussed"],
1259                                                        config       : TofAlertConfig::new(),
1260                                                        variable     : Variable::DataMangling,
1261                                                        outofbound   : OutOfBound::TooHigh,
1262                                                        component    : Component::System,
1263                                                        n_paged      : 0,
1264                                                        triggered    : None}),
1265                                    ("tofev_vs_merge", TofAlert {
1266                                                        key          : "tofev_vs_merge",
1267                                                        descr        : "The rate of Tof event is larger thatn the rate of merged events!",
1268                                                        whattodo     : vec!["If you are getting the tof events from telemetry, this simply can't happen ","If this happens, something is utterly broken, most likely with our monitoring","In case we don't get TofEventSummary from telemetry but directlly from the TofCPU, we are on ground and this simply needs to be debugged"],
1269                                                        config       : TofAlertConfig::new(),
1270                                                        variable     : Variable::Telemetry,
1271                                                        outofbound   : OutOfBound::TooHigh,
1272                                                        component    : Component::System,
1273                                                        n_paged      : 0,
1274                                                        triggered    : None}),
1275                                    ("notof_vs_merge", TofAlert {
1276                                                        key          : "notof_vs_merge",
1277                                                        descr        : "The rate of merged events without TofEvents is excessive!",
1278                                                        whattodo     : vec!["The stream of TofEvents to the flight computer might have stopped","1) Run restart recommended","2) Soft Reboot MTB", "3) Hard reboot CAT"],
1279                                                        config       : TofAlertConfig::new(),
1280                                                        variable     : Variable::Telemetry,
1281                                                        outofbound   : OutOfBound::TooHigh,
1282                                                        component    : Component::System,
1283                                                        n_paged      : 0,
1284                                                        triggered    : None}),
1285                                    ("frac_interest", TofAlert {
1286                                                        key          : "frac_interest",
1287                                                        descr        : "The rate of interesting events is too low!",
1288                                                        whattodo     : vec!["The stream of TofEvents to the flight computer might have stopped","1) Run restart recommended","2) Soft Reboot MTB", "3) Hard reboot CAT"],
1289                                                        config       : TofAlertConfig::new(),
1290                                                        variable     : Variable::Telemetry,
1291                                                        outofbound   : OutOfBound::TooHigh,
1292                                                        component    : Component::System,
1293                                                        n_paged      : 0,
1294                                                        triggered    : None}),
1295
1296                                    // 40x 3 RB alerts. I am only doing this to celebrate me being
1297                                    // miserable on basically ny's eve. May the gods have mercy and 
1298                                    // strike me down.
1299                                    ("rb01_rate_zero" , TofAlert {
1300                                                        key          : "rb01_rate_zero", 
1301                                                        descr        : "RB01 is not triggering!", 
1302                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1303                                                        config       : TofAlertConfig::new(),
1304                                                        variable     : Variable::TriggerRate,
1305                                                        outofbound   : OutOfBound::Zero,
1306                                                        component    : Component::RB(1),
1307                                                        n_paged      : 0,
1308                                                        triggered    : None}),
1309                                    ("rb01_temp" , TofAlert {
1310                                                        key          : "rb01_temp", 
1311                                                        descr        : "RB01 (FPGA) temperature is out of bounds!",
1312                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1313                                                        config       : TofAlertConfig::new(),
1314                                                        variable     : Variable::FPGATemp,
1315                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1316                                                        component    : Component::RB(1),
1317                                                        n_paged      : 0,
1318                                                        triggered    : None}),
1319                                    ("rb01_hk_too_old" , TofAlert {
1320                                                        key          : "rb01_hk_too_old", 
1321                                                        descr        : "RB01 RBMoniData is out-of-date!",
1322                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1323                                                        config       : TofAlertConfig::new(),
1324                                                        variable     : Variable::MoniData,
1325                                                        outofbound   : OutOfBound::TooOld,
1326                                                        component    : Component::RB(1),
1327                                                        n_paged      : 0,
1328                                                        triggered    : None}),
1329                                    /////////////////////////////////////////////////////////
1330                                    ("rb02_rate_zero" , TofAlert {
1331                                                        key          : "rb02_rate_zero", 
1332                                                        descr        : "RB02 is not triggering!", 
1333                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1334                                                        config       : TofAlertConfig::new(),
1335                                                        variable     : Variable::TriggerRate,
1336                                                        outofbound   : OutOfBound::Zero,
1337                                                        component    : Component::RB(2),
1338                                                        n_paged      : 0,
1339                                                        triggered    : None}),
1340                                    ("rb02_temp" , TofAlert {
1341                                                        key          : "rb02_temp", 
1342                                                        descr        : "RB02 (FPGA) temperature is out of bounds!",
1343                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1344                                                        config       : TofAlertConfig::new(),
1345                                                        variable     : Variable::FPGATemp,
1346                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1347                                                        component    : Component::RB(2),
1348                                                        n_paged      : 0,
1349                                                        triggered    : None}),
1350                                    ("rb02_hk_too_old" , TofAlert {
1351                                                        key          : "rb02_hk_too_old", 
1352                                                        descr        : "RB02 RBMoniData is out-of-date!",
1353                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1354                                                        config       : TofAlertConfig::new(),
1355                                                        variable     : Variable::MoniData,
1356                                                        outofbound   : OutOfBound::TooOld,
1357                                                        n_paged      : 0,
1358                                                        component    : Component::RB(2),
1359                                                        triggered    : None}),
1360                                    ("rb03_rate_zero" , TofAlert {
1361                                                        key          : "rb03_rate_zero", 
1362                                                        descr        : "RB03 is not triggering!", 
1363                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1364                                                        config       : TofAlertConfig::new(),
1365                                                        variable     : Variable::TriggerRate,
1366                                                        outofbound   : OutOfBound::Zero,
1367                                                        n_paged      : 0,
1368                                                        component    : Component::RB(3),
1369                                                        triggered    : None}),
1370                                    ("rb03_temp" , TofAlert {
1371                                                        key          : "rb03_temp", 
1372                                                        descr        : "RB03 (FPGA) temperature is out of bounds!",
1373                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1374                                                        config       : TofAlertConfig::new(),
1375                                                        variable     : Variable::FPGATemp,
1376                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1377                                                        component    : Component::RB(3),
1378                                                        n_paged      : 0,
1379                                                        triggered    : None}),
1380                                    ("rb03_hk_too_old" , TofAlert {
1381                                                        key          : "rb03_hk_too_old", 
1382                                                        descr        : "RB03 RBMoniData is out-of-date!",
1383                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1384                                                        config       : TofAlertConfig::new(),
1385                                                        variable     : Variable::MoniData,
1386                                                        outofbound   : OutOfBound::TooOld,
1387                                                        component    : Component::RB(3),
1388                                                        n_paged      : 0,
1389                                                        triggered    : None}),
1390                                    ("rb04_rate_zero" , TofAlert {
1391                                                        key          : "rb04_rate_zero", 
1392                                                        descr        : "RB04 is not triggering!", 
1393                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1394                                                        config       : TofAlertConfig::new(),
1395                                                        variable     : Variable::TriggerRate,
1396                                                        outofbound   : OutOfBound::Zero,
1397                                                        component    : Component::RB(4),
1398                                                        n_paged      : 0,
1399                                                        triggered    : None}),
1400                                    ("rb04_temp" , TofAlert {
1401                                                        key          : "rb04_temp", 
1402                                                        descr        : "RB04 (FPGA) temperature is out of bounds!",
1403                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1404                                                        config       : TofAlertConfig::new(),
1405                                                        variable     : Variable::FPGATemp,
1406                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1407                                                        component    : Component::RB(4),
1408                                                        n_paged      : 0,
1409                                                        triggered    : None}),
1410                                    ("rb04_hk_too_old" , TofAlert {
1411                                                        key          : "rb05_hk_too_old", 
1412                                                        descr        : "RB05 RBMoniData is out-of-date!",
1413                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1414                                                        config       : TofAlertConfig::new(),
1415                                                        variable     : Variable::MoniData,
1416                                                        outofbound   : OutOfBound::TooOld,
1417                                                        component    : Component::RB(4),
1418                                                        n_paged      : 0,
1419                                                        triggered    : None}),
1420                                    ("rb05_rate_zero" , TofAlert {
1421                                                        key          : "rb05_rate_zero", 
1422                                                        descr        : "RB05 is not triggering!", 
1423                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1424                                                        config       : TofAlertConfig::new(),
1425                                                        variable     : Variable::TriggerRate,
1426                                                        outofbound   : OutOfBound::Zero,
1427                                                        n_paged      : 0,
1428                                                        component    : Component::RB(5),
1429                                                        triggered    : None}),
1430                                    ("rb05_temp" , TofAlert {
1431                                                        key          : "rb05_temp", 
1432                                                        descr        : "RB01 (FPGA) temperature is out of bounds!",
1433                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1434                                                        config       : TofAlertConfig::new(),
1435                                                        variable     : Variable::FPGATemp,
1436                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1437                                                        component    : Component::RB(5),
1438                                                        n_paged      : 0,
1439                                                        triggered    : None}),
1440                                    ("rb05_hk_too_old" , TofAlert {
1441                                                        key          : "rb05_hk_too_old", 
1442                                                        descr        : "RB01 RBMoniData is out-of-date!",
1443                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1444                                                        config       : TofAlertConfig::new(),
1445                                                        variable     : Variable::MoniData,
1446                                                        outofbound   : OutOfBound::TooOld,
1447                                                        component    : Component::RB(5),
1448                                                        n_paged      : 0,
1449                                                        triggered    : None}),
1450                                    ("rb06_rate_zero" , TofAlert {
1451                                                        key          : "rb06_rate_zero", 
1452                                                        descr        : "RB06 is not triggering!", 
1453                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1454                                                        config       : TofAlertConfig::new(),
1455                                                        variable     : Variable::TriggerRate,
1456                                                        outofbound   : OutOfBound::Zero,
1457                                                        component    : Component::RB(6),
1458                                                        n_paged      : 0,
1459                                                        triggered    : None}),
1460                                    ("rb06_temp" , TofAlert {
1461                                                        key          : "rb06_temp", 
1462                                                        descr        : "RB06 (FPGA) temperature is out of bounds!",
1463                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1464                                                        config       : TofAlertConfig::new(),
1465                                                        variable     : Variable::FPGATemp,
1466                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1467                                                        component    : Component::RB(6),
1468                                                        n_paged      : 0,
1469                                                        triggered    : None}),
1470                                    ("rb06_hk_too_old" , TofAlert {
1471                                                        key          : "rb06_hk_too_old", 
1472                                                        descr        : "RB06 RBMoniData is out-of-date!",
1473                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1474                                                        config       : TofAlertConfig::new(),
1475                                                        variable     : Variable::MoniData,
1476                                                        outofbound   : OutOfBound::TooOld,
1477                                                        component    : Component::RB(6),
1478                                                        n_paged      : 0,
1479                                                        triggered    : None}),
1480                                    ("rb07_rate_zero" , TofAlert {
1481                                                        key          : "rb07_rate_zero", 
1482                                                        descr        : "RB07 is not triggering!", 
1483                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1484                                                        config       : TofAlertConfig::new(),
1485                                                        variable     : Variable::TriggerRate,
1486                                                        outofbound   : OutOfBound::Zero,
1487                                                        component    : Component::RB(7),
1488                                                        n_paged      : 0,
1489                                                        triggered    : None}),
1490                                    ("rb07_temp" , TofAlert {
1491                                                        key          : "rb07_temp", 
1492                                                        descr        : "RB07 (FPGA) temperature is out of bounds!",
1493                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1494                                                        config       : TofAlertConfig::new(),
1495                                                        variable     : Variable::FPGATemp,
1496                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1497                                                        component    : Component::RB(7),
1498                                                        n_paged      : 0,
1499                                                        triggered    : None}),
1500                                    ("rb07_hk_too_old" , TofAlert {
1501                                                        key          : "rb07_hk_too_old", 
1502                                                        descr        : "RB07 RBMoniData is out-of-date!",
1503                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1504                                                        config       : TofAlertConfig::new(),
1505                                                        variable     : Variable::MoniData,
1506                                                        outofbound   : OutOfBound::TooOld,
1507                                                        component    : Component::RB(7),
1508                                                        n_paged      : 0,
1509                                                        triggered    : None}),
1510                                    ("rb08_rate_zero" , TofAlert {
1511                                                        key          : "rb08_rate_zero", 
1512                                                        descr        : "RB08 is not triggering!", 
1513                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1514                                                        config       : TofAlertConfig::new(),
1515                                                        variable     : Variable::TriggerRate,
1516                                                        outofbound   : OutOfBound::Zero,
1517                                                        component    : Component::RB(8),
1518                                                        n_paged      : 0,
1519                                                        triggered    : None}),
1520                                    ("rb08_temp" , TofAlert {
1521                                                        key          : "rb08_temp", 
1522                                                        descr        : "RB08 (FPGA) temperature is out of bounds!",
1523                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1524                                                        config       : TofAlertConfig::new(),
1525                                                        variable     : Variable::FPGATemp,
1526                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1527                                                        component    : Component::RB(8),
1528                                                        n_paged      : 0,
1529                                                        triggered    : None}),
1530                                    ("rb08_hk_too_old" , TofAlert {
1531                                                        key          : "rb08_hk_too_old", 
1532                                                        descr        : "RB08 RBMoniData is out-of-date!",
1533                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1534                                                        config       : TofAlertConfig::new(),
1535                                                        variable     : Variable::MoniData,
1536                                                        outofbound   : OutOfBound::TooOld,
1537                                                        component    : Component::RB(8),
1538                                                        n_paged      : 0,
1539                                                        triggered    : None}),
1540                                    ("rb09_rate_zero" , TofAlert {
1541                                                        key          : "rb09_rate_zero", 
1542                                                        descr        : "RB09 is not triggering!", 
1543                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1544                                                        config       : TofAlertConfig::new(),
1545                                                        variable     : Variable::TriggerRate,
1546                                                        outofbound   : OutOfBound::Zero,
1547                                                        component    : Component::RB(9),
1548                                                        n_paged      : 0,
1549                                                        triggered    : None}),
1550                                    ("rb09_temp" , TofAlert {
1551                                                        key          : "rb09_temp", 
1552                                                        descr        : "RB09 (FPGA) temperature is out of bounds!",
1553                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1554                                                        config       : TofAlertConfig::new(),
1555                                                        variable     : Variable::FPGATemp,
1556                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1557                                                        component    : Component::RB(9),
1558                                                        n_paged      : 0,
1559                                                        triggered    : None}),
1560                                    ("rb09_hk_too_old" , TofAlert {
1561                                                        key          : "rb09_hk_too_old", 
1562                                                        descr        : "RB09 RBMoniData is out-of-date!",
1563                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1564                                                        config       : TofAlertConfig::new(),
1565                                                        variable     : Variable::MoniData,
1566                                                        outofbound   : OutOfBound::TooOld,
1567                                                        component    : Component::RB(9),
1568                                                        n_paged      : 0,
1569                                                        triggered    : None}),
1570                                    ("rb11_rate_zero" , TofAlert {
1571                                                        key          : "rb11_rate_zero", 
1572                                                        descr        : "RB11 is not triggering!", 
1573                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1574                                                        config       : TofAlertConfig::new(),
1575                                                        variable     : Variable::TriggerRate,
1576                                                        outofbound   : OutOfBound::Zero,
1577                                                        component    : Component::RB(11),
1578                                                        n_paged      : 0,
1579                                                        triggered    : None}),
1580                                    ("rb11_temp" , TofAlert {
1581                                                        key          : "rb11_temp", 
1582                                                        descr        : "RB11 (FPGA) temperature is out of bounds!",
1583                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1584                                                        config       : TofAlertConfig::new(),
1585                                                        variable     : Variable::FPGATemp,
1586                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1587                                                        component    : Component::RB(11),
1588                                                        n_paged      : 0,
1589                                                        triggered    : None}),
1590                                    ("rb11_hk_too_old" , TofAlert {
1591                                                        key          : "rb11_hk_too_old", 
1592                                                        descr        : "RB11 RBMoniData is out-of-date!",
1593                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1594                                                        config       : TofAlertConfig::new(),
1595                                                        variable     : Variable::MoniData,
1596                                                        outofbound   : OutOfBound::TooOld,
1597                                                        component    : Component::RB(11),
1598                                                        n_paged      : 0,
1599                                                        triggered    : None}),
1600                                    /////////////////////////////////////////////////////////
1601                                    ("rb13_rate_zero" , TofAlert {
1602                                                        key          : "rb13_rate_zero", 
1603                                                        descr        : "RB13 is not triggering!", 
1604                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1605                                                        config       : TofAlertConfig::new(),
1606                                                        variable     : Variable::TriggerRate,
1607                                                        outofbound   : OutOfBound::Zero,
1608                                                        component    : Component::RB(13),
1609                                                        n_paged      : 0,
1610                                                        triggered    : None}),
1611                                    ("rb13_temp" , TofAlert {
1612                                                        key          : "rb13_temp", 
1613                                                        descr        : "RB13 (FPGA) temperature is out of bounds!",
1614                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1615                                                        config       : TofAlertConfig::new(),
1616                                                        variable     : Variable::FPGATemp,
1617                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1618                                                        component    : Component::RB(13),
1619                                                        n_paged      : 0,
1620                                                        triggered    : None}),
1621                                    ("rb13_hk_too_old" , TofAlert {
1622                                                        key          : "rb13_hk_too_old", 
1623                                                        descr        : "RB13 RBMoniData is out-of-date!",
1624                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1625                                                        config       : TofAlertConfig::new(),
1626                                                        variable     : Variable::MoniData,
1627                                                        outofbound   : OutOfBound::TooOld,
1628                                                        component    : Component::RB(13),
1629                                                        n_paged      : 0,
1630                                                        triggered    : None}),
1631                                    ("rb14_rate_zero" , TofAlert {
1632                                                        key          : "rb14_rate_zero", 
1633                                                        descr        : "RB14 is not triggering!", 
1634                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1635                                                        config       : TofAlertConfig::new(),
1636                                                        variable     : Variable::TriggerRate,
1637                                                        outofbound   : OutOfBound::Zero,
1638                                                        component    : Component::RB(14),
1639                                                        n_paged      : 0,
1640                                                        triggered    : None}),
1641                                    ("rb14_temp" , TofAlert {
1642                                                        key          : "rb14_temp", 
1643                                                        descr        : "RB14 (FPGA) temperature is out of bounds!",
1644                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1645                                                        config       : TofAlertConfig::new(),
1646                                                        variable     : Variable::FPGATemp,
1647                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1648                                                        component    : Component::RB(14),
1649                                                        n_paged      : 0,
1650                                                        triggered    : None}),
1651                                    ("rb14_hk_too_old" , TofAlert {
1652                                                        key          : "rb14_hk_too_old", 
1653                                                        descr        : "RB14 RBMoniData is out-of-date!",
1654                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1655                                                        config       : TofAlertConfig::new(),
1656                                                        variable     : Variable::MoniData,
1657                                                        outofbound   : OutOfBound::TooOld,
1658                                                        component    : Component::RB(14),
1659                                                        n_paged      : 0,
1660                                                        triggered    : None}),
1661                                    ("rb15_rate_zero" , TofAlert {
1662                                                        key          : "rb15_rate_zero", 
1663                                                        descr        : "RB15 is not triggering!", 
1664                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1665                                                        config       : TofAlertConfig::new(),
1666                                                        variable     : Variable::TriggerRate,
1667                                                        outofbound   : OutOfBound::Zero,
1668                                                        component    : Component::RB(15),
1669                                                        n_paged      : 0,
1670                                                        triggered    : None}),
1671                                    ("rb15_temp" , TofAlert {
1672                                                        key          : "rb15_temp", 
1673                                                        descr        : "RB15 (FPGA) temperature is out of bounds!",
1674                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1675                                                        config       : TofAlertConfig::new(),
1676                                                        variable     : Variable::FPGATemp,
1677                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1678                                                        component    : Component::RB(15),
1679                                                        n_paged      : 0,
1680                                                        triggered    : None}),
1681                                    ("rb15_hk_too_old" , TofAlert {
1682                                                        key          : "rb15_hk_too_old", 
1683                                                        descr        : "RB15 RBMoniData is out-of-date!",
1684                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1685                                                        config       : TofAlertConfig::new(),
1686                                                        variable     : Variable::MoniData,
1687                                                        outofbound   : OutOfBound::TooOld,
1688                                                        component    : Component::RB(15),
1689                                                        n_paged      : 0,
1690                                                        triggered    : None}),
1691                                    ("rb16_rate_zero" , TofAlert {
1692                                                        key          : "rb16_rate_zero", 
1693                                                        descr        : "RB16 is not triggering!", 
1694                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1695                                                        config       : TofAlertConfig::new(),
1696                                                        variable     : Variable::TriggerRate,
1697                                                        outofbound   : OutOfBound::Zero,
1698                                                        component    : Component::RB(16),
1699                                                        n_paged      : 0,
1700                                                        triggered    : None}),
1701                                    ("rb16_temp" , TofAlert {
1702                                                        key          : "rb16_temp", 
1703                                                        descr        : "RB16 (FPGA) temperature is out of bounds!",
1704                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1705                                                        config       : TofAlertConfig::new(),
1706                                                        variable     : Variable::FPGATemp,
1707                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1708                                                        component    : Component::RB(16),
1709                                                        n_paged      : 0,
1710                                                        triggered    : None}),
1711                                    ("rb16_hk_too_old" , TofAlert {
1712                                                        key          : "rb16_hk_too_old", 
1713                                                        descr        : "RB16 RBMoniData is out-of-date!",
1714                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1715                                                        config       : TofAlertConfig::new(),
1716                                                        variable     : Variable::MoniData,
1717                                                        outofbound   : OutOfBound::TooOld,
1718                                                        component    : Component::RB(16),
1719                                                        n_paged      : 0,
1720                                                        triggered    : None}),
1721                                    ("rb17_rate_zero" , TofAlert {
1722                                                        key          : "rb17_rate_zero", 
1723                                                        descr        : "RB17 is not triggering!", 
1724                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1725                                                        config       : TofAlertConfig::new(),
1726                                                        variable     : Variable::TriggerRate,
1727                                                        outofbound   : OutOfBound::Zero,
1728                                                        component    : Component::RB(17),
1729                                                        n_paged      : 0,
1730                                                        triggered    : None}),
1731                                    ("rb17_temp" , TofAlert {
1732                                                        key          : "rb17_temp", 
1733                                                        descr        : "RB17 (FPGA) temperature is out of bounds!",
1734                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1735                                                        config       : TofAlertConfig::new(),
1736                                                        variable     : Variable::FPGATemp,
1737                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1738                                                        component    : Component::RB(17),
1739                                                        n_paged      : 0,
1740                                                        triggered    : None}),
1741                                    ("rb17_hk_too_old" , TofAlert {
1742                                                        key          : "rb17_hk_too_old", 
1743                                                        descr        : "RB17 RBMoniData is out-of-date!",
1744                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1745                                                        config       : TofAlertConfig::new(),
1746                                                        variable     : Variable::MoniData,
1747                                                        outofbound   : OutOfBound::TooOld,
1748                                                        component    : Component::RB(17),
1749                                                        n_paged      : 0,
1750                                                        triggered    : None}),
1751                                    ("rb18_rate_zero" , TofAlert {
1752                                                        key          : "rb18_rate_zero", 
1753                                                        descr        : "RB18 is not triggering!", 
1754                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1755                                                        config       : TofAlertConfig::new(),
1756                                                        variable     : Variable::TriggerRate,
1757                                                        outofbound   : OutOfBound::Zero,
1758                                                        component    : Component::RB(18),
1759                                                        n_paged      : 0,
1760                                                        triggered    : None}),
1761                                    ("rb18_temp" , TofAlert {
1762                                                        key          : "rb18_temp", 
1763                                                        descr        : "RB18 (FPGA) temperature is out of bounds!",
1764                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1765                                                        config       : TofAlertConfig::new(),
1766                                                        variable     : Variable::FPGATemp,
1767                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1768                                                        component    : Component::RB(18),
1769                                                        n_paged      : 0,
1770                                                        triggered    : None}),
1771                                    ("rb18_hk_too_old" , TofAlert {
1772                                                        key          : "rb18_hk_too_old", 
1773                                                        descr        : "RB18 RBMoniData is out-of-date!",
1774                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1775                                                        config       : TofAlertConfig::new(),
1776                                                        variable     : Variable::MoniData,
1777                                                        outofbound   : OutOfBound::TooOld,
1778                                                        component    : Component::RB(18),
1779                                                        n_paged      : 0,
1780                                                        triggered    : None}),
1781                                    ("rb19_rate_zero" , TofAlert {
1782                                                        key          : "rb19_rate_zero", 
1783                                                        descr        : "RB19 is not triggering!", 
1784                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1785                                                        config       : TofAlertConfig::new(),
1786                                                        variable     : Variable::TriggerRate,
1787                                                        outofbound   : OutOfBound::Zero,
1788                                                        component    : Component::RB(19),
1789                                                        n_paged      : 0,
1790                                                        triggered    : None}),
1791                                    ("rb19_temp" , TofAlert {
1792                                                        key          : "rb19_temp", 
1793                                                        descr        : "RB19 (FPGA) temperature is out of bounds!",
1794                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1795                                                        config       : TofAlertConfig::new(),
1796                                                        variable     : Variable::FPGATemp,
1797                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1798                                                        component    : Component::RB(19),
1799                                                        n_paged      : 0,
1800                                                        triggered    : None}),
1801                                    ("rb19_hk_too_old" , TofAlert {
1802                                                        key          : "rb19_hk_too_old", 
1803                                                        descr        : "RB19 RBMoniData is out-of-date!",
1804                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1805                                                        config       : TofAlertConfig::new(),
1806                                                        variable     : Variable::MoniData,
1807                                                        outofbound   : OutOfBound::TooOld,
1808                                                        component    : Component::RB(19),
1809                                                        n_paged      : 0,
1810                                                        triggered    : None}),
1811                                    ("rb20_rate_zero" , TofAlert {
1812                                                        key          : "rb20_rate_zero", 
1813                                                        descr        : "RB20 is not triggering!", 
1814                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1815                                                        config       : TofAlertConfig::new(),
1816                                                        variable     : Variable::TriggerRate,
1817                                                        outofbound   : OutOfBound::Zero,
1818                                                        component    : Component::RB(20),
1819                                                        n_paged      : 0,
1820                                                        triggered    : None}),
1821                                    ("rb20_temp" , TofAlert {
1822                                                        key          : "rb20_temp", 
1823                                                        descr        : "RB20 (FPGA) temperature is out of bounds!",
1824                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1825                                                        config       : TofAlertConfig::new(),
1826                                                        variable     : Variable::FPGATemp,
1827                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1828                                                        component    : Component::RB(20),
1829                                                        n_paged      : 0,
1830                                                        triggered    : None}),
1831                                    ("rb20_hk_too_old" , TofAlert {
1832                                                        key          : "rb20_hk_too_old", 
1833                                                        descr        : "RB20 RBMoniData is out-of-date!",
1834                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1835                                                        config       : TofAlertConfig::new(),
1836                                                        variable     : Variable::MoniData,
1837                                                        outofbound   : OutOfBound::TooOld,
1838                                                        component    : Component::RB(20),
1839                                                        n_paged      : 0,
1840                                                        triggered    : None}),
1841                                    ("rb21_rate_zero" , TofAlert {
1842                                                        key          : "rb21_rate_zero", 
1843                                                        descr        : "RB21 is not triggering!", 
1844                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1845                                                        config       : TofAlertConfig::new(),
1846                                                        variable     : Variable::TriggerRate,
1847                                                        outofbound   : OutOfBound::Zero,
1848                                                        component    : Component::RB(21),
1849                                                        n_paged      : 0,
1850                                                        triggered    : None}),
1851                                    ("rb21_temp" , TofAlert {
1852                                                        key          : "rb21_temp", 
1853                                                        descr        : "RB21 (FPGA) temperature is out of bounds!",
1854                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1855                                                        config       : TofAlertConfig::new(),
1856                                                        variable     : Variable::FPGATemp,
1857                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1858                                                        component    : Component::RB(21),
1859                                                        n_paged      : 0,
1860                                                        triggered    : None}),
1861                                    ("rb21_hk_too_old" , TofAlert {
1862                                                        key          : "rb21_hk_too_old", 
1863                                                        descr        : "RB21 RBMoniData is out-of-date!",
1864                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1865                                                        config       : TofAlertConfig::new(),
1866                                                        variable     : Variable::MoniData,
1867                                                        outofbound   : OutOfBound::TooOld,
1868                                                        component    : Component::RB(21),
1869                                                        n_paged      : 0,
1870                                                        triggered    : None}),
1871                                    ////////////////////////////////////////////////////////
1872                                    ("rb22_rate_zero" , TofAlert {
1873                                                        key          : "rb22_rate_zero", 
1874                                                        descr        : "RB22 is not triggering!", 
1875                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1876                                                        config       : TofAlertConfig::new(),
1877                                                        variable     : Variable::TriggerRate,
1878                                                        outofbound   : OutOfBound::Zero,
1879                                                        component    : Component::RB(22),
1880                                                        n_paged      : 0,
1881                                                        triggered    : None}),
1882                                    ("rb22_temp" , TofAlert {
1883                                                        key          : "rb22_temp", 
1884                                                        descr        : "RB22 (FPGA) temperature is out of bounds!",
1885                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1886                                                        config       : TofAlertConfig::new(),
1887                                                        variable     : Variable::FPGATemp,
1888                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1889                                                        component    : Component::RB(22),
1890                                                        n_paged      : 0,
1891                                                        triggered    : None}),
1892                                    ("rb22_hk_too_old" , TofAlert {
1893                                                        key          : "rb22_hk_too_old", 
1894                                                        descr        : "RB22 RBMoniData is out-of-date!",
1895                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1896                                                        config       : TofAlertConfig::new(),
1897                                                        variable     : Variable::MoniData,
1898                                                        outofbound   : OutOfBound::TooOld,
1899                                                        component    : Component::RB(22),
1900                                                        n_paged      : 0,
1901                                                        triggered    : None}),
1902                                    ("rb23_rate_zero" , TofAlert {
1903                                                        key          : "rb23_rate_zero", 
1904                                                        descr        : "RB23 is not triggering!", 
1905                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1906                                                        config       : TofAlertConfig::new(),
1907                                                        variable     : Variable::TriggerRate,
1908                                                        outofbound   : OutOfBound::Zero,
1909                                                        component    : Component::RB(23),
1910                                                        n_paged      : 0,
1911                                                        triggered    : None}),
1912                                    ("rb23_temp" , TofAlert {
1913                                                        key          : "rb23_temp", 
1914                                                        descr        : "RB23 (FPGA) temperature is out of bounds!",
1915                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1916                                                        config       : TofAlertConfig::new(),
1917                                                        variable     : Variable::FPGATemp,
1918                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1919                                                        component    : Component::RB(23),
1920                                                        n_paged      : 0,
1921                                                        triggered    : None}),
1922                                    ("rb23_hk_too_old" , TofAlert {
1923                                                        key          : "rb23_hk_too_old", 
1924                                                        descr        : "RB23 RBMoniData is out-of-date!",
1925                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1926                                                        config       : TofAlertConfig::new(),
1927                                                        variable     : Variable::MoniData,
1928                                                        outofbound   : OutOfBound::TooOld,
1929                                                        component    : Component::RB(23),
1930                                                        n_paged      : 0,
1931                                                        triggered    : None}),
1932                                    ("rb24_rate_zero" , TofAlert {
1933                                                        key          : "rb24_rate_zero", 
1934                                                        descr        : "RB24 is not triggering!", 
1935                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1936                                                        config       : TofAlertConfig::new(),
1937                                                        variable     : Variable::TriggerRate,
1938                                                        outofbound   : OutOfBound::Zero,
1939                                                        component    : Component::RB(24),
1940                                                        n_paged      : 0,
1941                                                        triggered    : None}),
1942                                    ("rb24_temp" , TofAlert {
1943                                                        key          : "rb24_temp", 
1944                                                        descr        : "RB24 (FPGA) temperature is out of bounds!",
1945                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1946                                                        config       : TofAlertConfig::new(),
1947                                                        variable     : Variable::FPGATemp,
1948                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1949                                                        component    : Component::RB(24),
1950                                                        n_paged      : 0,
1951                                                        triggered    : None}),
1952                                    ("rb24_hk_too_old" , TofAlert {
1953                                                        key          : "rb24_hk_too_old", 
1954                                                        descr        : "RB24 RBMoniData is out-of-date!",
1955                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1956                                                        config       : TofAlertConfig::new(),
1957                                                        variable     : Variable::MoniData,
1958                                                        outofbound   : OutOfBound::TooOld,
1959                                                        component    : Component::RB(24),
1960                                                        n_paged      : 0,
1961                                                        triggered    : None}),
1962                                    ("rb25_rate_zero" , TofAlert {
1963                                                        key          : "rb25_rate_zero", 
1964                                                        descr        : "RB25 is not triggering!", 
1965                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1966                                                        config       : TofAlertConfig::new(),
1967                                                        variable     : Variable::TriggerRate,
1968                                                        outofbound   : OutOfBound::Zero,
1969                                                        component    : Component::RB(25),
1970                                                        n_paged      : 0,
1971                                                        triggered    : None}),
1972                                    ("rb25_temp" , TofAlert {
1973                                                        key          : "rb25_temp", 
1974                                                        descr        : "RB25 (FPGA) temperature is out of bounds!",
1975                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
1976                                                        config       : TofAlertConfig::new(),
1977                                                        variable     : Variable::FPGATemp,
1978                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
1979                                                        component    : Component::RB(25),
1980                                                        n_paged      : 0,
1981                                                        triggered    : None}),
1982                                    ("rb25_hk_too_old" , TofAlert {
1983                                                        key          : "rb25_hk_too_old", 
1984                                                        descr        : "RB25 RBMoniData is out-of-date!",
1985                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
1986                                                        config       : TofAlertConfig::new(),
1987                                                        variable     : Variable::MoniData,
1988                                                        outofbound   : OutOfBound::TooOld,
1989                                                        component    : Component::RB(25),
1990                                                        n_paged      : 0,
1991                                                        triggered    : None}),
1992                                    ("rb26_rate_zero" , TofAlert {
1993                                                        key          : "rb26_rate_zero", 
1994                                                        descr        : "RB26 is not triggering!", 
1995                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
1996                                                        config       : TofAlertConfig::new(),
1997                                                        variable     : Variable::TriggerRate,
1998                                                        outofbound   : OutOfBound::Zero,
1999                                                        component    : Component::RB(26),
2000                                                        n_paged      : 0,
2001                                                        triggered    : None}),
2002                                    ("rb26_temp" , TofAlert {
2003                                                        key          : "rb26_temp", 
2004                                                        descr        : "RB26 (FPGA) temperature is out of bounds!",
2005                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2006                                                        config       : TofAlertConfig::new(),
2007                                                        variable     : Variable::FPGATemp,
2008                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2009                                                        component    : Component::RB(26),
2010                                                        n_paged      : 0,
2011                                                        triggered    : None}),
2012                                    ("rb26_hk_too_old" , TofAlert {
2013                                                        key          : "rb26_hk_too_old", 
2014                                                        descr        : "RB26 RBMoniData is out-of-date!",
2015                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2016                                                        config       : TofAlertConfig::new(),
2017                                                        variable     : Variable::MoniData,
2018                                                        outofbound   : OutOfBound::TooOld,
2019                                                        component    : Component::RB(26),
2020                                                        n_paged      : 0,
2021                                                        triggered    : None}),
2022                                    ("rb27_rate_zero" , TofAlert {
2023                                                        key          : "rb27_rate_zero", 
2024                                                        descr        : "RB27 is not triggering!", 
2025                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2026                                                        config       : TofAlertConfig::new(),
2027                                                        variable     : Variable::TriggerRate,
2028                                                        outofbound   : OutOfBound::Zero,
2029                                                        component    : Component::RB(27),
2030                                                        n_paged      : 0,
2031                                                        triggered    : None}),
2032                                    ("rb27_temp" , TofAlert {
2033                                                        key          : "rb27_temp", 
2034                                                        descr        : "RB27 (FPGA) temperature is out of bounds!",
2035                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2036                                                        config       : TofAlertConfig::new(),
2037                                                        variable     : Variable::FPGATemp,
2038                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2039                                                        component    : Component::RB(27),
2040                                                        n_paged      : 0,
2041                                                        triggered    : None}),
2042                                    ("rb27_hk_too_old" , TofAlert {
2043                                                        key          : "rb27_hk_too_old", 
2044                                                        descr        : "RB27 RBMoniData is out-of-date!",
2045                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2046                                                        config       : TofAlertConfig::new(),
2047                                                        variable     : Variable::MoniData,
2048                                                        outofbound   : OutOfBound::TooOld,
2049                                                        component    : Component::RB(27),
2050                                                        n_paged      : 0,
2051                                                        triggered    : None}),
2052                                    ("rb28_rate_zero" , TofAlert {
2053                                                        key          : "rb28_rate_zero", 
2054                                                        descr        : "RB28 is not triggering!", 
2055                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2056                                                        config       : TofAlertConfig::new(),
2057                                                        variable     : Variable::TriggerRate,
2058                                                        outofbound   : OutOfBound::Zero,
2059                                                        component    : Component::RB(28),
2060                                                        n_paged      : 0,
2061                                                        triggered    : None}),
2062                                    ("rb28_temp" , TofAlert {
2063                                                        key          : "rb28_temp", 
2064                                                        descr        : "RB28 (FPGA) temperature is out of bounds!",
2065                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2066                                                        config       : TofAlertConfig::new(),
2067                                                        variable     : Variable::FPGATemp,
2068                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2069                                                        component    : Component::RB(28),
2070                                                        n_paged      : 0,
2071                                                        triggered    : None}),
2072                                    ("rb28_hk_too_old" , TofAlert {
2073                                                        key          : "rb28_hk_too_old", 
2074                                                        descr        : "RB28 RBMoniData is out-of-date!",
2075                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2076                                                        config       : TofAlertConfig::new(),
2077                                                        variable     : Variable::MoniData,
2078                                                        outofbound   : OutOfBound::TooOld,
2079                                                        component    : Component::RB(28),
2080                                                        n_paged      : 0,
2081                                                        triggered    : None}),
2082                                    ("rb29_rate_zero" , TofAlert {
2083                                                        key          : "rb29_rate_zero", 
2084                                                        descr        : "RB29 is not triggering!", 
2085                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2086                                                        config       : TofAlertConfig::new(),
2087                                                        variable     : Variable::TriggerRate,
2088                                                        outofbound   : OutOfBound::Zero,
2089                                                        component    : Component::RB(29),
2090                                                        n_paged      : 0,
2091                                                        triggered    : None}),
2092                                    ("rb29_temp" , TofAlert {
2093                                                        key          : "rb29_temp", 
2094                                                        descr        : "RB29 (FPGA) temperature is out of bounds!",
2095                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2096                                                        config       : TofAlertConfig::new(),
2097                                                        variable     : Variable::FPGATemp,
2098                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2099                                                        component    : Component::RB(29),
2100                                                        n_paged      : 0,
2101                                                        triggered    : None}),
2102                                    ("rb29_hk_too_old" , TofAlert {
2103                                                        key          : "rb29_hk_too_old", 
2104                                                        descr        : "RB29 RBMoniData is out-of-date!",
2105                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2106                                                        config       : TofAlertConfig::new(),
2107                                                        variable     : Variable::MoniData,
2108                                                        outofbound   : OutOfBound::TooOld,
2109                                                        component    : Component::RB(29),
2110                                                        n_paged      : 0,
2111                                                        triggered    : None}),
2112                                    ////////////////////////////////////////////////////////
2113                                    ("rb30_rate_zero" , TofAlert {
2114                                                        key          : "rb30_rate_zero", 
2115                                                        descr        : "RB30 is not triggering!", 
2116                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2117                                                        config       : TofAlertConfig::new(),
2118                                                        variable     : Variable::TriggerRate,
2119                                                        outofbound   : OutOfBound::Zero,
2120                                                        component    : Component::RB(30),
2121                                                        n_paged      : 0,
2122                                                        triggered    : None}),
2123                                    ("rb30_temp" , TofAlert {
2124                                                        key          : "rb30_temp", 
2125                                                        descr        : "RB30 (FPGA) temperature is out of bounds!",
2126                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2127                                                        config       : TofAlertConfig::new(),
2128                                                        variable     : Variable::FPGATemp,
2129                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2130                                                        component    : Component::RB(30),
2131                                                        n_paged      : 0,
2132                                                        triggered    : None}),
2133                                    ("rb30_hk_too_old" , TofAlert {
2134                                                        key          : "rb30_hk_too_old", 
2135                                                        descr        : "RB30 RBMoniData is out-of-date!",
2136                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2137                                                        config       : TofAlertConfig::new(),
2138                                                        variable     : Variable::MoniData,
2139                                                        outofbound   : OutOfBound::TooOld,
2140                                                        component    : Component::RB(30),
2141                                                        n_paged      : 0,
2142                                                        triggered    : None}),
2143                                    ("rb31_rate_zero" , TofAlert {
2144                                                        key          : "rb31_rate_zero", 
2145                                                        descr        : "RB31 is not triggering!", 
2146                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2147                                                        config       : TofAlertConfig::new(),
2148                                                        variable     : Variable::TriggerRate,
2149                                                        outofbound   : OutOfBound::Zero,
2150                                                        component    : Component::RB(31),
2151                                                        n_paged      : 0,
2152                                                        triggered    : None}),
2153                                    ("rb31_temp" , TofAlert {
2154                                                        key          : "rb31_temp", 
2155                                                        descr        : "RB31 (FPGA) temperature is out of bounds!",
2156                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2157                                                        config       : TofAlertConfig::new(),
2158                                                        variable     : Variable::FPGATemp,
2159                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2160                                                        component    : Component::RB(31),
2161                                                        n_paged      : 0,
2162                                                        triggered    : None}),
2163                                    ("rb31_hk_too_old" , TofAlert {
2164                                                        key          : "rb31_hk_too_old", 
2165                                                        descr        : "RB31 RBMoniData is out-of-date!",
2166                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2167                                                        config       : TofAlertConfig::new(),
2168                                                        variable     : Variable::MoniData,
2169                                                        outofbound   : OutOfBound::TooOld,
2170                                                        component    : Component::RB(31),
2171                                                        n_paged      : 0,
2172                                                        triggered    : None}),
2173                                    ("rb32_rate_zero" , TofAlert {
2174                                                        key          : "rb32_rate_zero", 
2175                                                        descr        : "RB32 is not triggering!", 
2176                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2177                                                        config       : TofAlertConfig::new(),
2178                                                        variable     : Variable::TriggerRate,
2179                                                        outofbound   : OutOfBound::Zero,
2180                                                        component    : Component::RB(32),
2181                                                        n_paged      : 0,
2182                                                        triggered    : None}),
2183                                    ("rb32_temp" , TofAlert {
2184                                                        key          : "rb32_temp", 
2185                                                        descr        : "RB32 (FPGA) temperature is out of bounds!",
2186                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2187                                                        config       : TofAlertConfig::new(),
2188                                                        variable     : Variable::FPGATemp,
2189                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2190                                                        component    : Component::RB(32),
2191                                                        n_paged      : 0,
2192                                                        triggered    : None}),
2193                                    ("rb32_hk_too_old" , TofAlert {
2194                                                        key          : "rb32_hk_too_old", 
2195                                                        descr        : "RB30 RBMoniData is out-of-date!",
2196                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2197                                                        config       : TofAlertConfig::new(),
2198                                                        variable     : Variable::MoniData,
2199                                                        outofbound   : OutOfBound::TooOld,
2200                                                        component    : Component::RB(32),
2201                                                        n_paged      : 0,
2202                                                        triggered    : None}),
2203                                    ("rb33_rate_zero" , TofAlert {
2204                                                        key          : "rb33_rate_zero", 
2205                                                        descr        : "RB33 is not triggering!", 
2206                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2207                                                        config       : TofAlertConfig::new(),
2208                                                        variable     : Variable::TriggerRate,
2209                                                        outofbound   : OutOfBound::Zero,
2210                                                        component    : Component::RB(33),
2211                                                        n_paged      : 0,
2212                                                        triggered    : None}),
2213                                    ("rb33_temp" , TofAlert {
2214                                                        key          : "rb33_temp", 
2215                                                        descr        : "RB33 (FPGA) temperature is out of bounds!",
2216                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2217                                                        config       : TofAlertConfig::new(),
2218                                                        variable     : Variable::FPGATemp,
2219                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2220                                                        component    : Component::RB(33),
2221                                                        n_paged      : 0,
2222                                                        triggered    : None}),
2223                                    ("rb33_hk_too_old" , TofAlert {
2224                                                        key          : "rb33_hk_too_old", 
2225                                                        descr        : "RB33 RBMoniData is out-of-date!",
2226                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2227                                                        config       : TofAlertConfig::new(),
2228                                                        variable     : Variable::MoniData,
2229                                                        outofbound   : OutOfBound::TooOld,
2230                                                        component    : Component::RB(33),
2231                                                        n_paged      : 0,
2232                                                        triggered    : None}),
2233                                    ("rb34_rate_zero" , TofAlert {
2234                                                        key          : "rb34_rate_zero", 
2235                                                        descr        : "RB34 is not triggering!", 
2236                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2237                                                        config       : TofAlertConfig::new(),
2238                                                        variable     : Variable::TriggerRate,
2239                                                        outofbound   : OutOfBound::Zero,
2240                                                        component    : Component::RB(34),
2241                                                        n_paged      : 0,
2242                                                        triggered    : None}),
2243                                    ("rb34_temp" , TofAlert {
2244                                                        key          : "rb34_temp", 
2245                                                        descr        : "RB34 (FPGA) temperature is out of bounds!",
2246                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2247                                                        config       : TofAlertConfig::new(),
2248                                                        variable     : Variable::FPGATemp,
2249                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2250                                                        component    : Component::RB(34),
2251                                                        n_paged      : 0,
2252                                                        triggered    : None}),
2253                                    ("rb34_hk_too_old" , TofAlert {
2254                                                        key          : "rb34_hk_too_old", 
2255                                                        descr        : "RB34 RBMoniData is out-of-date!",
2256                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2257                                                        config       : TofAlertConfig::new(),
2258                                                        variable     : Variable::MoniData,
2259                                                        outofbound   : OutOfBound::TooOld,
2260                                                        component    : Component::RB(34),
2261                                                        n_paged      : 0,
2262                                                        triggered    : None}),
2263                                    ("rb35_rate_zero" , TofAlert {
2264                                                        key          : "rb35_rate_zero", 
2265                                                        descr        : "RB35 is not triggering!", 
2266                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2267                                                        config       : TofAlertConfig::new(),
2268                                                        variable     : Variable::TriggerRate,
2269                                                        outofbound   : OutOfBound::Zero,
2270                                                        component    : Component::RB(35),
2271                                                        n_paged      : 0,
2272                                                        triggered    : None}),
2273                                    ("rb35_temp" , TofAlert {
2274                                                        key          : "rb35_temp", 
2275                                                        descr        : "RB35 (FPGA) temperature is out of bounds!",
2276                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2277                                                        config       : TofAlertConfig::new(),
2278                                                        variable     : Variable::FPGATemp,
2279                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2280                                                        component    : Component::RB(35),
2281                                                        n_paged      : 0,
2282                                                        triggered    : None}),
2283                                    ("rb35_hk_too_old" , TofAlert {
2284                                                        key          : "rb35_hk_too_old", 
2285                                                        descr        : "RB35 RBMoniData is out-of-date!",
2286                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2287                                                        config       : TofAlertConfig::new(),
2288                                                        variable     : Variable::MoniData,
2289                                                        outofbound   : OutOfBound::TooOld,
2290                                                        component    : Component::RB(35),
2291                                                        n_paged      : 0,
2292                                                        triggered    : None}),
2293                                    ("rb36_rate_zero" , TofAlert {
2294                                                        key          : "rb36_rate_zero", 
2295                                                        descr        : "RB36 is not triggering!", 
2296                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2297                                                        config       : TofAlertConfig::new(),
2298                                                        variable     : Variable::TriggerRate,
2299                                                        outofbound   : OutOfBound::Zero,
2300                                                        component    : Component::RB(36),
2301                                                        n_paged      : 0,
2302                                                        triggered    : None}),
2303                                    ("rb36_temp" , TofAlert {
2304                                                        key          : "rb36_temp", 
2305                                                        descr        : "RB36 (FPGA) temperature is out of bounds!",
2306                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2307                                                        config       : TofAlertConfig::new(),
2308                                                        variable     : Variable::FPGATemp,
2309                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2310                                                        component    : Component::RB(36),
2311                                                        n_paged      : 0,
2312                                                        triggered    : None}),
2313                                    ("rb36_hk_too_old" , TofAlert {
2314                                                        key          : "rb36_hk_too_old", 
2315                                                        descr        : "RB36 RBMoniData is out-of-date!",
2316                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2317                                                        config       : TofAlertConfig::new(),
2318                                                        variable     : Variable::MoniData,
2319                                                        outofbound   : OutOfBound::TooOld,
2320                                                        component    : Component::RB(36),
2321                                                        n_paged      : 0,
2322                                                        triggered    : None}),
2323                                    ("rb39_rate_zero" , TofAlert {
2324                                                        key          : "rb39_rate_zero", 
2325                                                        descr        : "RB39 is not triggering!", 
2326                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2327                                                        config       : TofAlertConfig::new(),
2328                                                        variable     : Variable::TriggerRate,
2329                                                        outofbound   : OutOfBound::Zero,
2330                                                        component    : Component::RB(39),
2331                                                        n_paged      : 0,
2332                                                        triggered    : None}),
2333                                    ("rb39_temp" , TofAlert {
2334                                                        key          : "rb39_temp", 
2335                                                        descr        : "RB39 (FPGA) temperature is out of bounds!",
2336                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2337                                                        config       : TofAlertConfig::new(),
2338                                                        variable     : Variable::FPGATemp,
2339                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2340                                                        component    : Component::RB(39),
2341                                                        n_paged      : 0,
2342                                                        triggered    : None}),
2343                                    ("rb39_hk_too_old" , TofAlert {
2344                                                        key          : "rb39_hk_too_old", 
2345                                                        descr        : "RB39 RBMoniData is out-of-date!",
2346                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2347                                                        config       : TofAlertConfig::new(),
2348                                                        variable     : Variable::MoniData,
2349                                                        outofbound   : OutOfBound::TooOld,
2350                                                        component    : Component::RB(39),
2351                                                        n_paged      : 0,
2352                                                        triggered    : None}),
2353                                ///////////////////////////////////////////////////////////
2354                                    ("rb40_rate_zero" , TofAlert {
2355                                                        key          : "rb40_rate_zero", 
2356                                                        descr        : "RB40 is not triggering!", 
2357                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2358                                                        config       : TofAlertConfig::new(),
2359                                                        variable     : Variable::TriggerRate,
2360                                                        outofbound   : OutOfBound::Zero,
2361                                                        component    : Component::RB(40),
2362                                                        n_paged      : 0,
2363                                                        triggered    : None}),
2364                                    ("rb40_temp" , TofAlert {
2365                                                        key          : "rb40_temp", 
2366                                                        descr        : "RB40 (FPGA) temperature is out of bounds!",
2367                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2368                                                        config       : TofAlertConfig::new(),
2369                                                        variable     : Variable::FPGATemp,
2370                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2371                                                        component    : Component::RB(40),
2372                                                        n_paged      : 0,
2373                                                        triggered    : None}),
2374                                    ("rb40_hk_too_old" , TofAlert {
2375                                                        key          : "rb40_hk_too_old", 
2376                                                        descr        : "RB40 RBMoniData is out-of-date!",
2377                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2378                                                        config       : TofAlertConfig::new(),
2379                                                        variable     : Variable::MoniData,
2380                                                        outofbound   : OutOfBound::TooOld,
2381                                                        component    : Component::RB(40),
2382                                                        n_paged      : 0,
2383                                                        triggered    : None}),
2384                                    ("rb41_rate_zero" , TofAlert {
2385                                                        key          : "rb41_rate_zero", 
2386                                                        descr        : "RB41 is not triggering!", 
2387                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2388                                                        config       : TofAlertConfig::new(),
2389                                                        variable     : Variable::TriggerRate,
2390                                                        outofbound   : OutOfBound::Zero,
2391                                                        component    : Component::RB(41),
2392                                                        n_paged      : 0,
2393                                                        triggered    : None}),
2394                                    ("rb41_temp" , TofAlert {
2395                                                        key          : "rb41_temp", 
2396                                                        descr        : "RB41 (FPGA) temperature is out of bounds!",
2397                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2398                                                        config       : TofAlertConfig::new(),
2399                                                        variable     : Variable::FPGATemp,
2400                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2401                                                        component    : Component::RB(41),
2402                                                        n_paged      : 0,
2403                                                        triggered    : None}),
2404                                    ("rb41_hk_too_old" , TofAlert {
2405                                                        key          : "rb41_hk_too_old", 
2406                                                        descr        : "RB41 RBMoniData is out-of-date!",
2407                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2408                                                        config       : TofAlertConfig::new(),
2409                                                        variable     : Variable::MoniData,
2410                                                        outofbound   : OutOfBound::TooOld,
2411                                                        component    : Component::RB(41),
2412                                                        n_paged      : 0,
2413                                                        triggered    : None}),
2414                                    ("rb42_rate_zero" , TofAlert {
2415                                                        key          : "rb42_rate_zero", 
2416                                                        descr        : "RB42 is not triggering!", 
2417                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2418                                                        config       : TofAlertConfig::new(),
2419                                                        variable     : Variable::TriggerRate,
2420                                                        outofbound   : OutOfBound::Zero,
2421                                                        component    : Component::RB(42),
2422                                                        n_paged      : 0,
2423                                                        triggered    : None}),
2424                                    ("rb42_temp" , TofAlert {
2425                                                        key          : "rb42_temp", 
2426                                                        descr        : "RB42 (FPGA) temperature is out of bounds!",
2427                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2428                                                        config       : TofAlertConfig::new(),
2429                                                        variable     : Variable::FPGATemp,
2430                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2431                                                        component    : Component::RB(42),
2432                                                        n_paged      : 0,
2433                                                        triggered    : None}),
2434                                    ("rb42_hk_too_old" , TofAlert {
2435                                                        key          : "rb42_hk_too_old", 
2436                                                        descr        : "RB42 RBMoniData is out-of-date!",
2437                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2438                                                        config       : TofAlertConfig::new(),
2439                                                        variable     : Variable::MoniData,
2440                                                        outofbound   : OutOfBound::TooOld,
2441                                                        component    : Component::RB(42),
2442                                                        n_paged      : 0,
2443                                                        triggered    : None}),
2444                                    ("rb44_rate_zero" , TofAlert {
2445                                                        key          : "rb44_rate_zero", 
2446                                                        descr        : "RB44 is not triggering!", 
2447                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2448                                                        config       : TofAlertConfig::new(),
2449                                                        variable     : Variable::TriggerRate,
2450                                                        outofbound   : OutOfBound::Zero,
2451                                                        component    : Component::RB(44),
2452                                                        n_paged      : 0,
2453                                                        triggered    : None}),
2454                                    ("rb44_temp" , TofAlert {
2455                                                        key          : "rb44_temp", 
2456                                                        descr        : "RB44 (FPGA) temperature is out of bounds!",
2457                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2458                                                        config       : TofAlertConfig::new(),
2459                                                        variable     : Variable::FPGATemp,
2460                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2461                                                        component    : Component::RB(44),
2462                                                        n_paged      : 0,
2463                                                        triggered    : None}),
2464                                    ("rb44_hk_too_old" , TofAlert {
2465                                                        key          : "rb44_hk_too_old", 
2466                                                        descr        : "RB44 RBMoniData is out-of-date!",
2467                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2468                                                        config       : TofAlertConfig::new(),
2469                                                        variable     : Variable::MoniData,
2470                                                        outofbound   : OutOfBound::TooOld,
2471                                                        component    : Component::RB(44),
2472                                                        n_paged      : 0,
2473                                                        triggered    : None}),
2474                                    ("rb46_rate_zero" , TofAlert {
2475                                                        key          : "rb46_rate_zero", 
2476                                                        descr        : "RB46 is not triggering!", 
2477                                                        whattodo     : vec!["If we are getting HK data, but the RAT is not triggering, this indicated an issue with either the RAT (the other RB might be down as well or the MTB", "If the other RB in the RAT is working, try soft rebooting the MTB", "Hard reboot the MTB"],
2478                                                        config       : TofAlertConfig::new(),
2479                                                        variable     : Variable::TriggerRate,
2480                                                        outofbound   : OutOfBound::Zero,
2481                                                        component    : Component::RB(46),
2482                                                        n_paged      : 0,
2483                                                        triggered    : None}),
2484                                    ("rb46_temp" , TofAlert {
2485                                                        key          : "rb46_temp", 
2486                                                        descr        : "RB46 (FPGA) temperature is out of bounds!",
2487                                                        whattodo     : vec!["This is critical!" ,  "Check with everybody and then likeliy switch off the RAT"],
2488                                                        config       : TofAlertConfig::new(),
2489                                                        variable     : Variable::FPGATemp,
2490                                                        outofbound   : OutOfBound::TooLowOrTooHigh,
2491                                                        component    : Component::RB(46),
2492                                                        n_paged      : 0,
2493                                                        triggered    : None}),
2494                                    ("rb46_hk_too_old" , TofAlert {
2495                                                        key          : "rb46_hk_too_old", 
2496                                                        descr        : "RB46 RBMoniData is out-of-date!",
2497                                                        whattodo     : vec!["Maybe the RB is down?" ,  "Telemetry issues?", "Have an eye on it and take notes"],
2498                                                        config       : TofAlertConfig::new(),
2499                                                        variable     : Variable::MoniData,
2500                                                        outofbound   : OutOfBound::TooOld,
2501                                                        component    : Component::RB(46),
2502                                                        n_paged      : 0,
2503                                                        triggered    : None}),
2504
2505  ]);
2506   // rb ids
2507   // 1,2,3,4,5,6,7,8,9,11,13,14,15,16,17,18,19,
2508   // 20,21,22,23,24,25,26,27,28,29,
2509   // 30,31,32,33,34,35,36,
2510   // 39,40,41,44,46
2511
2512//  TofAlert {
2513//    key          : "rb_rate_zero",
2514//    descr        : "RB1 is not triggering!",
2515//    whattodo     : vec!["1) Run restart", "2) Restart liftof-rb", "3) Soft reboot RB", "4) Soft reboot MTB", "5) Hard reboot RAT",  "6) Hard reboot MTB"],
2516//    config       : TofAlertConfig::new(),
2517//    variable     : Variable::TriggerRate,
2518//    outofbound   : OutOfBound::Zero,
2519//    component    : Component::RB(rb_id),
2520//    acknowledged : false,
2521//    created      : None,
2522//  }
2523  //let mut alerts = HashMap::<&str, TofAlert>::new();
2524  for k in manifest.keys() {
2525    println!("{}",k);
2526    alerts.get_mut(k).unwrap().config = manifest.get(k).unwrap().clone();
2527  }
2528  alerts
2529
2530}
2531
2532#[test]
2533fn write_alert_manifest() {
2534  let settings = TofAlertManifest::new();
2535  //println!("{}", settings);
2536  settings.to_toml(String::from("alert-manifest-test.toml"));
2537}
2538
2539#[test]
2540fn read_alert_manifest() {
2541  let _settings = TofAlertManifest::from_toml("alert-manifest-test.toml");
2542}