def parameter_valuespec(self): return Dictionary(elements=[ ("queue_length", Tuple( title=_("Queue length"), elements=[ Integer(title=_("Warning above"), unit="Tasks"), Integer(title=_("Critical above"), unit="Tasks"), ], )), ('in_queue_since', Tuple( title=_("Task in queue since"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ],)
def _parameter_valuespec_vm_snapshots(): return Dictionary(elements=[ ("age_oldest", Tuple( title=_("Age of the oldest snapshot"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")) ], )), ("age", Tuple( title=_("Age of the latest snapshot"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")) ], )), ], )
def parameter_valuespec(self): return Dictionary(elements=[ ("signature_age", Tuple( title=_("Time Settings for Signature"), elements=[ Age(title=_("Warning at"), default_value=86400), Age(title=_("Critical at"), default_value=7 * 86400), ], )), ("fullscan_age", Tuple( title=_("Time Settings for Fullscan"), elements=[ Age(title=_("Warning at"), default_value=86400), Age(title=_("Critical at"), default_value=7 * 86400), ], )), ], )
def _parameter_valuespec_fileinfo(): return Dictionary(elements=[ ("minage", Tuple( title=_("Minimal age"), elements=[ Age(title=_("Warning if younger than")), Age(title=_("Critical if younger than")), ], )), ("maxage", Tuple( title=_("Maximal age"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ("minsize", Tuple( title=_("Minimal size"), elements=[ Filesize(title=_("Warning if below")), Filesize(title=_("Critical if below")), ], )), ("maxsize", Tuple( title=_("Maximal size"), elements=[ Filesize(title=_("Warning at")), Filesize(title=_("Critical at")), ], )), ("timeofday", ListOfTimeRanges( title=_("Only check during the following times of the day"), help=_("Outside these ranges the check will always be OK"), )), ("state_missing", MonitoringState(default_value=3, title=_("State when file is missing"))), ], )
def _parameter_valuespec_uptime(): return Dictionary(elements=[ ("min", Tuple( title=_("Minimum required uptime"), elements=[ Age(title=_("Warning if below")), Age(title=_("Critical if below")), ], )), ("max", Tuple( title=_("Maximum allowed uptime"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ], )
def filter_table_with_conversion(self, rows, conv): from_value = Age().from_html_vars(self.ident + "_from") to_value = Age().from_html_vars(self.ident + "_to") if not from_value and not to_value: return rows newrows = [] for row in rows: value = row.get(self.ident, None) if value is not None: age = conv(value) if from_value and age < from_value: continue if to_value and age > to_value: continue newrows.append(row) return newrows
def action(self, cmdtag, spec, row, row_index, num_rows): if "aggr_tree" in row: # BI mode specs = [] for site, host, service in bi.find_all_leaves(row["aggr_tree"]): if service: spec = "%s;%s" % (host, service) cmdtag = "SVC" else: spec = host cmdtag = "HOST" specs.append((site, spec, cmdtag)) if html.request.var("_acknowledge"): comment = html.get_unicode_input("_ack_comment") if not comment: raise MKUserError("_ack_comment", _("You need to supply a comment.")) if ";" in comment: raise MKUserError("_ack_comment", _("The comment must not contain semicolons.")) sticky = 2 if html.request.var("_ack_sticky") else 0 sendnot = 1 if html.request.var("_ack_notify") else 0 perscomm = 1 if html.request.var("_ack_persistent") else 0 expire_secs = self._vs_expire().from_html_vars("_ack_expire") if expire_secs: expire = int(time.time()) + expire_secs expire_text = ";%d" % expire else: expire_text = "" def make_command(spec, cmdtag): return "ACKNOWLEDGE_" + cmdtag + "_PROBLEM;%s;%d;%d;%d;%s" % ( spec, sticky, sendnot, perscomm, config.user.id) + ( ";%s" % livestatus.lqencode(comment)) + expire_text if "aggr_tree" in row: # BI mode commands = [(site, make_command(spec, cmdtag)) for (site, spec, cmdtag) in specs] else: commands = [make_command(spec, cmdtag)] title = _("<b>acknowledge the problems%s</b> of") % ( expire_text and (_(" for a period of %s") % Age().value_to_text(expire_secs)) or "") return commands, title elif html.request.var("_remove_ack"): def make_command(spec, cmdtag): return "REMOVE_" + cmdtag + "_ACKNOWLEDGEMENT;%s" % spec if "aggr_tree" in row: # BI mode commands = [(site, make_command(spec, cmdtag)) for (site, spec, cmdtag) in specs] else: commands = [make_command(spec, cmdtag)] title = _("<b>remove acknowledgements</b> from") return commands, title
def valuespec(self): return Dictionary( title=_("RRDCached tuning"), elements=[ ("TIMEOUT", Age( title=_("Disk flush interval of updated metrics"), help=_("Updated metrics are written to disk in the configured interval. " "The write operation is only performed for metrics that are being " "updated. Old metrics are not affected by this option."), minvalue=0, )), ("RANDOM_DELAY", Age( title=_("Random delay"), help=_("The rrdcached will delay writing of each metric for a random " "number of seconds in the range [0..delay]. This will avoid too many " "writes being queued simultaneously. This number should not be " "higher than the value specified in \"Disk flush interval of " "updated metrics\"."), minvalue=0, )), ("FLUSH_TIMEOUT", Age( title=_("Disk flush interval of old data"), help=_("The entire cache is searched in the interval configured here for old " "values which shal be written to disk. This only concerns RRD files to " "which updates have stopped, so setting this to a high value is " "acceptable in most cases."), minvalue=0, )), ("WRITE_THREADS", Integer( title=_("Number of threads used for writing RRD files"), help=_("Increasing this number will allow rrdcached to have more simultaneous " "I/O requests into the kernel. This may allow the kernel to re-order " "disk writes, resulting in better disk throughput."), minvalue=1, maxvalue=100)), ], optional_keys=[], )
def _parameter_valuespec_mcafee_av_client(): return Transform( valuespec=Dictionary( elements=[ ( "signature_age", Tuple( title=_("Time Settings for Signature"), elements=[ Age(title=_("Warning at"), default_value=86400), Age(title=_("Critical at"), default_value=7 * 86400), ], ), ), ], optional_keys=[], ), forth=_transform_mcafee_av_client, )
def _vs_fortinet_signatures(title): return Alternative( title=title, elements=[ Tuple( title=_("Set levels"), elements=[ Age(title=_("Warning at"), default_value=86400), Age(title=_("Critical at"), default_value=2 * 86400), ], ), Tuple( title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ], ), ], )
def _parameter_valuespec_systemtime(): return Transform( valuespec=Dictionary( title="Time offset", elements=[ ( "levels", Tuple( title=_("Levels on time offset"), elements=[ Age(title=_("Warning at"), default_value=30), Age(title=_("Critical at"), default_value=60), ], ), ), ], optional_keys=False, ), forth=lambda v: {"levels": v} if isinstance(v, tuple) else v, )
def _parameter_valuespec_splunk_license_state(): return Dictionary( elements=[ ("state", MonitoringState(title=_("State if license is expired"), default_value=2)), ("expiration_time", Tuple( title=_("Time until license expiration"), help=_("Remaining days until the Windows license expires"), elements=[ Age(title=_("Warning at"), default_value=14 * 24 * 60 * 60), Age(title=_("Critical at"), default_value=7 * 24 * 60 * 60) ], )), ], optional_keys=["state", "expiration_time", "usage_bytes"], )
def _parameter_valuespec_mysql_slave(): return Dictionary( elements=[ ( "seconds_behind_master", Tuple( title=_("Max. time behind the master"), help= _("Compares the time which the slave can be behind the master. " "This rule makes the check raise warning/critical states if the time is equal to " "or above the configured levels."), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], ), ), ], optional_keys=False, )
def _parameter_valuespec_oracle_undostat(): return Dictionary(elements=[ ("levels", Tuple( title=_("Levels for remaining undo retention"), elements=[ Age(title=_("warning if less then"), default_value=600), Age(title=_("critical if less then"), default_value=300), ], )), ( 'nospaceerrcnt_state', MonitoringState( default_value=2, title=_( "State in case of non space error count is greater then 0: " ), ), ), ], )
def _parameter_valuespec_win_license(): return Dictionary(elements=[ ("status", ListOfStrings( title=_("Allowed license states"), help=_( "Here you can specify the allowed license states for windows." ), default_value=['Licensed', 'Initial grace period'], )), ("expiration_time", Tuple( title=_("Time until license expiration"), help=_("Remaining days until the Windows license expires"), elements=[ Age(title=_("Warning at"), default_value=14 * 24 * 60 * 60), Age(title=_("Critical at"), default_value=7 * 24 * 60 * 60) ], )), ], )
def valuespec(self): return Age( title=_("Failed notification horizon"), help= _("The tactical overview snapin is reporing about notifications that could not be sent " 'by Check_MK. Users with the permission "See failed Notifications (all)" get the number ' "of failed notification within the configured horizon."), default_value=60 * 60 * 24 * 7, display=["days"], minvalue=60 * 60 * 24, )
def _vs_mssql_backup_age(title: str) -> Alternative: return Alternative( title=title, elements=[ Tuple( title=_("Set levels"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], ), Tuple( title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ], ), ], )
def _parameter_valuespec_plesk_backups(): return Dictionary( help=_("This check monitors backups configured for domains in plesk."), elements=[ ( "no_backup_configured_state", MonitoringState(title=_("State when no backup is configured"), default_value=1), ), ( "no_backup_found_state", MonitoringState(title=_("State when no backup can be found"), default_value=1), ), ( "backup_age", Tuple( title=_("Maximum age of backups"), help=_("The maximum age of the last backup."), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], ), ), ( "total_size", Tuple( title=_("Maximum size of all files on backup space"), help=_( "The maximum size of all files on the backup space. " "This might be set to the allowed quotas on the configured " "FTP server to be notified if the space limit is reached." ), elements=[ Filesize(title=_("Warning at")), Filesize(title=_("Critical at")), ], ), ), ], optional_keys=["backup_age", "total_size"], )
def _sec_tuple(title: str) -> Tuple: return Tuple( title=title, elements=[ Integer( title= _("Time between the last operation on primary's oplog and on secondary above" ), unit=_("seconds"), default_value=10, minvalue=0, ), Age(title=_("Warning equal or after "), default_value=5 * 60), Age(title=_("Critical equal or after "), default_value=15 * 60), ], help= _("Replication lag is a delay between an operation on the primary and the application " "of that operation from the oplog to the secondary." "With this configuration, check_mk will alert if replication lag is " "exceeding a threshold over an extended period of time."), )
def _parameter_valuespec_wlan_controllers_last_backup(): return Dictionary(elements=[ ( "last_backup", Tuple( title=_("Time since last backup"), elements=[ Age( title=_("Warning at"), display=["days", "hours", "minutes"], default_value=7 * 24 * 3600, ), Age( title=_("Critical at"), display=["days", "hours", "minutes"], default_value=30 * 24 * 3600, ), ], ), ), ], )
def parameter_valuespec(self): return Dictionary( help=_( "With this rule you can set limits for the VACUUM and ANALYZE operation of " "a PostgreSQL database. Keep in mind that each table within a database is checked " "with this limits."), elements=[ ("last_vacuum", Tuple( title=_("Time since the last VACUUM"), elements=[ Age(title=_("Warning if older than"), default_value=86400 * 7), Age(title=_("Critical if older than"), default_value=86400 * 14) ], )), ("last_analyze", Tuple( title=_("Time since the last ANALYZE"), elements=[ Age(title=_("Warning if older than"), default_value=86400 * 7), Age(title=_("Critical if older than"), default_value=86400 * 14) ], )), ("never_analyze_vacuum", Tuple( title=_("Age of never analyzed/vacuumed tables"), elements=[ Age(title=_("Warning if older than"), default_value=86400 * 7), Age(title=_("Critical if older than"), default_value=86400 * 14) ], )), ], )
def _parameter_valuespec_job(): return Dictionary(elements=[ ("age", Tuple( title=_("Maximum time since last start of job execution"), elements=[ Age(title=_("Warning at"), default_value=0), Age(title=_("Critical at"), default_value=0) ], )), ("exit_code_to_state_map", ListOf( Tuple(orientation="horizontal", elements=[ Integer(title=_("Exit code")), MonitoringState(title=_("Resulting state"), ), ], default_value=(0, 0)), title=_("Explicit mapping of job exit codes to states"), help= _("Here you can define a mapping between possible exit codes and service states. " "If no mapping is defined, the check becomes CRITICAL when the exit code is not 0. " "If an exit code occurs that is not defined in this mapping, the check becomes CRITICAL. " "If you happen to define the same exit code multiple times the first entry will be used." ), allow_empty=False, )), ("outcome_on_cluster", DropdownChoice( title=_("Clusters: Prefered check result of local checks"), help= _("If you're running local checks on clusters via clustered services rule " "you can influence the check result with this rule. You can choose between " "best or worst state. Default setting is worst state."), choices=[ ("worst", _("Worst state")), ("best", _("Best state")), ], default_value="worst")), ], )
def parameter_valuespec(self): return Dictionary(elements=[ ("jenkins_offline", MonitoringState(title=_("Node state: Offline"), default_value=2)), ('jenkins_numexecutors', Tuple( title=_("Lower level for number of executors of this node"), elements=[ Integer(title=_("Warning below")), Integer(title=_("Critical below")), ], )), ('jenkins_response', Tuple( title=_("Average round-trip response time to this node"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ('jenkins_clock', Tuple( title=_("Clock difference"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ("jenkins_temp", Tuple(title=_("Absolute levels for free temp space"), elements=[ Integer(title=_("Warning if below"), unit=_("MB"), minvalue=0), Integer(title=_("Critical if below"), unit=_("MB"), minvalue=0), ], allow_empty=False)), ], )
def _parameter_valuespec_oracle_dataguard_stats(): return Dictionary( help= _("The Data-Guard statistics are available in Oracle Enterprise Edition with enabled Data-Guard. " "The <tt>init.ora</tt> parameter <tt>dg_broker_start</tt> must be <tt>TRUE</tt> for this check. " "The apply and transport lag can be configured with this rule."), elements=[ ("active_dataguard_option", MonitoringState( title=_( "State in case of Active Data-Guard Option is active: "), help= _("The Active Data-Guard Option needs an addional License from Oracle." ), default_value=1, )), ("primary_broker_state", Checkbox( title=_("Check State of Broker on Primary: "), default_value=False, help=_( "Data-Guards with dg_broker_start=false needs Ignore Brokerstate to monitor " "the Switchoverstate on Primary."), )), ("apply_lag", Tuple( title=_("Apply Lag Maximum Time"), help= _("The maximum limit for the apply lag in <tt>v$dataguard_stats</tt>." ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ("apply_lag_min", Tuple( title=_("Apply Lag Minimum Time"), help= _("The minimum limit for the apply lag in <tt>v$dataguard_stats</tt>. " "This is only useful if also <i>Apply Lag Maximum Time</i> has been configured." ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ("transport_lag", Tuple( title=_("Transport Lag"), help= _("The limit for the transport lag in <tt>v$dataguard_stats</tt>" ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ], )
def _parameter_valuespec_websphere_mq(): return Transform( valuespec=Dictionary(elements=websphere_mq_common_elements() + [ ( "messages_not_processed", Dictionary( title=_("Settings for messages not processed"), help= _("With this rule you can determine the warn and crit age " "if LGETTIME and LGETDATE is available in the agent data. " "Note that if LGETTIME and LGETDATE are available but not set " "you can set the service state which is default WARN. " "This rule applies only if the current depth is greater than zero." ), elements=[ ( "age", Tuple( title=_("Upper levels for the age"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], ), ), ( "state", MonitoringState( title= _("State if LGETTIME and LGETDATE are available but not set" ), default_value=1, ), ), ], ), ), ], ), forth=transform_websphere_mq_queues, )
def _parameter_valuespec_postgres_maintenance(): return Dictionary( help= _("With this rule you can set limits for the VACUUM and ANALYZE operation of " "a PostgreSQL database. Keep in mind that each table within a database is checked " "with this limits."), elements=[ ( "last_vacuum", Tuple( title=_("Time since the last VACUUM"), elements=[ Age(title=_("Warning if older than"), default_value=86400 * 7), Age(title=_("Critical if older than"), default_value=86400 * 14), ], ), ), ( "last_analyze", Tuple( title=_("Time since the last ANALYZE"), elements=[ Age(title=_("Warning if older than"), default_value=86400 * 7), Age(title=_("Critical if older than"), default_value=86400 * 14), ], ), ), ( "never_analyze_vacuum", Alternative( title=_("Never analyzed/vacuumed tables"), elements=[ Tuple( title=_("Age of never analyzed/vacuumed tables"), elements=[ Age(title=_("Warning if older than"), default_value=0), Age( title=_("Critical if older than"), default_value=1000 * 365 * 24 * 3600, ), ], ), FixedValue( value=None, title= _("Do not check age of never analyzed/vacuumed tables" ), totext="", ), ], ), ), ], )
def _parameter_valuespec_job(): return Dictionary(elements=[ ("age", Tuple( title=_("Maximum time since last start of job execution"), elements=[ Age(title=_("Warning at"), default_value=0), Age(title=_("Critical at"), default_value=0) ], )), ("outcome_on_cluster", DropdownChoice( title=_("Clusters: Prefered check result of local checks"), help=_("If you're running local checks on clusters via clustered services rule " "you can influence the check result with this rule. You can choose between " "best or worst state. Default setting is worst state."), choices=[ ("worst", _("Worst state")), ("best", _("Best state")), ], default_value="worst")), ],)
def _parameter_valuespec_snapvault(): return Dictionary( elements=[ ( "lag_time", Tuple( title=_("Default levels"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], ), ), ( "policy_lag_time", ListOf( valuespec=Tuple( orientation="horizontal", elements=[ TextInput(title=_("Policy name")), Tuple( title=_("Maximum age"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], ), ], ), title=_("Policy specific levels (Clustermode only)"), help=_( "Here you can specify levels for different policies which overrule the levels " "from the <i>Default levels</i> parameter. This setting only works in NetApp Clustermode setups." ), allow_empty=False, ), ), ], )
def _parameter_valuespec_oracle_recovery_status(): return Dictionary(elements=[ ("levels", Tuple( title=_("Levels for checkpoint time"), elements=[ Age(title=_("warning if higher then"), default_value=1800), Age(title=_("critical if higher then"), default_value=3600), ], )), ("backup_age", Tuple( title=_("Levels for user managed backup files"), help=_("Important! This checks is only for monitoring of datafiles " "who were left in backup mode. " "(alter database datafile ... begin backup;) "), elements=[ Age(title=_("warning if higher then"), default_value=1800), Age(title=_("critical if higher then"), default_value=3600), ], )) ],)
def _parameter_valuespec_filestats(): return Dictionary( elements=[("min_age", Tuple( title=_("Minimal age of a file"), elements=[ Age(title=_("Warning if younger than")), Age(title=_("Critical if younger than")), ], )), ("max_age", Tuple( title=_("Maximal age of a file"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ("min_size", Tuple( title=_("Minimal size of a file"), elements=[ Filesize(title=_("Warning if below")), Filesize(title=_("Critical if below")), ], )), ("max_size", Tuple( title=_("Maximal size of a file"), elements=[ Filesize(title=_("Warning if above")), Filesize(title=_("Critical if above")), ], ))], help=_( "Here you can impose various levels the results reported by the" " mk_filstats plugin. Note that those levels only concern about a single file." ), )