How to use is_hidden method in Playwright Python

Best Python code snippet using playwright-python

variable.py

Source:variable.py Github

copy

Full Screen

1import re2from .entity import EntityType, Entity3from .validator import PropertyValidator4from .task_input import _task_input5# Variable6VARIABLE_VALUE_TYPES = {7 "int": "INT",8 "date": "DATE",9 "time": "TIME",10 "dict": "DICT",11 "string": "STRING",12 "data_time": "DATE_TIME",13 "multiline_string": "MULTILINE_STRING",14}15VARIABLE_DATA_TYPES = {16 "base": "BASE",17 "list": "LIST",18 "single_select_list": "SINGLE_SELECT_LIST",19}20class VariableType(EntityType):21 __schema_name__ = "Variable"22 __openapi_type__ = "app_variable"23 def compile(cls):24 cdict = super().compile()25 if not cdict.get("options", {}):26 del cdict["options"]27 if not cdict.get("regex", {}):28 del cdict["regex"]29 if not cdict.get("editables", {}):30 del cdict["editables"]31 if cdict.get("options", None):32 options = cdict["options"]33 # Only EScript/HTTP request info needed for dynamically fetching options34 if options["type"] == "PREDEFINED":35 del options["attrs"]36 else:37 del options["choices"] # Choices are only for PREDEFINED Type38 return cdict39class VariableValidator(PropertyValidator, openapi_type="app_variable"):40 __default__ = None41 __kind__ = VariableType42def _var(**kwargs):43 name = kwargs.get("name", None)44 bases = (Entity,)45 return VariableType(name, bases, kwargs)46Variable = _var()47def setvar(name, value, type_="LOCAL", **kwargs):48 kwargs["name"] = name49 if value is not None:50 kwargs["value"] = value51 kwargs["type"] = type_52 return VariableType(name, (Variable,), kwargs)53def simple_variable(54 value,55 name=None,56 label=None,57 regex=None,58 validate_regex=False,59 is_hidden=False,60 is_mandatory=False,61 runtime=False,62 description="",63):64 kwargs = {"is_hidden": is_hidden, "is_mandatory": is_mandatory}65 editables = {}66 if runtime:67 editables = {"value": True}68 kwargs["editables"] = editables69 if label is not None:70 kwargs["label"] = label71 if regex is not None:72 if not isinstance(regex, str):73 raise TypeError(74 "Expected string in field regex for variable "75 + (name or "")76 + ", got {}".format(type(regex))77 )78 if validate_regex and regex and value:79 regex_result = re.match(regex, value)80 if not regex_result:81 raise ValueError(82 "Value '{}' doesn't match with specified regex '{}'".format(83 value, regex84 )85 )86 regex = {"value": regex, "should_validate": validate_regex}87 kwargs["regex"] = regex88 if description is not None:89 kwargs["description"] = description90 return setvar(name, value, **kwargs)91def simple_variable_secret(92 value,93 name=None,94 label=None,95 regex=None,96 validate_regex=False,97 is_hidden=False,98 is_mandatory=False,99 runtime=False,100 description="",101):102 kwargs = {"is_hidden": is_hidden, "is_mandatory": is_mandatory}103 editables = {}104 if runtime:105 editables = {"value": True}106 kwargs["editables"] = editables107 if label is not None:108 kwargs["label"] = label109 if regex is not None:110 if not isinstance(regex, str):111 raise TypeError(112 "Expected string in field regex for variable "113 + (name or "")114 + ", got {}".format(type(regex))115 )116 if validate_regex and regex and value:117 regex_result = re.match(regex, value)118 if not regex_result:119 raise ValueError(120 "Value '{}' doesn't match with specified regex '{}'".format(121 value, regex122 )123 )124 regex = {"value": regex, "should_validate": validate_regex}125 kwargs["regex"] = regex126 if description is not None:127 kwargs["description"] = description128 return setvar(name, value, type_="SECRET", **kwargs)129def _advanced_variable(130 type_,131 name=None,132 value="",133 label=None,134 task=None,135 value_type=None,136 data_type=None,137 regex=None,138 validate_regex=False,139 options=None,140 is_hidden=False,141 is_mandatory=False,142 runtime=False,143 description="",144):145 kwargs = {"name": name, "value": value, "type_": type_}146 if runtime:147 kwargs["editables"] = {"value": True}148 if label is not None:149 kwargs["label"] = label150 if task is not None:151 if not getattr(task, "__kind__") == "app_task":152 raise TypeError(153 "Expected a Task for variable "154 + (name or "")155 + ", got {}".format(type(task))156 )157 task_attrs = task.compile().get("attrs")158 if not task_attrs:159 raise ValueError("Task for variable " + (name or "") + ", is not valid.")160 task_type = getattr(task, "type")161 if task_type not in ["HTTP", "EXEC"]:162 raise ValueError(163 "Task type for variable "164 + (name or "")165 + ", is not valid, Expected one of"166 + " ['HTTP', 'EXEC'], got {}".format(task_type)167 )168 task_attrs["type"] = task_type169 kwargs["type_"] = task_type + "_" + type_170 kwargs["options"] = {"type": task_type, "attrs": task_attrs}171 if value_type is not None:172 value_type = value_type.upper()173 if value_type not in VARIABLE_VALUE_TYPES.values():174 raise ValueError(175 "Value type for variable "176 + (name or "")177 + ", is not valid, Expected one of"178 + " {}, got {}".format(list(VARIABLE_VALUE_TYPES.values()), value_type)179 )180 kwargs["value_type"] = value_type181 if data_type is not None:182 data_type = data_type.upper()183 if data_type not in VARIABLE_DATA_TYPES.values():184 raise ValueError(185 "Data type for variable "186 + (name or "")187 + ", is not valid, Expected one of"188 + " {}, got {}".format(list(VARIABLE_DATA_TYPES.values()), data_type)189 )190 kwargs["data_type"] = data_type191 if regex is not None:192 if not isinstance(regex, str):193 raise TypeError(194 "Expected string in field regex for variable "195 + (name or "")196 + ", got {}".format(type(regex))197 )198 regex = {"value": regex, "should_validate": validate_regex}199 kwargs["regex"] = regex200 if options is not None:201 if kwargs.get("options", None) is not None:202 raise ValueError(203 "Variable options for variable "204 + (name or "")205 + "cannot be specified since it is being "206 + "fetched from a {} task".format(kwargs["options"]["type"])207 )208 if not isinstance(options, list):209 raise TypeError(210 "Expected list of options for variable "211 + (name or "")212 + ", got {}".format(type(options))213 )214 choices = []215 for choice in options:216 if not isinstance(choice, str):217 raise TypeError(218 "Expected list of string choices for options for variable "219 + (name or "")220 + ", got {}".format(type(choice))221 )222 if validate_regex and regex:223 regex_result = re.match(regex["value"], choice)224 if not regex_result:225 raise ValueError(226 "Option '{}' doesn't match with specified regex '{}'".format(227 choice, regex["value"]228 )229 )230 choices.append(choice)231 if isinstance(value, list) and data_type == "LIST":232 for val in value:233 if not isinstance(val, str):234 raise TypeError(235 "Expected list of string defaults for variable "236 + (name or "")237 + ", got {}".format(type(val))238 )239 if val not in choices:240 raise TypeError(241 "Default value for variable array with options "242 + (name or "")243 + ", contains {}, which is not one of the options".format(val)244 )245 value = ",".join(value)246 kwargs["value"] = value247 if value is None and len(choices) > 0:248 value = choices[0]249 kwargs["value"] = value250 if data_type != "LIST" and value not in choices:251 raise TypeError(252 "Default value for variable with options "253 + (name or "")254 + ", is {}, which is not one of the options".format(value)255 )256 options = {"type": "PREDEFINED", "choices": choices}257 kwargs["options"] = options258 else:259 # If options are None, just regex validate the value260 if validate_regex and regex and value:261 regex_result = re.match(regex["value"], value)262 if not regex_result:263 raise ValueError(264 "Value '{}' doesn't match with specified regex '{}'".format(265 value, regex["value"]266 )267 )268 if is_hidden is not None:269 kwargs["is_hidden"] = bool(is_hidden)270 if is_mandatory is not None:271 kwargs["is_mandatory"] = bool(is_mandatory)272 if description is not None:273 kwargs["description"] = description274 return setvar(**kwargs)275def simple_variable_int(276 value,277 name=None,278 label=None,279 regex=r"^[\d]*$",280 validate_regex=False,281 is_hidden=False,282 is_mandatory=False,283 runtime=False,284 description="",285):286 return _advanced_variable(287 "LOCAL",288 name=name,289 value=value,290 label=label,291 value_type="INT",292 data_type="BASE",293 regex=regex,294 validate_regex=validate_regex,295 is_hidden=is_hidden,296 is_mandatory=is_mandatory,297 runtime=runtime,298 description=description,299 )300def simple_variable_date(301 value,302 name=None,303 label=None,304 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",305 validate_regex=False,306 is_hidden=False,307 is_mandatory=False,308 runtime=False,309 description="",310):311 return _advanced_variable(312 "LOCAL",313 name=name,314 value=value,315 label=label,316 value_type="DATE",317 data_type="BASE",318 regex=regex,319 validate_regex=validate_regex,320 is_hidden=is_hidden,321 is_mandatory=is_mandatory,322 runtime=runtime,323 description=description,324 )325def simple_variable_time(326 value,327 name=None,328 label=None,329 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",330 validate_regex=False,331 is_hidden=False,332 is_mandatory=False,333 runtime=False,334 description="",335):336 return _advanced_variable(337 "LOCAL",338 name=name,339 value=value,340 label=label,341 value_type="TIME",342 data_type="BASE",343 regex=regex,344 validate_regex=validate_regex,345 is_hidden=is_hidden,346 is_mandatory=is_mandatory,347 runtime=runtime,348 description=description,349 )350def simple_variable_datetime(351 value,352 name=None,353 label=None,354 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",355 validate_regex=False,356 is_hidden=False,357 is_mandatory=False,358 runtime=False,359 description="",360):361 return _advanced_variable(362 "LOCAL",363 name=name,364 value=value,365 label=label,366 value_type="DATE_TIME",367 data_type="BASE",368 regex=regex,369 validate_regex=validate_regex,370 is_hidden=is_hidden,371 is_mandatory=is_mandatory,372 runtime=runtime,373 description=description,374 )375def simple_variable_multiline(376 value,377 name=None,378 label=None,379 regex=None,380 validate_regex=False,381 is_hidden=False,382 is_mandatory=False,383 runtime=False,384 description="",385):386 return _advanced_variable(387 "LOCAL",388 name=name,389 value=value,390 label=label,391 value_type="MULTILINE_STRING",392 data_type="BASE",393 regex=regex,394 validate_regex=validate_regex,395 is_hidden=is_hidden,396 is_mandatory=is_mandatory,397 runtime=runtime,398 description=description,399 )400def simple_variable_int_secret(401 value,402 name=None,403 label=None,404 regex=r"^[\d]*$",405 validate_regex=False,406 is_hidden=False,407 is_mandatory=False,408 runtime=False,409 description="",410):411 return _advanced_variable(412 "SECRET",413 name=name,414 value=value,415 label=label,416 value_type="INT",417 data_type="BASE",418 regex=regex,419 validate_regex=validate_regex,420 is_hidden=is_hidden,421 is_mandatory=is_mandatory,422 runtime=runtime,423 description=description,424 )425def simple_variable_date_secret(426 value,427 name=None,428 label=None,429 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",430 validate_regex=False,431 is_hidden=False,432 is_mandatory=False,433 runtime=False,434 description="",435):436 return _advanced_variable(437 "SECRET",438 name=name,439 value=value,440 label=label,441 value_type="DATE",442 data_type="BASE",443 regex=regex,444 validate_regex=validate_regex,445 is_hidden=is_hidden,446 is_mandatory=is_mandatory,447 runtime=runtime,448 description=description,449 )450def simple_variable_time_secret(451 value,452 name=None,453 label=None,454 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",455 validate_regex=False,456 is_hidden=False,457 is_mandatory=False,458 runtime=False,459 description="",460):461 return _advanced_variable(462 "SECRET",463 name=name,464 value=value,465 label=label,466 value_type="TIME",467 data_type="BASE",468 regex=regex,469 validate_regex=validate_regex,470 is_hidden=is_hidden,471 is_mandatory=is_mandatory,472 runtime=runtime,473 description=description,474 )475def simple_variable_datetime_secret(476 value,477 name=None,478 label=None,479 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",480 validate_regex=False,481 is_hidden=False,482 is_mandatory=False,483 runtime=False,484 description="",485):486 return _advanced_variable(487 "SECRET",488 name=name,489 value=value,490 label=label,491 value_type="DATE_TIME",492 data_type="BASE",493 regex=regex,494 validate_regex=validate_regex,495 is_hidden=is_hidden,496 is_mandatory=is_mandatory,497 runtime=runtime,498 description=description,499 )500def simple_variable_multiline_secret(501 value,502 name=None,503 label=None,504 regex=None,505 validate_regex=False,506 is_hidden=False,507 is_mandatory=False,508 runtime=False,509 description="",510):511 return _advanced_variable(512 "SECRET",513 name=name,514 value=value,515 label=label,516 value_type="MULTILINE_STRING",517 data_type="BASE",518 regex=regex,519 validate_regex=validate_regex,520 is_hidden=is_hidden,521 is_mandatory=is_mandatory,522 runtime=runtime,523 description=description,524 )525def variable_string_with_predefined_options(526 options,527 default=None,528 name=None,529 label=None,530 regex=None,531 validate_regex=False,532 is_hidden=False,533 is_mandatory=False,534 runtime=False,535 description="",536):537 return _advanced_variable(538 "LOCAL",539 name=name,540 value=default,541 label=label,542 value_type="STRING",543 data_type="BASE",544 regex=regex,545 validate_regex=validate_regex,546 options=options,547 is_hidden=is_hidden,548 is_mandatory=is_mandatory,549 runtime=runtime,550 description=description,551 )552def variable_int_with_predefined_options(553 options,554 default=None,555 name=None,556 label=None,557 regex=r"^[\d]*$",558 validate_regex=False,559 is_hidden=False,560 is_mandatory=False,561 runtime=False,562 description="",563):564 return _advanced_variable(565 "LOCAL",566 name=name,567 value=default,568 label=label,569 value_type="INT",570 data_type="BASE",571 regex=regex,572 validate_regex=validate_regex,573 options=options,574 is_hidden=is_hidden,575 is_mandatory=is_mandatory,576 runtime=runtime,577 description=description,578 )579def variable_date_with_predefined_options(580 options,581 default=None,582 name=None,583 label=None,584 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",585 validate_regex=False,586 is_hidden=False,587 is_mandatory=False,588 runtime=False,589 description="",590):591 return _advanced_variable(592 "LOCAL",593 name=name,594 value=default,595 label=label,596 value_type="DATE",597 data_type="BASE",598 regex=regex,599 validate_regex=validate_regex,600 options=options,601 is_hidden=is_hidden,602 is_mandatory=is_mandatory,603 runtime=runtime,604 description=description,605 )606def variable_time_with_predefined_options(607 options,608 default=None,609 name=None,610 label=None,611 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",612 validate_regex=False,613 is_hidden=False,614 is_mandatory=False,615 runtime=False,616 description="",617):618 return _advanced_variable(619 "LOCAL",620 name=name,621 value=default,622 label=label,623 value_type="TIME",624 data_type="BASE",625 regex=regex,626 validate_regex=validate_regex,627 options=options,628 is_hidden=is_hidden,629 is_mandatory=is_mandatory,630 runtime=runtime,631 description=description,632 )633def variable_datetime_with_predefined_options(634 options,635 default=None,636 name=None,637 label=None,638 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",639 validate_regex=False,640 is_hidden=False,641 is_mandatory=False,642 runtime=False,643 description="",644):645 return _advanced_variable(646 "LOCAL",647 name=name,648 value=default,649 label=label,650 value_type="DATE_TIME",651 data_type="BASE",652 regex=regex,653 validate_regex=validate_regex,654 options=options,655 is_hidden=is_hidden,656 is_mandatory=is_mandatory,657 runtime=runtime,658 description=description,659 )660def variable_multiline_with_predefined_options(661 options,662 default=None,663 name=None,664 label=None,665 regex=None,666 validate_regex=False,667 is_hidden=False,668 is_mandatory=False,669 runtime=False,670 description="",671):672 return _advanced_variable(673 "LOCAL",674 name=name,675 value=default,676 label=label,677 value_type="MULTILINE_STRING",678 data_type="BASE",679 regex=regex,680 validate_regex=validate_regex,681 options=options,682 is_hidden=is_hidden,683 is_mandatory=is_mandatory,684 runtime=runtime,685 description=description,686 )687def variable_string_with_predefined_options_array(688 options,689 defaults=None,690 name=None,691 label=None,692 regex=None,693 validate_regex=False,694 is_hidden=False,695 is_mandatory=False,696 runtime=False,697 description="",698):699 return _advanced_variable(700 "LOCAL",701 name=name,702 value=defaults,703 label=label,704 value_type="STRING",705 data_type="LIST",706 regex=regex,707 validate_regex=validate_regex,708 options=options,709 is_hidden=is_hidden,710 is_mandatory=is_mandatory,711 runtime=runtime,712 description=description,713 )714def variable_int_with_predefined_options_array(715 options,716 defaults=None,717 name=None,718 label=None,719 regex=r"^[\d]*$",720 validate_regex=False,721 is_hidden=False,722 is_mandatory=False,723 runtime=False,724 description="",725):726 return _advanced_variable(727 "LOCAL",728 name=name,729 value=defaults,730 label=label,731 value_type="INT",732 data_type="LIST",733 regex=regex,734 validate_regex=validate_regex,735 options=options,736 is_hidden=is_hidden,737 is_mandatory=is_mandatory,738 runtime=runtime,739 description=description,740 )741def variable_date_with_predefined_options_array(742 options,743 defaults=None,744 name=None,745 label=None,746 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",747 validate_regex=False,748 is_hidden=False,749 is_mandatory=False,750 runtime=False,751 description="",752):753 return _advanced_variable(754 "LOCAL",755 name=name,756 value=defaults,757 label=label,758 value_type="DATE",759 data_type="LIST",760 regex=regex,761 validate_regex=validate_regex,762 options=options,763 is_hidden=is_hidden,764 is_mandatory=is_mandatory,765 runtime=runtime,766 description=description,767 )768def variable_time_with_predefined_options_array(769 options,770 defaults=None,771 name=None,772 label=None,773 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",774 validate_regex=False,775 is_hidden=False,776 is_mandatory=False,777 runtime=False,778 description="",779):780 return _advanced_variable(781 "LOCAL",782 name=name,783 value=defaults,784 label=label,785 value_type="TIME",786 data_type="LIST",787 regex=regex,788 validate_regex=validate_regex,789 options=options,790 is_hidden=is_hidden,791 is_mandatory=is_mandatory,792 runtime=runtime,793 description=description,794 )795def variable_datetime_with_predefined_options_array(796 options,797 defaults=None,798 name=None,799 label=None,800 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",801 validate_regex=False,802 is_hidden=False,803 is_mandatory=False,804 runtime=False,805 description="",806):807 return _advanced_variable(808 "LOCAL",809 name=name,810 value=defaults,811 label=label,812 value_type="DATE_TIME",813 data_type="LIST",814 regex=regex,815 validate_regex=validate_regex,816 options=options,817 is_hidden=is_hidden,818 is_mandatory=is_mandatory,819 runtime=runtime,820 description=description,821 )822def variable_multiline_with_predefined_options_array(823 options,824 defaults=None,825 name=None,826 label=None,827 regex=None,828 validate_regex=False,829 is_hidden=False,830 is_mandatory=False,831 runtime=False,832 description="",833):834 return _advanced_variable(835 "LOCAL",836 name=name,837 value=defaults,838 label=label,839 value_type="MULTILINE_STRING",840 data_type="LIST",841 regex=regex,842 validate_regex=validate_regex,843 options=options,844 is_hidden=is_hidden,845 is_mandatory=is_mandatory,846 runtime=runtime,847 description=description,848 )849def variable_string_with_options_from_task(850 task,851 name=None,852 label=None,853 regex=None,854 validate_regex=False,855 is_hidden=False,856 is_mandatory=False,857 description="",858):859 return _advanced_variable(860 "LOCAL",861 name=name,862 label=label,863 value_type="STRING",864 data_type="BASE",865 regex=regex,866 validate_regex=validate_regex,867 task=task,868 is_hidden=is_hidden,869 is_mandatory=is_mandatory,870 runtime=True,871 description=description,872 )873def variable_int_with_options_from_task(874 task,875 name=None,876 label=None,877 regex=r"^[\d]*$",878 validate_regex=False,879 is_hidden=False,880 is_mandatory=False,881 description="",882):883 return _advanced_variable(884 "LOCAL",885 name=name,886 label=label,887 value_type="INT",888 data_type="BASE",889 regex=regex,890 validate_regex=validate_regex,891 task=task,892 is_hidden=is_hidden,893 is_mandatory=is_mandatory,894 runtime=True,895 description=description,896 )897def variable_date_with_options_from_task(898 task,899 name=None,900 label=None,901 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",902 validate_regex=False,903 is_hidden=False,904 is_mandatory=False,905 description="",906):907 return _advanced_variable(908 "LOCAL",909 name=name,910 label=label,911 value_type="DATE",912 data_type="BASE",913 regex=regex,914 validate_regex=validate_regex,915 task=task,916 is_hidden=is_hidden,917 is_mandatory=is_mandatory,918 runtime=True,919 description=description,920 )921def variable_time_with_options_from_task(922 task,923 name=None,924 label=None,925 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",926 validate_regex=False,927 is_hidden=False,928 is_mandatory=False,929 description="",930):931 return _advanced_variable(932 "LOCAL",933 name=name,934 label=label,935 value_type="TIME",936 data_type="BASE",937 regex=regex,938 validate_regex=validate_regex,939 task=task,940 is_hidden=is_hidden,941 is_mandatory=is_mandatory,942 runtime=True,943 description=description,944 )945def variable_datetime_with_options_from_task(946 task,947 name=None,948 label=None,949 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",950 validate_regex=False,951 is_hidden=False,952 is_mandatory=False,953 description="",954):955 return _advanced_variable(956 "LOCAL",957 name=name,958 label=label,959 value_type="DATE_TIME",960 data_type="BASE",961 regex=regex,962 validate_regex=validate_regex,963 task=task,964 is_hidden=is_hidden,965 is_mandatory=is_mandatory,966 runtime=True,967 description=description,968 )969def variable_multiline_with_options_from_task(970 task,971 name=None,972 label=None,973 regex=None,974 validate_regex=False,975 is_hidden=False,976 is_mandatory=False,977 description="",978):979 return _advanced_variable(980 "LOCAL",981 name=name,982 label=label,983 value_type="MULTILINE_STRING",984 data_type="BASE",985 regex=regex,986 validate_regex=validate_regex,987 task=task,988 is_hidden=is_hidden,989 is_mandatory=is_mandatory,990 runtime=True,991 description=description,992 )993def variable_string_with_options_from_task_array(994 task,995 name=None,996 label=None,997 regex=None,998 validate_regex=False,999 is_hidden=False,1000 is_mandatory=False,1001 description="",1002):1003 return _advanced_variable(1004 "LOCAL",1005 name=name,1006 label=label,1007 value_type="STRING",1008 data_type="LIST",1009 regex=regex,1010 validate_regex=validate_regex,1011 task=task,1012 is_hidden=is_hidden,1013 is_mandatory=is_mandatory,1014 runtime=True,1015 description=description,1016 )1017def variable_int_with_options_from_task_array(1018 task,1019 name=None,1020 label=None,1021 regex=r"^[\d]*$",1022 validate_regex=False,1023 is_hidden=False,1024 is_mandatory=False,1025 description="",1026):1027 return _advanced_variable(1028 "LOCAL",1029 name=name,1030 label=label,1031 value_type="INT",1032 data_type="LIST",1033 regex=regex,1034 validate_regex=validate_regex,1035 task=task,1036 is_hidden=is_hidden,1037 is_mandatory=is_mandatory,1038 runtime=True,1039 description=description,1040 )1041def variable_date_with_options_from_task_array(1042 task,1043 name=None,1044 label=None,1045 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})$",1046 validate_regex=False,1047 is_hidden=False,1048 is_mandatory=False,1049 description="",1050):1051 return _advanced_variable(1052 "LOCAL",1053 name=name,1054 label=label,1055 value_type="DATE",1056 data_type="LIST",1057 regex=regex,1058 validate_regex=validate_regex,1059 task=task,1060 is_hidden=is_hidden,1061 is_mandatory=is_mandatory,1062 runtime=True,1063 description=description,1064 )1065def variable_time_with_options_from_task_array(1066 task,1067 name=None,1068 label=None,1069 regex=r"^[\d]{2}:[\d]{2}(:[0-5]\d)?$",1070 validate_regex=False,1071 is_hidden=False,1072 is_mandatory=False,1073 description="",1074):1075 return _advanced_variable(1076 "LOCAL",1077 name=name,1078 label=label,1079 value_type="TIME",1080 data_type="LIST",1081 regex=regex,1082 validate_regex=validate_regex,1083 task=task,1084 is_hidden=is_hidden,1085 is_mandatory=is_mandatory,1086 runtime=True,1087 description=description,1088 )1089def variable_datetime_with_options_from_task_array(1090 task,1091 name=None,1092 label=None,1093 regex=r"^((0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/[12]\d{3})((T)|(\s-\s))[\d]{2}:[\d]{2}(:[0-5]\d)?$",1094 validate_regex=False,1095 is_hidden=False,1096 is_mandatory=False,1097 description="",1098):1099 return _advanced_variable(1100 "LOCAL",1101 name=name,1102 label=label,1103 value_type="DATE_TIME",1104 data_type="LIST",1105 regex=regex,1106 validate_regex=validate_regex,1107 task=task,1108 is_hidden=is_hidden,1109 is_mandatory=is_mandatory,1110 runtime=True,1111 description=description,1112 )1113def variable_multiline_with_options_from_task_array(1114 task,1115 name=None,1116 label=None,1117 regex=None,1118 validate_regex=False,1119 is_hidden=False,1120 is_mandatory=False,1121 description="",1122):1123 return _advanced_variable(1124 "LOCAL",1125 name=name,1126 label=label,1127 value_type="MULTILINE_STRING",1128 data_type="LIST",1129 regex=regex,1130 validate_regex=validate_regex,1131 task=task,1132 is_hidden=is_hidden,1133 is_mandatory=is_mandatory,1134 runtime=True,1135 description=description,1136 )1137class CalmVariable:1138 def __new__(1139 cls,1140 value,1141 name=None,1142 label=None,1143 regex=None,1144 validate_regex=False,1145 is_hidden=False,1146 is_mandatory=False,1147 runtime=False,1148 description="",1149 ):1150 return simple_variable(1151 value,1152 name=name,1153 label=label,1154 regex=regex,1155 validate_regex=validate_regex,1156 is_hidden=is_hidden,1157 is_mandatory=is_mandatory,1158 runtime=runtime,1159 description=description,1160 )1161 class Simple:1162 def __new__(1163 cls,1164 value,1165 name=None,1166 label=None,1167 regex=None,1168 validate_regex=False,1169 is_hidden=False,1170 is_mandatory=False,1171 runtime=False,1172 description="",1173 ):1174 return simple_variable(1175 value,1176 name=name,1177 label=label,1178 regex=regex,1179 validate_regex=validate_regex,1180 is_hidden=is_hidden,1181 is_mandatory=is_mandatory,1182 runtime=runtime,1183 description=description,1184 )1185 string = simple_variable1186 int = simple_variable_int1187 date = simple_variable_date1188 time = simple_variable_time1189 datetime = simple_variable_datetime1190 multiline = simple_variable_multiline1191 class Secret:1192 def __new__(1193 cls,1194 value,1195 name=None,1196 label=None,1197 regex=None,1198 validate_regex=False,1199 is_hidden=False,1200 is_mandatory=False,1201 runtime=False,1202 description="",1203 ):1204 return simple_variable_secret(1205 value,1206 name=name,1207 label=label,1208 regex=regex,1209 validate_regex=validate_regex,1210 is_hidden=is_hidden,1211 is_mandatory=is_mandatory,1212 runtime=runtime,1213 description=description,1214 )1215 string = simple_variable_secret1216 int = simple_variable_int_secret1217 date = simple_variable_date_secret1218 time = simple_variable_time_secret1219 datetime = simple_variable_datetime_secret1220 multiline = simple_variable_multiline_secret1221 class WithOptions:1222 def __new__(1223 cls,1224 options,1225 default=None,1226 name=None,1227 label=None,1228 regex=None,1229 validate_regex=False,1230 is_hidden=False,1231 is_mandatory=False,1232 runtime=False,1233 description="",1234 ):1235 return variable_string_with_predefined_options(1236 options,1237 default=default,1238 name=name,1239 label=label,1240 regex=regex,1241 validate_regex=validate_regex,1242 is_hidden=is_hidden,1243 is_mandatory=is_mandatory,1244 runtime=runtime,1245 description=description,1246 )1247 class Predefined:1248 def __new__(1249 cls,1250 options,1251 default=None,1252 name=None,1253 label=None,1254 regex=None,1255 validate_regex=False,1256 is_hidden=False,1257 is_mandatory=False,1258 runtime=False,1259 description="",1260 ):1261 return variable_string_with_predefined_options(1262 options,1263 default=default,1264 name=name,1265 label=label,1266 regex=regex,1267 validate_regex=validate_regex,1268 is_hidden=is_hidden,1269 is_mandatory=is_mandatory,1270 runtime=runtime,1271 description=description,1272 )1273 string = variable_string_with_predefined_options1274 int = variable_int_with_predefined_options1275 date = variable_date_with_predefined_options1276 time = variable_time_with_predefined_options1277 datetime = variable_datetime_with_predefined_options1278 multiline = variable_multiline_with_predefined_options1279 class Array:1280 def __new__(1281 cls,1282 options,1283 defaults=None,1284 name=None,1285 label=None,1286 regex=None,1287 validate_regex=False,1288 is_hidden=False,1289 is_mandatory=False,1290 runtime=False,1291 description="",1292 ):1293 return variable_string_with_predefined_options_array(1294 options,1295 defaults=defaults,1296 name=name,1297 label=label,1298 regex=regex,1299 validate_regex=validate_regex,1300 is_hidden=is_hidden,1301 is_mandatory=is_mandatory,1302 runtime=runtime,1303 description=description,1304 )1305 string = variable_string_with_predefined_options_array1306 int = variable_int_with_predefined_options_array1307 date = variable_date_with_predefined_options_array1308 time = variable_time_with_predefined_options_array1309 datetime = variable_datetime_with_predefined_options_array1310 multiline = variable_multiline_with_predefined_options_array1311 class FromTask:1312 def __new__(1313 cls,1314 task,1315 name=None,1316 label=None,1317 regex=None,1318 validate_regex=False,1319 is_hidden=False,1320 is_mandatory=False,1321 description="",1322 ):1323 return variable_string_with_options_from_task(1324 task,1325 name=name,1326 label=label,1327 regex=regex,1328 validate_regex=validate_regex,1329 is_hidden=is_hidden,1330 is_mandatory=is_mandatory,1331 description=description,1332 )1333 string = variable_string_with_options_from_task1334 int = variable_int_with_options_from_task1335 date = variable_date_with_options_from_task1336 time = variable_time_with_options_from_task1337 datetime = variable_datetime_with_options_from_task1338 multiline = variable_multiline_with_options_from_task1339 class Array:1340 def __new__(1341 cls,1342 task,1343 name=None,1344 label=None,1345 regex=None,1346 validate_regex=False,1347 is_hidden=False,1348 is_mandatory=False,1349 description="",1350 ):1351 return variable_string_with_options_from_task_array(1352 task,1353 name=name,1354 label=label,1355 regex=regex,1356 validate_regex=validate_regex,1357 is_hidden=is_hidden,1358 is_mandatory=is_mandatory,1359 description=description,1360 )1361 string = variable_string_with_options_from_task_array1362 int = variable_int_with_options_from_task_array1363 date = variable_date_with_options_from_task_array1364 time = variable_time_with_options_from_task_array1365 datetime = variable_datetime_with_options_from_task_array1366 multiline = variable_multiline_with_options_from_task_array1367class RunbookVariable(CalmVariable):1368 class TaskInput:1369 def __new__(cls, *args, **kwargs):...

Full Screen

Full Screen

init_alert_alarm_type_v5.py

Source:init_alert_alarm_type_v5.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.4Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.5Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at6http://opensource.org/licenses/MIT7Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.8""" # noqa9"""更新蓝鲸监控告警类型102018-09-1411- 替换 False12- 替换 True13"""14from fta_solutions_app.models import AlarmType15MODEL = AlarmType16def RUNNER(apps, schema_editor, module, silent): # noqa17 # 先删除所有的蓝鲸监控告警类型18 module.MODEL.objects.filter(source_type='ALERT').delete()19 for item in module.DATA:20 try:21 module.MODEL.objects.create(**item)22 except Exception:23 pass24DATA = [25 {26 "is_enabled": True,27 "match_mode": 0,28 "source_type": "ALERT",29 "description": "可用物理内存",30 "scenario": "主机监控",31 "exclude": "",32 "alarm_type": "mem_60",33 "pattern": "mem_60",34 "is_hidden": False,35 "cc_biz_id": 036 },37 {38 "is_enabled": True,39 "match_mode": 0,40 "source_type": "ALERT",41 "description": "交换分区使用量",42 "scenario": "主机监控",43 "exclude": "",44 "alarm_type": "mem_63",45 "pattern": "mem_63",46 "is_hidden": False,47 "cc_biz_id": 048 },49 {50 "is_enabled": True,51 "match_mode": 0,52 "source_type": "ALERT",53 "description": "物理内存使用率",54 "scenario": "主机监控",55 "exclude": "",56 "alarm_type": "mem_64",57 "pattern": "mem_64",58 "is_hidden": False,59 "cc_biz_id": 060 },61 {62 "is_enabled": True,63 "match_mode": 0,64 "source_type": "ALERT",65 "description": "物理内存使用量",66 "scenario": "主机监控",67 "exclude": "",68 "alarm_type": "mem_97",69 "pattern": "mem_97",70 "is_hidden": False,71 "cc_biz_id": 072 },73 {74 "is_enabled": True,75 "match_mode": 0,76 "source_type": "ALERT",77 "description": "应用内存使用量",78 "scenario": "主机监控",79 "exclude": "",80 "alarm_type": "mem_98",81 "pattern": "mem_98",82 "is_hidden": False,83 "cc_biz_id": 084 },85 {86 "is_enabled": True,87 "match_mode": 0,88 "source_type": "ALERT",89 "description": "应用内存使用率",90 "scenario": "主机监控",91 "exclude": "",92 "alarm_type": "mem_99",93 "pattern": "mem_99",94 "is_hidden": False,95 "cc_biz_id": 096 },97 {98 "is_enabled": True,99 "match_mode": 0,100 "source_type": "ALERT",101 "description": "CPU使用率",102 "scenario": "主机监控",103 "exclude": "",104 "alarm_type": "process_122",105 "pattern": "process_122",106 "is_hidden": False,107 "cc_biz_id": 0108 },109 {110 "is_enabled": True,111 "match_mode": 0,112 "source_type": "ALERT",113 "description": "内存使用率",114 "scenario": "主机监控",115 "exclude": "",116 "alarm_type": "process_123",117 "pattern": "process_123",118 "is_hidden": False,119 "cc_biz_id": 0120 },121 {122 "is_enabled": True,123 "match_mode": 0,124 "source_type": "ALERT",125 "description": "物理内存使用量",126 "scenario": "主机监控",127 "exclude": "",128 "alarm_type": "process_124",129 "pattern": "process_124",130 "is_hidden": False,131 "cc_biz_id": 0132 },133 {134 "is_enabled": True,135 "match_mode": 0,136 "source_type": "ALERT",137 "description": "虚拟内存使用量",138 "scenario": "主机监控",139 "exclude": "",140 "alarm_type": "process_125",141 "pattern": "process_125",142 "is_hidden": False,143 "cc_biz_id": 0144 },145 {146 "is_enabled": True,147 "match_mode": 0,148 "source_type": "ALERT",149 "description": "文件句柄数",150 "scenario": "主机监控",151 "exclude": "",152 "alarm_type": "process_126",153 "pattern": "process_126",154 "is_hidden": False,155 "cc_biz_id": 0156 },157 {158 "is_enabled": True,159 "match_mode": 0,160 "source_type": "ALERT",161 "description": "接收字节流量",162 "scenario": "主机监控",163 "exclude": "",164 "alarm_type": "net_10",165 "pattern": "net_10",166 "is_hidden": False,167 "cc_biz_id": 0168 },169 {170 "is_enabled": True,171 "match_mode": 0,172 "source_type": "ALERT",173 "description": "发送字节流量",174 "scenario": "主机监控",175 "exclude": "",176 "alarm_type": "net_14",177 "pattern": "net_14",178 "is_hidden": False,179 "cc_biz_id": 0180 },181 {182 "is_enabled": True,183 "match_mode": 0,184 "source_type": "ALERT",185 "description": "发送包速率",186 "scenario": "主机监控",187 "exclude": "",188 "alarm_type": "net_16",189 "pattern": "net_16",190 "is_hidden": False,191 "cc_biz_id": 0192 },193 {194 "is_enabled": True,195 "match_mode": 0,196 "source_type": "ALERT",197 "description": "接收包速率",198 "scenario": "主机监控",199 "exclude": "",200 "alarm_type": "net_20",201 "pattern": "net_20",202 "is_hidden": False,203 "cc_biz_id": 0204 },205 {206 "is_enabled": True,207 "match_mode": 0,208 "source_type": "ALERT",209 "description": "ESTABLISHED连接数",210 "scenario": "主机监控",211 "exclude": "",212 "alarm_type": "net_110",213 "pattern": "net_110",214 "is_hidden": False,215 "cc_biz_id": 0216 },217 {218 "is_enabled": True,219 "match_mode": 0,220 "source_type": "ALERT",221 "description": "TIME_WAIT连接数",222 "scenario": "主机监控",223 "exclude": "",224 "alarm_type": "net_111",225 "pattern": "net_111",226 "is_hidden": False,227 "cc_biz_id": 0228 },229 {230 "is_enabled": True,231 "match_mode": 0,232 "source_type": "ALERT",233 "description": "LISTEN连接数",234 "scenario": "主机监控",235 "exclude": "",236 "alarm_type": "net_112",237 "pattern": "net_112",238 "is_hidden": False,239 "cc_biz_id": 0240 },241 {242 "is_enabled": True,243 "match_mode": 0,244 "source_type": "ALERT",245 "description": "LAST_ACK连接数",246 "scenario": "主机监控",247 "exclude": "",248 "alarm_type": "net_113",249 "pattern": "net_113",250 "is_hidden": False,251 "cc_biz_id": 0252 },253 {254 "is_enabled": True,255 "match_mode": 0,256 "source_type": "ALERT",257 "description": "SYN_RECV连接数",258 "scenario": "主机监控",259 "exclude": "",260 "alarm_type": "net_114",261 "pattern": "net_114",262 "is_hidden": False,263 "cc_biz_id": 0264 },265 {266 "is_enabled": True,267 "match_mode": 0,268 "source_type": "ALERT",269 "description": "SYN_SENT连接数",270 "scenario": "主机监控",271 "exclude": "",272 "alarm_type": "net_115",273 "pattern": "net_115",274 "is_hidden": False,275 "cc_biz_id": 0276 },277 {278 "is_enabled": True,279 "match_mode": 0,280 "source_type": "ALERT",281 "description": "FIN_WAIT1连接数",282 "scenario": "主机监控",283 "exclude": "",284 "alarm_type": "net_116",285 "pattern": "net_116",286 "is_hidden": False,287 "cc_biz_id": 0288 },289 {290 "is_enabled": True,291 "match_mode": 0,292 "source_type": "ALERT",293 "description": "FIN_WAIT2连接数",294 "scenario": "主机监控",295 "exclude": "",296 "alarm_type": "net_117",297 "pattern": "net_117",298 "is_hidden": False,299 "cc_biz_id": 0300 },301 {302 "is_enabled": True,303 "match_mode": 0,304 "source_type": "ALERT",305 "description": "CLOSING连接数",306 "scenario": "主机监控",307 "exclude": "",308 "alarm_type": "net_118",309 "pattern": "net_118",310 "is_hidden": False,311 "cc_biz_id": 0312 },313 {314 "is_enabled": True,315 "match_mode": 0,316 "source_type": "ALERT",317 "description": "CLOSED状态连接数",318 "scenario": "主机监控",319 "exclude": "",320 "alarm_type": "net_119",321 "pattern": "net_119",322 "is_hidden": False,323 "cc_biz_id": 0324 },325 {326 "is_enabled": True,327 "match_mode": 0,328 "source_type": "ALERT",329 "description": "UDP接收包量",330 "scenario": "主机监控",331 "exclude": "",332 "alarm_type": "net_120",333 "pattern": "net_120",334 "is_hidden": False,335 "cc_biz_id": 0336 },337 {338 "is_enabled": True,339 "match_mode": 0,340 "source_type": "ALERT",341 "description": "UDP发送包量",342 "scenario": "主机监控",343 "exclude": "",344 "alarm_type": "net_121",345 "pattern": "net_121",346 "is_hidden": False,347 "cc_biz_id": 0348 },349 {350 "is_enabled": True,351 "match_mode": 0,352 "source_type": "ALERT",353 "description": "CLOSE_WAIT连接数",354 "scenario": "主机监控",355 "exclude": "",356 "alarm_type": "net_128",357 "pattern": "net_128",358 "is_hidden": False,359 "cc_biz_id": 0360 },361 {362 "is_enabled": True,363 "match_mode": 0,364 "source_type": "ALERT",365 "description": "磁盘使用率",366 "scenario": "主机监控",367 "exclude": "",368 "alarm_type": "disk_81",369 "pattern": "disk_81",370 "is_hidden": False,371 "cc_biz_id": 0372 },373 {374 "is_enabled": True,375 "match_mode": 0,376 "source_type": "ALERT",377 "description": "读速率",378 "scenario": "主机监控",379 "exclude": "",380 "alarm_type": "disk_86",381 "pattern": "disk_86",382 "is_hidden": False,383 "cc_biz_id": 0384 },385 {386 "is_enabled": True,387 "match_mode": 0,388 "source_type": "ALERT",389 "description": "写速率",390 "scenario": "主机监控",391 "exclude": "",392 "alarm_type": "disk_87",393 "pattern": "disk_87",394 "is_hidden": False,395 "cc_biz_id": 0396 },397 {398 "is_enabled": True,399 "match_mode": 0,400 "source_type": "ALERT",401 "description": "磁盘IO使用率",402 "scenario": "主机监控",403 "exclude": "",404 "alarm_type": "disk_96",405 "pattern": "disk_96",406 "is_hidden": False,407 "cc_biz_id": 0408 },409 {410 "is_enabled": True,411 "match_mode": 0,412 "source_type": "ALERT",413 "description": "5分钟平均负载",414 "scenario": "主机监控",415 "exclude": "",416 "alarm_type": "cpu_3",417 "pattern": "cpu_3",418 "is_hidden": False,419 "cc_biz_id": 0420 },421 {422 "is_enabled": True,423 "match_mode": 0,424 "source_type": "ALERT",425 "description": "CPU总使用率",426 "scenario": "主机监控",427 "exclude": "",428 "alarm_type": "cpu_7",429 "pattern": "cpu_7",430 "is_hidden": False,431 "cc_biz_id": 0432 },433 {434 "is_enabled": True,435 "match_mode": 0,436 "source_type": "ALERT",437 "description": "CPU单核使用率",438 "scenario": "主机监控",439 "exclude": "",440 "alarm_type": "cpu_8",441 "pattern": "cpu_8",442 "is_hidden": False,443 "cc_biz_id": 0444 },445 {446 "is_enabled": True,447 "match_mode": 0,448 "source_type": "ALERT",449 "description": "Agent心跳丢失",450 "scenario": "主机监控",451 "exclude": "",452 "alarm_type": "base_alarm_2",453 "pattern": "base_alarm_2",454 "is_hidden": False,455 "cc_biz_id": 0456 },457 {458 "is_enabled": True,459 "match_mode": 0,460 "source_type": "ALERT",461 "description": "磁盘只读",462 "scenario": "主机监控",463 "exclude": "",464 "alarm_type": "base_alarm_3",465 "pattern": "base_alarm_3",466 "is_hidden": False,467 "cc_biz_id": 0468 },469 {470 "is_enabled": True,471 "match_mode": 0,472 "source_type": "ALERT",473 "description": "磁盘写满",474 "scenario": "主机监控",475 "exclude": "",476 "alarm_type": "base_alarm_6",477 "pattern": "base_alarm_6",478 "is_hidden": False,479 "cc_biz_id": 0480 },481 {482 "is_enabled": True,483 "match_mode": 0,484 "source_type": "ALERT",485 "description": "Corefile产生",486 "scenario": "主机监控",487 "exclude": "",488 "alarm_type": "base_alarm_7",489 "pattern": "base_alarm_7",490 "is_hidden": False,491 "cc_biz_id": 0492 },493 {494 "is_enabled": True,495 "match_mode": 0,496 "source_type": "ALERT",497 "description": "PING不可达告警",498 "scenario": "主机监控",499 "exclude": "",500 "alarm_type": "base_alarm_8",501 "pattern": "base_alarm_8",502 "is_hidden": False,503 "cc_biz_id": 0504 },505 {506 "is_enabled": True,507 "match_mode": 0,508 "source_type": "ALERT",509 "description": "系统重新启动",510 "scenario": "主机监控",511 "exclude": "",512 "alarm_type": "system_env_os_restart",513 "pattern": "system_env_os_restart",514 "is_hidden": False,515 "cc_biz_id": 0516 },517 {518 "is_enabled": True,519 "match_mode": 0,520 "source_type": "ALERT",521 "description": "进程端口",522 "scenario": "主机监控",523 "exclude": "",524 "alarm_type": "proc_port_proc_port",525 "pattern": "proc_port_proc_port",526 "is_hidden": False,527 "cc_biz_id": 0528 },529 {530 "is_enabled": True,531 "match_mode": 0,532 "source_type": "ALERT",533 "description": "自定义字符型",534 "scenario": "主机监控",535 "exclude": "",536 "alarm_type": "gse_custom_event_gse_custom_event",537 "pattern": "gse_custom_event_gse_custom_event",538 "is_hidden": False,539 "cc_biz_id": 0540 },541 {542 "is_enabled": True,543 "match_mode": 0,544 "source_type": "ALERT",545 "description": "Apache",546 "scenario": "组件",547 "exclude": "",548 "alarm_type": "apache",549 "pattern": "apache",550 "is_hidden": False,551 "cc_biz_id": 0552 },553 {554 "is_enabled": True,555 "match_mode": 0,556 "source_type": "ALERT",557 "description": "MySQL",558 "scenario": "组件",559 "exclude": "",560 "alarm_type": "mysql",561 "pattern": "mysql",562 "is_hidden": False,563 "cc_biz_id": 0564 },565 {566 "is_enabled": True,567 "match_mode": 0,568 "source_type": "ALERT",569 "description": "NginX",570 "scenario": "组件",571 "exclude": "",572 "alarm_type": "nginx",573 "pattern": "nginx",574 "is_hidden": False,575 "cc_biz_id": 0576 },577 {578 "is_enabled": True,579 "match_mode": 0,580 "source_type": "ALERT",581 "description": "Redis",582 "scenario": "组件",583 "exclude": "",584 "alarm_type": "redis",585 "pattern": "redis",586 "is_hidden": False,587 "cc_biz_id": 0588 },589 {590 "is_enabled": True,591 "match_mode": 0,592 "source_type": "ALERT",593 "description": "Tomcat",594 "scenario": "组件",595 "exclude": "",596 "alarm_type": "tomcat",597 "pattern": "tomcat",598 "is_hidden": False,599 "cc_biz_id": 0600 },601 {602 "is_enabled": True,603 "match_mode": 0,604 "source_type": "ALERT",605 "description": "Active Directory",606 "scenario": "组件",607 "exclude": "",608 "alarm_type": "ad",609 "pattern": "ad",610 "is_hidden": False,611 "cc_biz_id": 0612 },613 {614 "is_enabled": True,615 "match_mode": 0,616 "source_type": "ALERT",617 "description": "Ceph",618 "scenario": "组件",619 "exclude": "",620 "alarm_type": "ceph",621 "pattern": "ceph",622 "is_hidden": False,623 "cc_biz_id": 0624 },625 {626 "is_enabled": True,627 "match_mode": 0,628 "source_type": "ALERT",629 "description": "Consul",630 "scenario": "组件",631 "exclude": "",632 "alarm_type": "consul",633 "pattern": "consul",634 "is_hidden": False,635 "cc_biz_id": 0636 },637 {638 "is_enabled": True,639 "match_mode": 0,640 "source_type": "ALERT",641 "description": "ElasticSearch",642 "scenario": "组件",643 "exclude": "",644 "alarm_type": "elastic",645 "pattern": "elastic",646 "is_hidden": False,647 "cc_biz_id": 0648 },649 {650 "is_enabled": True,651 "match_mode": 0,652 "source_type": "ALERT",653 "description": "Exchange 2010",654 "scenario": "组件",655 "exclude": "",656 "alarm_type": "exchange2010",657 "pattern": "exchange2010",658 "is_hidden": False,659 "cc_biz_id": 0660 },661 {662 "is_enabled": True,663 "match_mode": 0,664 "source_type": "ALERT",665 "description": "HAProxy",666 "scenario": "组件",667 "exclude": "",668 "alarm_type": "haproxy",669 "pattern": "haproxy",670 "is_hidden": False,671 "cc_biz_id": 0672 },673 {674 "is_enabled": True,675 "match_mode": 0,676 "source_type": "ALERT",677 "description": "IIS",678 "scenario": "组件",679 "exclude": "",680 "alarm_type": "iis",681 "pattern": "iis",682 "is_hidden": False,683 "cc_biz_id": 0684 },685 {686 "is_enabled": True,687 "match_mode": 0,688 "source_type": "ALERT",689 "description": "Kafka",690 "scenario": "组件",691 "exclude": "",692 "alarm_type": "kafka",693 "pattern": "kafka",694 "is_hidden": False,695 "cc_biz_id": 0696 },697 {698 "is_enabled": True,699 "match_mode": 0,700 "source_type": "ALERT",701 "description": "MemCache",702 "scenario": "组件",703 "exclude": "",704 "alarm_type": "memcache",705 "pattern": "memcache",706 "is_hidden": False,707 "cc_biz_id": 0708 },709 {710 "is_enabled": True,711 "match_mode": 0,712 "source_type": "ALERT",713 "description": "MongoDB",714 "scenario": "组件",715 "exclude": "",716 "alarm_type": "mongodb",717 "pattern": "mongodb",718 "is_hidden": False,719 "cc_biz_id": 0720 },721 {722 "is_enabled": True,723 "match_mode": 0,724 "source_type": "ALERT",725 "description": "SQLServer",726 "scenario": "组件",727 "exclude": "",728 "alarm_type": "mssql",729 "pattern": "mssql",730 "is_hidden": False,731 "cc_biz_id": 0732 },733 {734 "is_enabled": True,735 "match_mode": 0,736 "source_type": "ALERT",737 "description": "Oracle",738 "scenario": "组件",739 "exclude": "",740 "alarm_type": "oracle",741 "pattern": "oracle",742 "is_hidden": False,743 "cc_biz_id": 0744 },745 {746 "is_enabled": True,747 "match_mode": 0,748 "source_type": "ALERT",749 "description": "RabbitMQ",750 "scenario": "组件",751 "exclude": "",752 "alarm_type": "rabbitmq",753 "pattern": "rabbitmq",754 "is_hidden": False,755 "cc_biz_id": 0756 },757 {758 "is_enabled": True,759 "match_mode": 0,760 "source_type": "ALERT",761 "description": "WebLogic",762 "scenario": "组件",763 "exclude": "",764 "alarm_type": "weblogic",765 "pattern": "weblogic",766 "is_hidden": False,767 "cc_biz_id": 0768 },769 {770 "is_enabled": True,771 "match_mode": 0,772 "source_type": "ALERT",773 "description": "ZooKeeper",774 "scenario": "组件",775 "exclude": "",776 "alarm_type": "zookeeper",777 "pattern": "zookeeper",778 "is_hidden": False,779 "cc_biz_id": 0780 },781 {782 "is_enabled": True,783 "match_mode": 0,784 "source_type": "ALERT",785 "description": "物理机-CPU",786 "scenario": "组件",787 "exclude": "",788 "alarm_type": "cpu",789 "pattern": "cpu",790 "is_hidden": False,791 "cc_biz_id": 0792 },793 {794 "is_enabled": True,795 "match_mode": 0,796 "source_type": "ALERT",797 "description": "物理机-磁盘",798 "scenario": "组件",799 "exclude": "",800 "alarm_type": "disk",801 "pattern": "disk",802 "is_hidden": False,803 "cc_biz_id": 0804 },805 {806 "is_enabled": True,807 "match_mode": 0,808 "source_type": "ALERT",809 "description": "物理机-网卡",810 "scenario": "组件",811 "exclude": "",812 "alarm_type": "net",813 "pattern": "net",814 "is_hidden": False,815 "cc_biz_id": 0816 },817 {818 "is_enabled": True,819 "match_mode": 0,820 "source_type": "ALERT",821 "description": "物理机-内存",822 "scenario": "组件",823 "exclude": "",824 "alarm_type": "mem",825 "pattern": "mem",826 "is_hidden": False,827 "cc_biz_id": 0828 },829 {830 "is_enabled": True,831 "match_mode": 0,832 "source_type": "ALERT",833 "description": "物理机-system_env",834 "scenario": "组件",835 "exclude": "",836 "alarm_type": "system_env",837 "pattern": "system_env",838 "is_hidden": False,839 "cc_biz_id": 0840 },841 {842 "is_enabled": True,843 "match_mode": 0,844 "source_type": "ALERT",845 "description": "物理机-进程",846 "scenario": "组件",847 "exclude": "",848 "alarm_type": "process",849 "pattern": "process",850 "is_hidden": False,851 "cc_biz_id": 0852 },853 {854 "is_enabled": True,855 "match_mode": 0,856 "source_type": "ALERT",857 "description": "脚本采集",858 "scenario": "脚本采集",859 "exclude": "",860 "alarm_type": "selfscript",861 "pattern": "selfscript",862 "is_hidden": False,863 "cc_biz_id": 0864 },865 {866 "is_enabled": True,867 "match_mode": 0,868 "source_type": "ALERT",869 "description": "自定义监控",870 "scenario": "自定义监控",871 "exclude": "",872 "alarm_type": "custom",873 "pattern": "custom",874 "is_hidden": False,875 "cc_biz_id": 0876 },877 {878 "is_enabled": True,879 "match_mode": 0,880 "source_type": "ALERT",881 "description": "服务拨测",882 "scenario": "服务拨测",883 "exclude": "",884 "alarm_type": "uptimecheck",885 "pattern": "uptimecheck",886 "is_hidden": False,887 "cc_biz_id": 0888 }...

Full Screen

Full Screen

init_alert_alarm_type_v4.py

Source:init_alert_alarm_type_v4.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.4Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.5Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at6http://opensource.org/licenses/MIT7Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.8""" # noqa9"""更新蓝鲸监控告警类型102018-09-1011- 替换 False12- 替换 True13"""14from fta_solutions_app.models import AlarmType15MODEL = AlarmType16def RUNNER(apps, schema_editor, module, silent): # noqa17 # 先删除所有的蓝鲸监控告警类型18 module.MODEL.objects.filter(source_type='ALERT').delete()19 for item in module.DATA:20 try:21 module.MODEL.objects.create(**item)22 except Exception:23 pass24DATA = [25 {26 "is_enabled": True,27 "match_mode": 0,28 "source_type": "ALERT",29 "description": "可用物理内存",30 "scenario": "主机监控",31 "exclude": "",32 "alarm_type": "mem_60",33 "pattern": "mem_60",34 "is_hidden": False,35 "cc_biz_id": 036 },37 {38 "is_enabled": True,39 "match_mode": 0,40 "source_type": "ALERT",41 "description": "交换分区使用量",42 "scenario": "主机监控",43 "exclude": "",44 "alarm_type": "mem_63",45 "pattern": "mem_63",46 "is_hidden": False,47 "cc_biz_id": 048 },49 {50 "is_enabled": True,51 "match_mode": 0,52 "source_type": "ALERT",53 "description": "物理内存使用率",54 "scenario": "主机监控",55 "exclude": "",56 "alarm_type": "mem_64",57 "pattern": "mem_64",58 "is_hidden": False,59 "cc_biz_id": 060 },61 {62 "is_enabled": True,63 "match_mode": 0,64 "source_type": "ALERT",65 "description": "物理内存使用量",66 "scenario": "主机监控",67 "exclude": "",68 "alarm_type": "mem_97",69 "pattern": "mem_97",70 "is_hidden": False,71 "cc_biz_id": 072 },73 {74 "is_enabled": True,75 "match_mode": 0,76 "source_type": "ALERT",77 "description": "应用内存使用量",78 "scenario": "主机监控",79 "exclude": "",80 "alarm_type": "mem_98",81 "pattern": "mem_98",82 "is_hidden": False,83 "cc_biz_id": 084 },85 {86 "is_enabled": True,87 "match_mode": 0,88 "source_type": "ALERT",89 "description": "应用内存使用率",90 "scenario": "主机监控",91 "exclude": "",92 "alarm_type": "mem_99",93 "pattern": "mem_99",94 "is_hidden": False,95 "cc_biz_id": 096 },97 {98 "is_enabled": True,99 "match_mode": 0,100 "source_type": "ALERT",101 "description": "CPU使用率",102 "scenario": "主机监控",103 "exclude": "",104 "alarm_type": "process_122",105 "pattern": "process_122",106 "is_hidden": False,107 "cc_biz_id": 0108 },109 {110 "is_enabled": True,111 "match_mode": 0,112 "source_type": "ALERT",113 "description": "内存使用率",114 "scenario": "主机监控",115 "exclude": "",116 "alarm_type": "process_123",117 "pattern": "process_123",118 "is_hidden": False,119 "cc_biz_id": 0120 },121 {122 "is_enabled": True,123 "match_mode": 0,124 "source_type": "ALERT",125 "description": "物理内存使用量",126 "scenario": "主机监控",127 "exclude": "",128 "alarm_type": "process_124",129 "pattern": "process_124",130 "is_hidden": False,131 "cc_biz_id": 0132 },133 {134 "is_enabled": True,135 "match_mode": 0,136 "source_type": "ALERT",137 "description": "虚拟内存使用量",138 "scenario": "主机监控",139 "exclude": "",140 "alarm_type": "process_125",141 "pattern": "process_125",142 "is_hidden": False,143 "cc_biz_id": 0144 },145 {146 "is_enabled": True,147 "match_mode": 0,148 "source_type": "ALERT",149 "description": "文件句柄数",150 "scenario": "主机监控",151 "exclude": "",152 "alarm_type": "process_126",153 "pattern": "process_126",154 "is_hidden": False,155 "cc_biz_id": 0156 },157 {158 "is_enabled": True,159 "match_mode": 0,160 "source_type": "ALERT",161 "description": "接收字节流量",162 "scenario": "主机监控",163 "exclude": "",164 "alarm_type": "net_10",165 "pattern": "net_10",166 "is_hidden": False,167 "cc_biz_id": 0168 },169 {170 "is_enabled": True,171 "match_mode": 0,172 "source_type": "ALERT",173 "description": "发送字节流量",174 "scenario": "主机监控",175 "exclude": "",176 "alarm_type": "net_14",177 "pattern": "net_14",178 "is_hidden": False,179 "cc_biz_id": 0180 },181 {182 "is_enabled": True,183 "match_mode": 0,184 "source_type": "ALERT",185 "description": "发送包速率",186 "scenario": "主机监控",187 "exclude": "",188 "alarm_type": "net_16",189 "pattern": "net_16",190 "is_hidden": False,191 "cc_biz_id": 0192 },193 {194 "is_enabled": True,195 "match_mode": 0,196 "source_type": "ALERT",197 "description": "接收包速率",198 "scenario": "主机监控",199 "exclude": "",200 "alarm_type": "net_20",201 "pattern": "net_20",202 "is_hidden": False,203 "cc_biz_id": 0204 },205 {206 "is_enabled": True,207 "match_mode": 0,208 "source_type": "ALERT",209 "description": "ESTABLISHED连接数",210 "scenario": "主机监控",211 "exclude": "",212 "alarm_type": "net_110",213 "pattern": "net_110",214 "is_hidden": False,215 "cc_biz_id": 0216 },217 {218 "is_enabled": True,219 "match_mode": 0,220 "source_type": "ALERT",221 "description": "TIME_WAIT连接数",222 "scenario": "主机监控",223 "exclude": "",224 "alarm_type": "net_111",225 "pattern": "net_111",226 "is_hidden": False,227 "cc_biz_id": 0228 },229 {230 "is_enabled": True,231 "match_mode": 0,232 "source_type": "ALERT",233 "description": "LISTEN连接数",234 "scenario": "主机监控",235 "exclude": "",236 "alarm_type": "net_112",237 "pattern": "net_112",238 "is_hidden": False,239 "cc_biz_id": 0240 },241 {242 "is_enabled": True,243 "match_mode": 0,244 "source_type": "ALERT",245 "description": "LAST_ACK连接数",246 "scenario": "主机监控",247 "exclude": "",248 "alarm_type": "net_113",249 "pattern": "net_113",250 "is_hidden": False,251 "cc_biz_id": 0252 },253 {254 "is_enabled": True,255 "match_mode": 0,256 "source_type": "ALERT",257 "description": "SYN_RECV连接数",258 "scenario": "主机监控",259 "exclude": "",260 "alarm_type": "net_114",261 "pattern": "net_114",262 "is_hidden": False,263 "cc_biz_id": 0264 },265 {266 "is_enabled": True,267 "match_mode": 0,268 "source_type": "ALERT",269 "description": "SYN_SENT连接数",270 "scenario": "主机监控",271 "exclude": "",272 "alarm_type": "net_115",273 "pattern": "net_115",274 "is_hidden": False,275 "cc_biz_id": 0276 },277 {278 "is_enabled": True,279 "match_mode": 0,280 "source_type": "ALERT",281 "description": "FIN_WAIT1连接数",282 "scenario": "主机监控",283 "exclude": "",284 "alarm_type": "net_116",285 "pattern": "net_116",286 "is_hidden": False,287 "cc_biz_id": 0288 },289 {290 "is_enabled": True,291 "match_mode": 0,292 "source_type": "ALERT",293 "description": "FIN_WAIT2连接数",294 "scenario": "主机监控",295 "exclude": "",296 "alarm_type": "net_117",297 "pattern": "net_117",298 "is_hidden": False,299 "cc_biz_id": 0300 },301 {302 "is_enabled": True,303 "match_mode": 0,304 "source_type": "ALERT",305 "description": "CLOSING连接数",306 "scenario": "主机监控",307 "exclude": "",308 "alarm_type": "net_118",309 "pattern": "net_118",310 "is_hidden": False,311 "cc_biz_id": 0312 },313 {314 "is_enabled": True,315 "match_mode": 0,316 "source_type": "ALERT",317 "description": "CLOSED状态连接数",318 "scenario": "主机监控",319 "exclude": "",320 "alarm_type": "net_119",321 "pattern": "net_119",322 "is_hidden": False,323 "cc_biz_id": 0324 },325 {326 "is_enabled": True,327 "match_mode": 0,328 "source_type": "ALERT",329 "description": "UDP接收包量",330 "scenario": "主机监控",331 "exclude": "",332 "alarm_type": "net_120",333 "pattern": "net_120",334 "is_hidden": False,335 "cc_biz_id": 0336 },337 {338 "is_enabled": True,339 "match_mode": 0,340 "source_type": "ALERT",341 "description": "UDP发送包量",342 "scenario": "主机监控",343 "exclude": "",344 "alarm_type": "net_121",345 "pattern": "net_121",346 "is_hidden": False,347 "cc_biz_id": 0348 },349 {350 "is_enabled": True,351 "match_mode": 0,352 "source_type": "ALERT",353 "description": "磁盘使用率",354 "scenario": "主机监控",355 "exclude": "",356 "alarm_type": "disk_81",357 "pattern": "disk_81",358 "is_hidden": False,359 "cc_biz_id": 0360 },361 {362 "is_enabled": True,363 "match_mode": 0,364 "source_type": "ALERT",365 "description": "读速率",366 "scenario": "主机监控",367 "exclude": "",368 "alarm_type": "disk_86",369 "pattern": "disk_86",370 "is_hidden": False,371 "cc_biz_id": 0372 },373 {374 "is_enabled": True,375 "match_mode": 0,376 "source_type": "ALERT",377 "description": "写速率",378 "scenario": "主机监控",379 "exclude": "",380 "alarm_type": "disk_87",381 "pattern": "disk_87",382 "is_hidden": False,383 "cc_biz_id": 0384 },385 {386 "is_enabled": True,387 "match_mode": 0,388 "source_type": "ALERT",389 "description": "磁盘IO使用率",390 "scenario": "主机监控",391 "exclude": "",392 "alarm_type": "disk_96",393 "pattern": "disk_96",394 "is_hidden": False,395 "cc_biz_id": 0396 },397 {398 "is_enabled": True,399 "match_mode": 0,400 "source_type": "ALERT",401 "description": "5分钟平均负载",402 "scenario": "主机监控",403 "exclude": "",404 "alarm_type": "cpu_3",405 "pattern": "cpu_3",406 "is_hidden": False,407 "cc_biz_id": 0408 },409 {410 "is_enabled": True,411 "match_mode": 0,412 "source_type": "ALERT",413 "description": "CPU总使用率",414 "scenario": "主机监控",415 "exclude": "",416 "alarm_type": "cpu_7",417 "pattern": "cpu_7",418 "is_hidden": False,419 "cc_biz_id": 0420 },421 {422 "is_enabled": True,423 "match_mode": 0,424 "source_type": "ALERT",425 "description": "CPU单核使用率",426 "scenario": "主机监控",427 "exclude": "",428 "alarm_type": "cpu_8",429 "pattern": "cpu_8",430 "is_hidden": False,431 "cc_biz_id": 0432 },433 {434 "is_enabled": True,435 "match_mode": 0,436 "source_type": "ALERT",437 "description": "Agent心跳丢失",438 "scenario": "主机监控",439 "exclude": "",440 "alarm_type": "base_alarm_2",441 "pattern": "base_alarm_2",442 "is_hidden": False,443 "cc_biz_id": 0444 },445 {446 "is_enabled": True,447 "match_mode": 0,448 "source_type": "ALERT",449 "description": "磁盘只读",450 "scenario": "主机监控",451 "exclude": "",452 "alarm_type": "base_alarm_3",453 "pattern": "base_alarm_3",454 "is_hidden": False,455 "cc_biz_id": 0456 },457 {458 "is_enabled": True,459 "match_mode": 0,460 "source_type": "ALERT",461 "description": "磁盘写满",462 "scenario": "主机监控",463 "exclude": "",464 "alarm_type": "base_alarm_6",465 "pattern": "base_alarm_6",466 "is_hidden": False,467 "cc_biz_id": 0468 },469 {470 "is_enabled": True,471 "match_mode": 0,472 "source_type": "ALERT",473 "description": "Corefile产生",474 "scenario": "主机监控",475 "exclude": "",476 "alarm_type": "base_alarm_7",477 "pattern": "base_alarm_7",478 "is_hidden": False,479 "cc_biz_id": 0480 },481 {482 "is_enabled": True,483 "match_mode": 0,484 "source_type": "ALERT",485 "description": "PING不可达告警",486 "scenario": "主机监控",487 "exclude": "",488 "alarm_type": "base_alarm_8",489 "pattern": "base_alarm_8",490 "is_hidden": False,491 "cc_biz_id": 0492 },493 {494 "is_enabled": True,495 "match_mode": 0,496 "source_type": "ALERT",497 "description": "系统重新启动",498 "scenario": "主机监控",499 "exclude": "",500 "alarm_type": "system_env_os_restart",501 "pattern": "system_env_os_restart",502 "is_hidden": False,503 "cc_biz_id": 0504 },505 {506 "is_enabled": True,507 "match_mode": 0,508 "source_type": "ALERT",509 "description": "进程端口",510 "scenario": "主机监控",511 "exclude": "",512 "alarm_type": "proc_port_proc_port",513 "pattern": "proc_port_proc_port",514 "is_hidden": False,515 "cc_biz_id": 0516 },517 {518 "is_enabled": True,519 "match_mode": 0,520 "source_type": "ALERT",521 "description": "自定义字符型",522 "scenario": "主机监控",523 "exclude": "",524 "alarm_type": "gse_custom_event_gse_custom_event",525 "pattern": "gse_custom_event_gse_custom_event",526 "is_hidden": False,527 "cc_biz_id": 0528 },529 {530 "is_enabled": True,531 "match_mode": 0,532 "source_type": "ALERT",533 "description": "Apache",534 "scenario": "组件",535 "exclude": "",536 "alarm_type": "apache",537 "pattern": "apache",538 "is_hidden": False,539 "cc_biz_id": 0540 },541 {542 "is_enabled": True,543 "match_mode": 0,544 "source_type": "ALERT",545 "description": "MySQL",546 "scenario": "组件",547 "exclude": "",548 "alarm_type": "mysql",549 "pattern": "mysql",550 "is_hidden": False,551 "cc_biz_id": 0552 },553 {554 "is_enabled": True,555 "match_mode": 0,556 "source_type": "ALERT",557 "description": "NginX",558 "scenario": "组件",559 "exclude": "",560 "alarm_type": "nginx",561 "pattern": "nginx",562 "is_hidden": False,563 "cc_biz_id": 0564 },565 {566 "is_enabled": True,567 "match_mode": 0,568 "source_type": "ALERT",569 "description": "Redis",570 "scenario": "组件",571 "exclude": "",572 "alarm_type": "redis",573 "pattern": "redis",574 "is_hidden": False,575 "cc_biz_id": 0576 },577 {578 "is_enabled": True,579 "match_mode": 0,580 "source_type": "ALERT",581 "description": "物理机",582 "scenario": "组件",583 "exclude": "",584 "alarm_type": "system",585 "pattern": "system",586 "is_hidden": False,587 "cc_biz_id": 0588 },589 {590 "is_enabled": True,591 "match_mode": 0,592 "source_type": "ALERT",593 "description": "Tomcat",594 "scenario": "组件",595 "exclude": "",596 "alarm_type": "tomcat",597 "pattern": "tomcat",598 "is_hidden": False,599 "cc_biz_id": 0600 },601 {602 "is_enabled": True,603 "match_mode": 0,604 "source_type": "ALERT",605 "description": "Active Directory",606 "scenario": "组件",607 "exclude": "",608 "alarm_type": "ad",609 "pattern": "ad",610 "is_hidden": False,611 "cc_biz_id": 0612 },613 {614 "is_enabled": True,615 "match_mode": 0,616 "source_type": "ALERT",617 "description": "Ceph",618 "scenario": "组件",619 "exclude": "",620 "alarm_type": "ceph",621 "pattern": "ceph",622 "is_hidden": False,623 "cc_biz_id": 0624 },625 {626 "is_enabled": True,627 "match_mode": 0,628 "source_type": "ALERT",629 "description": "Consul",630 "scenario": "组件",631 "exclude": "",632 "alarm_type": "consul",633 "pattern": "consul",634 "is_hidden": False,635 "cc_biz_id": 0636 },637 {638 "is_enabled": True,639 "match_mode": 0,640 "source_type": "ALERT",641 "description": "ElasticSearch",642 "scenario": "组件",643 "exclude": "",644 "alarm_type": "elastic",645 "pattern": "elastic",646 "is_hidden": False,647 "cc_biz_id": 0648 },649 {650 "is_enabled": True,651 "match_mode": 0,652 "source_type": "ALERT",653 "description": "Exchange 2010",654 "scenario": "组件",655 "exclude": "",656 "alarm_type": "exchange2010",657 "pattern": "exchange2010",658 "is_hidden": False,659 "cc_biz_id": 0660 },661 {662 "is_enabled": True,663 "match_mode": 0,664 "source_type": "ALERT",665 "description": "HAProxy",666 "scenario": "组件",667 "exclude": "",668 "alarm_type": "haproxy",669 "pattern": "haproxy",670 "is_hidden": False,671 "cc_biz_id": 0672 },673 {674 "is_enabled": True,675 "match_mode": 0,676 "source_type": "ALERT",677 "description": "IIS",678 "scenario": "组件",679 "exclude": "",680 "alarm_type": "iis",681 "pattern": "iis",682 "is_hidden": False,683 "cc_biz_id": 0684 },685 {686 "is_enabled": True,687 "match_mode": 0,688 "source_type": "ALERT",689 "description": "Kafka",690 "scenario": "组件",691 "exclude": "",692 "alarm_type": "kafka",693 "pattern": "kafka",694 "is_hidden": False,695 "cc_biz_id": 0696 },697 {698 "is_enabled": True,699 "match_mode": 0,700 "source_type": "ALERT",701 "description": "MemCache",702 "scenario": "组件",703 "exclude": "",704 "alarm_type": "memcache",705 "pattern": "memcache",706 "is_hidden": False,707 "cc_biz_id": 0708 },709 {710 "is_enabled": True,711 "match_mode": 0,712 "source_type": "ALERT",713 "description": "MongoDB",714 "scenario": "组件",715 "exclude": "",716 "alarm_type": "mongodb",717 "pattern": "mongodb",718 "is_hidden": False,719 "cc_biz_id": 0720 },721 {722 "is_enabled": True,723 "match_mode": 0,724 "source_type": "ALERT",725 "description": "SQLServer",726 "scenario": "组件",727 "exclude": "",728 "alarm_type": "mssql",729 "pattern": "mssql",730 "is_hidden": False,731 "cc_biz_id": 0732 },733 {734 "is_enabled": True,735 "match_mode": 0,736 "source_type": "ALERT",737 "description": "Oracle",738 "scenario": "组件",739 "exclude": "",740 "alarm_type": "oracle",741 "pattern": "oracle",742 "is_hidden": False,743 "cc_biz_id": 0744 },745 {746 "is_enabled": True,747 "match_mode": 0,748 "source_type": "ALERT",749 "description": "RabbitMQ",750 "scenario": "组件",751 "exclude": "",752 "alarm_type": "rabbitmq",753 "pattern": "rabbitmq",754 "is_hidden": False,755 "cc_biz_id": 0756 },757 {758 "is_enabled": True,759 "match_mode": 0,760 "source_type": "ALERT",761 "description": "WebLogic",762 "scenario": "组件",763 "exclude": "",764 "alarm_type": "weblogic",765 "pattern": "weblogic",766 "is_hidden": False,767 "cc_biz_id": 0768 },769 {770 "is_enabled": True,771 "match_mode": 0,772 "source_type": "ALERT",773 "description": "ZooKeeper",774 "scenario": "组件",775 "exclude": "",776 "alarm_type": "zookeeper",777 "pattern": "zookeeper",778 "is_hidden": False,779 "cc_biz_id": 0780 },781 {782 "is_enabled": True,783 "match_mode": 0,784 "source_type": "ALERT",785 "description": "脚本采集",786 "scenario": "脚本采集",787 "exclude": "",788 "alarm_type": "selfscript",789 "pattern": "selfscript",790 "is_hidden": False,791 "cc_biz_id": 0792 },793 {794 "is_enabled": True,795 "match_mode": 0,796 "source_type": "ALERT",797 "description": "自定义监控",798 "scenario": "自定义监控",799 "exclude": "",800 "alarm_type": "custom",801 "pattern": "custom",802 "is_hidden": False,803 "cc_biz_id": 0804 },805 {806 "is_enabled": True,807 "match_mode": 0,808 "source_type": "ALERT",809 "description": "服务拨测",810 "scenario": "服务拨测",811 "exclude": "",812 "alarm_type": "uptimecheck",813 "pattern": "uptimecheck",814 "is_hidden": False,815 "cc_biz_id": 0816 }...

Full Screen

Full Screen

init_alarmtype.py

Source:init_alarmtype.py Github

copy

Full Screen

1# coding: utf-82"""3Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.4Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.5Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at6http://opensource.org/licenses/MIT7Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.8""" # noqa9from django.utils.translation import ugettext as _10from fta_solutions_app.models import AlarmType11MODEL = AlarmType12ITEM_CHECKER = lambda apps, item: not AlarmType.objects.filter(13 alarm_type=item["alarm_type"],14 source_type=item["source_type"],15 description=item["description"],16 cc_biz_id=0,17).exists()18CHECKER = lambda apps: True19def RUNNER(apps, schema_editor, module, silent): # noqa20 for item in module.DATA:21 try:22 refs = module.MODEL.objects.filter(23 source_type=item['source_type'],24 cc_biz_id=item['cc_biz_id'],25 alarm_type=item['alarm_type'])26 if refs:27 refs.update(28 description=item['description'])29 else:30 module.MODEL.objects.create(**item)31 except Exception:32 pass33DATA = [34 # ZABBIX35 {36 'alarm_type': 'ZABBIX-agent.*',37 'cc_biz_id': 0,38 'description': _(u'Agent状态(agent.*)'),39 'exclude': '',40 'is_enabled': True,41 'is_hidden': False,42 'match_mode': 2,43 'pattern': 'agent.*',44 'source_type': 'ZABBIX'45 },46 {47 'alarm_type': 'ZABBIX-system.cpu.*',48 'cc_biz_id': 0,49 'description': _(u'CPU使用率(system.cpu.*)'),50 'exclude': '',51 'is_enabled': True,52 'is_hidden': False,53 'match_mode': 2,54 'pattern': 'system.cpu.*',55 'source_type': 'ZABBIX'56 },57 {58 'alarm_type': 'ZABBIX-vm.memory.size',59 'cc_biz_id': 0,60 'description': _(u'内存使用量(vm.memory.size)'),61 'exclude': '',62 'is_enabled': True,63 'is_hidden': False,64 'match_mode': 2,65 'pattern': 'vm.memory.size',66 'source_type': 'ZABBIX'67 },68 {69 'alarm_type': 'ZABBIX-system.swap.*',70 'cc_biz_id': 0,71 'description': _(u'Swap使用量(system.swap.*)'),72 'exclude': '',73 'is_enabled': True,74 'is_hidden': False,75 'match_mode': 2,76 'pattern': 'system.swap.*',77 'source_type': 'ZABBIX'78 },79 {80 'alarm_type': 'ZABBIX-kernel.*',81 'cc_biz_id': 0,82 'description': _(u'系统内核状态(kernel.*)'),83 'exclude': '',84 'is_enabled': True,85 'is_hidden': False,86 'match_mode': 2,87 'pattern': 'kernel.*',88 'source_type': 'ZABBIX'89 },90 {91 'alarm_type': 'ZABBIX-vfs.dev.*',92 'cc_biz_id': 0,93 'description': _(u'磁盘IO使用率(vfs.dev.*)'),94 'exclude': '',95 'is_enabled': True,96 'is_hidden': False,97 'match_mode': 2,98 'pattern': 'vfs.dev.*',99 'source_type': 'ZABBIX'100 },101 {102 'alarm_type': 'ZABBIX-vfs.fs.*',103 'cc_biz_id': 0,104 'description': _(u'磁盘容量(vfs.fs.*)'),105 'exclude': '',106 'is_enabled': True,107 'is_hidden': False,108 'match_mode': 2,109 'pattern': 'vfs.fs.*',110 'source_type': 'ZABBIX'111 },112 {113 'alarm_type': 'ZABBIX-proc.num',114 'cc_biz_id': 0,115 'description': _(u'进程数量检查(proc.num)'),116 'exclude': '',117 'is_enabled': True,118 'is_hidden': False,119 'match_mode': 2,120 'pattern': 'proc.num',121 'source_type': 'ZABBIX'122 },123 {124 'alarm_type': 'ZABBIX-icmpping*',125 'cc_biz_id': 0,126 'description': _(u'Ping检查(icmpping*)'),127 'exclude': '',128 'is_enabled': True,129 'is_hidden': False,130 'match_mode': 2,131 'pattern': 'icmpping*',132 'source_type': 'ZABBIX'133 },134 {135 'alarm_type': 'ZABBIX-net.tcp.*',136 'cc_biz_id': 0,137 'description': _(u'TCP链接检查(net.tcp.*)'),138 'exclude': '',139 'is_enabled': True,140 'is_hidden': False,141 'match_mode': 2,142 'pattern': 'net.tcp.*',143 'source_type': 'ZABBIX'144 },145 {146 'alarm_type': 'ZABBIX-net.udp.*',147 'cc_biz_id': 0,148 'description': _(u'UDP链接检查(net.udp.*)'),149 'exclude': '',150 'is_enabled': True,151 'is_hidden': False,152 'match_mode': 2,153 'pattern': 'net.udp.*',154 'source_type': 'ZABBIX'155 },156 {157 'alarm_type': 'ZABBIX-vfs.file.*',158 'cc_biz_id': 0,159 'description': _(u'文件状态检查(vfs.file.*)'),160 'exclude': '',161 'is_enabled': True,162 'is_hidden': False,163 'match_mode': 2,164 'pattern': 'vfs.file.*',165 'source_type': 'ZABBIX'166 },167 {168 'alarm_type': 'zabbix.*',169 'cc_biz_id': 0,170 'description': _(u'Zabbix其他'),171 'exclude': '',172 'is_enabled': True,173 'is_hidden': False,174 'match_mode': 2,175 'pattern': 'zabbix.*',176 'source_type': 'ZABBIX'177 },178 # NAGIOS179 {180 'alarm_type': 'NAGIOS-http',181 'cc_biz_id': 0,182 'description': u'HTTP(http)',183 'exclude': '',184 'is_enabled': True,185 'is_hidden': False,186 'match_mode': 1,187 'pattern': '\\bhttp\\b',188 'source_type': 'NAGIOS'189 },190 {191 'alarm_type': 'NAGIOS-cpu',192 'cc_biz_id': 0,193 'description': u'CPU(cpu)',194 'exclude': '',195 'is_enabled': True,196 'is_hidden': False,197 'match_mode': 1,198 'pattern': '\\bcpu\\b',199 'source_type': 'NAGIOS'200 },201 {202 'alarm_type': 'NAGIOS-memory',203 'cc_biz_id': 0,204 'description': _(u'内存(memory)'),205 'exclude': '',206 'is_enabled': True,207 'is_hidden': False,208 'match_mode': 1,209 'pattern': '\\bmemory\\b',210 'source_type': 'NAGIOS'211 },212 {213 'alarm_type': 'NAGIOS-net',214 'cc_biz_id': 0,215 'description': _(u'网络(net)'),216 'exclude': '',217 'is_enabled': True,218 'is_hidden': False,219 'match_mode': 1,220 'pattern': '\\bnet\\b',221 'source_type': 'NAGIOS'222 },223 {224 'alarm_type': 'NAGIOS-filesystem',225 'cc_biz_id': 0,226 'description': _(u'文件系统(filesystem)'),227 'exclude': '',228 'is_enabled': True,229 'is_hidden': False,230 'match_mode': 1,231 'pattern': '\\bfilesystem\\b',232 'source_type': 'NAGIOS'233 },234 {235 'alarm_type': 'NAGIOS-disk',236 'cc_biz_id': 0,237 'description': _(u'磁盘(disk)'),238 'exclude': '',239 'is_enabled': True,240 'is_hidden': False,241 'match_mode': 1,242 'pattern': '\\bdisk\\b',243 'source_type': 'NAGIOS'244 },245 {246 'alarm_type': 'NAGIOS-process',247 'cc_biz_id': 0,248 'description': _(u'进程(process)'),249 'exclude': '',250 'is_enabled': True,251 'is_hidden': False,252 'match_mode': 1,253 'pattern': '\\bprocess\\b',254 'source_type': 'NAGIOS'255 },256 {257 'alarm_type': 'NAGIOS-ping',258 'cc_biz_id': 0,259 'description': u'Ping',260 'exclude': '',261 'is_enabled': True,262 'is_hidden': False,263 'match_mode': 1,264 'pattern': '\\bping\\b',265 'source_type': 'NAGIOS'266 },267 {268 'alarm_type': 'nagios',269 'cc_biz_id': 0,270 'description': _(u'Nagios其他(nagios)'),271 'exclude': '',272 'is_enabled': True,273 'is_hidden': False,274 'match_mode': 1,275 'pattern': '\\bnagios\\b',276 'source_type': 'NAGIOS'277 },278 # OPEN-FALCON279 {280 'alarm_type': 'OPEN-FALCON-open-falcon-agent.*',281 'cc_biz_id': 0,282 'description': _(u'Agent状态(agent.*)'),283 'exclude': '',284 'is_enabled': True,285 'is_hidden': False,286 'match_mode': 2,287 'pattern': 'agent.*',288 'source_type': 'OPEN-FALCON'289 },290 {291 'alarm_type': 'OPEN-FALCON-open-falcon-load.*',292 'cc_biz_id': 0,293 'description': _(u'CPU使用率(load.*)'),294 'exclude': '',295 'is_enabled': True,296 'is_hidden': False,297 'match_mode': 2,298 'pattern': 'load.*',299 'source_type': 'OPEN-FALCON'300 },301 {302 'alarm_type': 'OPEN-FALCON-open-falcon-mem.*',303 'cc_biz_id': 0,304 'description': _(u'内存使用量(mem.*)'),305 'exclude': '',306 'is_enabled': True,307 'is_hidden': False,308 'match_mode': 2,309 'pattern': 'mem.*',310 'source_type': 'OPEN-FALCON'311 },312 {313 'alarm_type': 'OPEN-FALCON-open-falcon-disk.io.*',314 'cc_biz_id': 0,315 'description': _(u'磁盘IO使用率(disk.io.*)'),316 'exclude': '',317 'is_enabled': True,318 'is_hidden': False,319 'match_mode': 2,320 'pattern': 'disk.io.*',321 'source_type': 'OPEN-FALCON'322 },323 {324 'alarm_type': 'OPEN-FALCON-open-falcon-df.*',325 'cc_biz_id': 0,326 'description': _(u'磁盘容量(df.*)'),327 'exclude': '',328 'is_enabled': True,329 'is_hidden': False,330 'match_mode': 2,331 'pattern': 'df.*',332 'source_type': 'OPEN-FALCON'333 },334 {335 'alarm_type': 'OPEN-FALCON-open-falcon-net.if.*',336 'cc_biz_id': 0,337 'description': _(u'网卡流量(net.if.*)'),338 'exclude': '',339 'is_enabled': True,340 'is_hidden': False,341 'match_mode': 2,342 'pattern': 'net.if.*',343 'source_type': 'OPEN-FALCON'344 },345 {346 'alarm_type': 'OPEN-FALCON-open-falcon-net.port.listen',347 'cc_biz_id': 0,348 'description': _(u'端口监控(net.port.listen)'),349 'exclude': '',350 'is_enabled': True,351 'is_hidden': False,352 'match_mode': 2,353 'pattern': 'net.port.listen',354 'source_type': 'OPEN-FALCON'355 },356 {357 'alarm_type': 'open-falcon.*',358 'cc_biz_id': 0,359 'description': _(u'Open-falcon其他'),360 'exclude': '',361 'is_enabled': True,362 'is_hidden': False,363 'match_mode': 2,364 'pattern': 'open-falcon.*',365 'source_type': 'OPEN-FALCON'366 },367 # REST-API368 {369 'alarm_type': 'api_default',370 'cc_biz_id': 0,371 'description': _(u'REST默认分类'),372 'exclude': '',373 'is_enabled': True,374 'is_hidden': False,375 'match_mode': 0,376 'pattern': 'api_default',377 'source_type': 'REST-API'378 },379 # FTA380 {381 'alarm_type': 'fta_advice',382 'cc_biz_id': 0,383 'description': _(u'预警自愈'),384 'exclude': '',385 'is_enabled': True,386 'is_hidden': False,387 'match_mode': 2,388 'pattern': 'fta_advice',389 'source_type': 'FTA'390 },391 # CUSTOM392 {393 'alarm_type': 'default',394 'cc_biz_id': 0,395 'description': _(u'默认分类'),396 'exclude': '',397 'is_enabled': True,398 'is_hidden': False,399 'match_mode': 0,400 'pattern': 'default',401 'source_type': 'CUSTOM'402 },403 # EMAIL404 {405 'alarm_type': 'email',406 'cc_biz_id': 0,407 'description': _(u'邮件默认'),408 'exclude': '',409 'is_enabled': True,410 'is_hidden': False,411 'match_mode': 1,412 'pattern': '.*',413 'source_type': 'EMAIL'414 },415 # AWS416 {417 'alarm_type': 'AWS-CPUUtilization',418 'cc_biz_id': 0,419 'description': 'CPU Utilization',420 'exclude': '',421 'is_enabled': True,422 'is_hidden': False,423 'match_mode': 0,424 'pattern': 'CPUUtilization',425 'source_type': 'AWS'426 },427 {428 'alarm_type': 'AWS-DiskReadBytes',429 'cc_biz_id': 0,430 'description': 'Disk Reads',431 'exclude': '',432 'is_enabled': True,433 'is_hidden': False,434 'match_mode': 0,435 'pattern': 'DiskReadBytes',436 'source_type': 'AWS'437 },438 {439 'alarm_type': 'AWS-DiskReadOps',440 'cc_biz_id': 0,441 'description': 'Disk Read Operations',442 'exclude': '',443 'is_enabled': True,444 'is_hidden': False,445 'match_mode': 0,446 'pattern': 'DiskReadOps',447 'source_type': 'AWS'448 },449 {450 'alarm_type': 'AWS-DiskWriteBytes',451 'cc_biz_id': 0,452 'description': 'Disk Writes',453 'exclude': '',454 'is_enabled': True,455 'is_hidden': False,456 'match_mode': 0,457 'pattern': 'DiskWriteBytes',458 'source_type': 'AWS'459 },460 {461 'alarm_type': 'AWS-DiskWriteOps',462 'cc_biz_id': 0,463 'description': 'Disk Write Operations',464 'exclude': '',465 'is_enabled': True,466 'is_hidden': False,467 'match_mode': 0,468 'pattern': 'DiskWriteOps',469 'source_type': 'AWS'470 },471 {472 'alarm_type': 'AWS-NetworkIn',473 'cc_biz_id': 0,474 'description': 'Network In',475 'exclude': '',476 'is_enabled': True,477 'is_hidden': False,478 'match_mode': 0,479 'pattern': 'NetworkIn',480 'source_type': 'AWS'481 },482 {483 'alarm_type': 'AWS-NetworkOut',484 'cc_biz_id': 0,485 'description': 'Network Out',486 'exclude': '',487 'is_enabled': True,488 'is_hidden': False,489 'match_mode': 0,490 'pattern': 'NetworkOut',491 'source_type': 'AWS'492 },493 {494 'alarm_type': 'AWS-StatusCheckFailed',495 'cc_biz_id': 0,496 'description': 'Status Check Failed (Any)',497 'exclude': '',498 'is_enabled': True,499 'is_hidden': False,500 'match_mode': 0,501 'pattern': 'StatusCheckFailed',502 'source_type': 'AWS'503 },504 {505 'alarm_type': 'AWS-StatusCheckFailed_Instance',506 'cc_biz_id': 0,507 'description': 'Status Check Failed (Instance)',508 'exclude': '',509 'is_enabled': True,510 'is_hidden': False,511 'match_mode': 0,512 'pattern': 'StatusCheckFailed_Instance',513 'source_type': 'AWS'514 },515 {516 'alarm_type': 'AWS-StatusCheckFailed_System',517 'cc_biz_id': 0,518 'description': 'Status Check Failed (System)',519 'exclude': '',520 'is_enabled': True,521 'is_hidden': False,522 'match_mode': 0,523 'pattern': 'StatusCheckFailed_System',524 'source_type': 'AWS'525 },526 # ICINGA2527 {528 'alarm_type': 'ping',529 'cc_biz_id': 0,530 'description': u'Ping',531 'exclude': '',532 'is_enabled': True,533 'is_hidden': False,534 'match_mode': 1,535 'pattern': '^ping',536 'source_type': 'ICINGA2'537 },538 {539 'alarm_type': 'ssh',540 'cc_biz_id': 0,541 'description': u'ssh',542 'exclude': '',543 'is_enabled': True,544 'is_hidden': False,545 'match_mode': 1,546 'pattern': '^ssh',547 'source_type': 'ICINGA2'548 },549 {550 'alarm_type': 'http',551 'cc_biz_id': 0,552 'description': u'http',553 'exclude': '',554 'is_enabled': True,555 'is_hidden': False,556 'match_mode': 1,557 'pattern': '^http',558 'source_type': 'ICINGA2'559 },560 {561 'alarm_type': 'load',562 'cc_biz_id': 0,563 'description': _(u'平均负载'),564 'exclude': '',565 'is_enabled': True,566 'is_hidden': False,567 'match_mode': 1,568 'pattern': '^load',569 'source_type': 'ICINGA2'570 },571 {572 'alarm_type': 'procs',573 'cc_biz_id': 0,574 'description': _(u'进程'),575 'exclude': '',576 'is_enabled': True,577 'is_hidden': False,578 'match_mode': 1,579 'pattern': '^procs',580 'source_type': 'ICINGA2'581 },582 {583 'alarm_type': 'swap',584 'cc_biz_id': 0,585 'description': u'swap',586 'exclude': '',587 'is_enabled': True,588 'is_hidden': False,589 'match_mode': 1,590 'pattern': '^swap',591 'source_type': 'ICINGA2'592 },593 {594 'alarm_type': 'users',595 'cc_biz_id': 0,596 'description': _(u'登录用户数'),597 'exclude': '',598 'is_enabled': True,599 'is_hidden': False,600 'match_mode': 1,601 'pattern': '^users',602 'source_type': 'ICINGA2'603 },604 {605 'alarm_type': 'icinga',606 'cc_biz_id': 0,607 'description': _(u'icinga默认'),608 'exclude': '',609 'is_enabled': True,610 'is_hidden': False,611 'match_mode': 1,612 'pattern': '^icinga',613 'source_type': 'ICINGA2'614 },...

Full Screen

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful