INSERT INTO images (imageid,imagetype,name,image) VALUES (177,1,'Workstation_(128)',decode('[encoded data, 40350 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (178,1,'Workstation_(24)',decode('89504E470D0A1A0A0000000D4948445200000018000000160806000000DA7D5C880000000473424954080808087C086488000000097048597300000298000002980136D347DF0000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000005914944415448899D955F885D571587BFBDCF3E7FEEBDE7DE999B493293C94453356DD3404025487CB0FA20A58D15B1A022227D28A650F0B58F99E093827DB1088A250882494054548AB6129A46FC17D2D6503B6D9A84269D4C66E6CEFD7BCEB9E7EC7DF6DE3E240D24D8075DB01EF6CBF7B159EBC712DE7BFED73A7EFCB83C74E8F02127C411048F9DFFC7F9EE85D72ECC792FFEA56B7BF2C0FD074F3EF7DCB13E8078E2EBDFEAC78D66546459565555569B7A2C941C084F4FE0D72D7ED594FAFD5845EB8F3CF6C89EC5A5DD9F0F55F868A8D40E216E094F9F3C5D5BEFD46492B1B1B9C9E6FA1A5FF9C6934FFFF07BCFFE44A5B37333371EFCB2DCDE8E5A0B899C6F25925628698660AA8A6A5A501625653965252F78E38D2BD869869F16CCB7245F78F8611CCEB73A6DCA5233B76327C3D188CBFFBE780040D55ABBD23A79B3124CA3986DAA816C3768751A2C7612CAD2904D0D9BA329936141362928F292229BA286E7D1A6465786A58F6EA79976B876FD1A8D344546510DA0F2C9D0CA5AABD2C404DA116A87AA2C616551A5A595C498DAA31A1133D611494F124012405034A82ACD466FC8C6D6DF198D8614E5145B5BBC170E406559513B6BE2D23A64ED092A878A1DAA721859D31101ADB4412025B114C492DB2D88C64DCACA609DA19976489D679215E4938C20101E4019AD8D7735DA81B48EC03AC6DAA20B431389558A380EE9A4094900B1F47724BEDFA2AC347118D87AB2116E647DF2F104AD35424A0BA084949577961A81760265C169CF18CB36E5898CA3A92DED34A49D2624777E00D3B445A533BEF4F8E3BD332FBFB4B41836084D8FB9ED3B39FCB92FAE002819C84A780B41402DA07430AA2C4DA9088D23D18E5CD7E43A60B11DE12444E296C0369B14A34D3EF3E98345B73BC73B97DE25CB0BA246FB4E66A44054DE59BC94200346C6A39DA0F282BCF654C6516A47616A7263E9A409B3ED84562B2149538AA2C0BB5B617D6FF526DDEEB6BB42298594A570355E4A6A044648B4906804B587D27ACADA31358E425BA6C6D14E1B24CD98A899321A0CEFC01EF8F87DACAEAEDE255052CA0267F022A0F4121148A40CA89134D174F49438F3080D3A138C42CF1487AE2A8657DF66381C82871B6B37595DBBC1649CD1DB1AB36BCF5E6E0F5914FEF205167AD7B1658ED005141926EBF3FEF5F7B83818A29462F7D21E762F7D84F985055A694A77761BDA18840CA89D0BDEB97C85B495220245AC04CE3901A00219BCB5B572F1B3E07D12C73E4E621747B16FB752963E75484551ECD3B4550E06BDF1683469BF7BE9723B69B6C2388A886E77968D67948A701E1AAD066BEBEBF47B1B33428840FDE137A79E019E011042C8EEE2DEAF85323ABE6BF7D2AE6F3FF95472F6EC5F7860EF2792B3AFBCD232D666F30B3B4FECEACCEEBB6FDFBE87367B83F6D6C6A069EB3A3CB0FF7E36D73746D7AF5CBA122AF5D757FFFCC757BDF75678EF3977EE5C97B0F9B1F178F8C97F9E7FEDFBB3DD4E37EDA46266A6432003C230240A155204044220A5405B8B9482ADE1D0BCFCE24B7FFBFDAF7FF5E2DADAEA19E04D2007BCF7DE0B40FCE8859FFDEEE0FE03470229098200630CE0F180313541A09052A08200632DFED67620A4C47B0F1EB646C31B2B2B570F3FFBDDEF5CBB6B4DBDF7FEAD95B79FDA1A0C5D148588DBE8244E48E284384E0854401445002449C24C3B65FBDC1C42084C5D33984CC8A7E57CD20E4FDE7B9C84F71E21843871FAF42F16B6CD7D73716181462321CF0B2A63305AD39D9D659217CCEF98637DB3C7D670C8603CAE2759767D5A167F2AF3E2A766347A7D7979D9FB7B4EA4F8E07DF4E8D1F0D1AF3E512CEDDCA9B4D63CB4FF415EBFF826B5B39465495695659EE75726E3E16FB352BF60FBFDABCBC78E7984E05EE87F150821C4895F9EFA719A369F0E0285753E9B14E395417F78AAA7F5CFE37E7F6B7979D9737B7A1F06FC50C107921F3CFFFC11319D9EC9F37CFAFF00EFADFF000F1AFE7A87EDDB0D0000000049454E44AE426082','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (179,1,'Workstation_(48)',decode('[encoded data, 9144 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (180,1,'Workstation_(64)',decode('[encoded data, 14274 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (181,1,'Workstation_(96)',decode('[encoded data, 26582 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (182,1,'Zabbix_server_2D_(128)',decode('[encoded data, 5922 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (183,1,'Zabbix_server_2D_(64)',decode('89504E470D0A1A0A0000000D4948445200000040000000090806000000823E2A7A0000000473424954080808087C0864880000000970485973000006EC000006EC011E7538350000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000004714944415448C7A5564B6F1B5514FE663CF1D84EE247C68FD8CE3BCEAB20FE410A124282055291C20A894DC5AEEAAE2B965D7449575D54A4ADCA6351D125484845025510014D1044564A42541287384E1CC7EFF17B38E78EC70F5A36E971AE73E7CCBDE79EF39DEF9C6B09C07B345E77B95CEE37E617573EA8E8F83F492C2D299B6EEF40AF4E923BB3EEB724F5EDB31E9B8D2660883F538C56DF3AC37AD3B7C69C05029A512C940FF192F2E497356D6B6BEBB1C7E3A90E0D0D7DC7AEEDC562B18952A98493E363DC256FDFBE7103D240374ED9E1406D6F0F77BEFE063F8E8FC166B35150DD20555545B55A255F0D31F8BDA22862DE6AB5C4FB114D433C1E87CFEBED736880CEE175CD66B30D9684C1C141618FE76C27180CE2D95E82C621012E9D3BF8622E8BBFB6E3989E9EC6C4C40432994C42611F161616B0B9B90987D38933723875ED5A377B144CF8F66D64EFDD833D348A542A8599991930609644A3511C1C1C748270921D62140861A4D3698C8D8D091DEF8D4622C8E5729DBD6EB71BB55A0DBAAE7700989F9F17F62A950A666767855DC63B3C1EC5883F20D6584C93DAC34E408E8E8650AFD7707C9CEEBCB3C9325E7B7509D95C019FDF596D93CA10A0921F4D06E02165E90A1DA86B9AE66CD0A1BD12BC7E1D67B76EA1914CC21E8EE2F4F41473737322CB9670B6386B16288D464304CC6B39B83D620F239ECFE745F09C756686B596C12A97CB1D7BACE3E039F0DDDD5D905F6851B984463404FD3EB3D0A43600FCA1B942FEB814190D898018F1B4EBCE7C572D1561D4ABE4B3C91E4AC41981E323FF1E32004F68B448F10F391D6BB4B3C8E2BB7C19FAC606F4F575F1AC90B560388283E451A7B0F93B5B283E47B77436DB65117D8E4F331827100A65CAB4D4ED33D96211FF25F5AF7466EFDED4491A5E2A9D677F1F8A715ED1F59A59D2B29CA77F5E2AAFA74A9B1232D5698CB3D6AA998B5C172FC21608E06C75B5CF88D3A142F3F9886AF58E8E1A8AC8A0A56376844221A1B37A003FFFB4B6865030D0A13BCBF0F0B06050AD7D2ED336426552246098AA76BB1DE17018F1A77F221AF25249CC8875C9A323BC72E1021E3CF84AB0E545222B764C8E87F1F11FDFE2FD8F3E85FEE527424F36270904B357D1F35BAC640A0B00C8393B3509CFCA0A9257AF3E673443B40E53300E6A8CBD41B0A3BD8E70FDF333D39E7B06CF935446DC03787DEFDEDEF2B1002D140A62CFD4D49428096689934A85078BC3E1824AC98851397ABC1E51026962D9E4C438BEFFE131016FA04EB7CE00F9F528320DF7D1235474B3F7706365A0E9EC7718802156705D0B3610F2EE4B9704C5476FDEEC8FFEB32F84335C9B9C5DA37D4559DD9A9DB684B3C8996660B6B7B7E1F7FB45A6AD7D560FE03983D9BB97ED339BD8EECECE0E5D8101A1CFE70BD4B9B3D40F0C5A5FC429CD25C94667A890E93E661F540725914C73F0B26CA39E43E7693264E7EFA437415E5C5C34D7AA6A83817D777979F93E39270DAAEAD09B25BD1C6CB61A2FA2D4C9C29CFA9B24A9E4FCB9EEA2268167539473D56FC0EF6F55F47AE2657E03A45247EAC6FACF7E02344137536B7F7FFFC37F01620C060E2E1A38D80000000049454E44AE426082','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (184,1,'Zabbix_server_2D_(96)',decode('89504E470D0A1A0A0000000D49484452000000600000000D080600000056F26BBC0000000473424954080808087C086488000000097048597300000A6100000A6101FCCC4A250000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A0000076D4944415458C3D558594C5C5518FEEE3030C02C6C1D9642A12DD0AA5DA818DA9AB656EAD2D43ED9C468627C3146637CB0F5C1178D894B7CF2C987AAF1C5E88389515FAA36EE0BB515DB22A552EAD0420728200303CC0CCCC2CC5CFFEF30779CE56231B10F9E7098CB9DB3FCE7FBBE7F3968003648BF47BA261DFBF6DD75B4C566ABBFC362D1B1CAE66FDBEE08689A86FF592B2828D092BA1E8A86A38B37739F6432815FBBBB9D7EFFCCF4D0D0D057A5A5A590AE0B6427085AB7F49D56AB9506211A8DA2489EDFD375DCEE70C05251F18F8B276666F0EE3DF7A127300F5B51D10D4CD1337EAFAEF9FE9C82BBA626FDB796F7B072BBD190A5441275B50D181D9BBCA9444F5CF762F08FDFD5F3DAB56B61B3D9505C5C0C5DD7FBADF2AE915F1C39720457AE5C414F4F0FAC02A42799C4BE830751FEF8E3A68B1636354193858677ED4242C60666FD58B3660D9C4E2782C160DEF8FAFA7A8C8F8F73D3ACF70E21B9ACAC0C939393282F2FC7E2E2222806BE6B6868C089CF3E43A9AD087373736A6D0A24CB8EC242548848A6A6A6F2F62C93F578D8191149494909E8A449B1B5AEAE0ED5D5D5F8F9975F3036368A29DFF4BF43344305DA8D9897E38642812C1CB66FDF8EEE6EEA1E2E1210E641979696D2838A8480683C8EF98F3E523DB75985C5A69327312AA4C57D3E148AE74C4F4FAB835555552910CD08201099FBB01198F5EBD72BF2B76EDD8ADEDE5EECDDBB5791B84C9606AFD7AB94E372B9E0F7FB73C3889ACFB5731B092591B48D6E4F623996642E83A3C362B160EBED7728D0146E9A01AA86E5A09AFDD92076582C9A5A6B52BC33228230A2AFF179CBA61654C8BE14C7773FFE84EF4E7E9EB689FB85422165979C314C02BCD29B4419168FC7A30E44D5C475F3406111C5367EFA29268F1E457460605985620CBD6061614181C4C3E6362AB7B2B2D2D43BD2E12C91509F048C20353636CA410B303931A58825A09148245F7072701E28975CAA3D776D7A0A01E05ABA80EA7094A2BD6D5B168066C01B9FF5223212A00990B5D56EC464CFF4BC148B76397F6D4DB53AEBAD9B5AF1ED177FDB41A16DDCB811F1783C1C08047EB38ACA3A455D2101BE540CF3882237D30396C403F20E2AE4347CF821FCC78F63E1FBEFFF0E030292DD6E17771EC3EEDDBB9507E5457F2194C4E6861012CE46EF191919C90A27B3B3B32AAF10581E86EBFED3DAB97500FFA65219E6B86F41CA53D9E6E7E7557CB0CABBFE0BBD39F3CC72C832B87D596FB4FCC893FAE574395524084BD733842018F78A1D6DB1586C617878F811ABA10EBA060522075104C473D4C456FBE69B889C3F8FB9F7DFCF0E4916F19A52BB5AE3E4D7DF64A5592DE5D2970707536FB5B4FB1BADAFFF529602D3EDEA1022E145D44A888C49C2FCA1EB543E4A5C5B549593E76F18973DB2B6B3CC851ABBEBA627E1CC6022181513273D950C1501E20EAA2493BECF5059228780AAE79E834592E0C433CF986EE254B1BC09E170D8207375F96C85EA95E18A5ED575EA14DA2469F924D750CDFFA6DA351B4BDB988F9689EFC7C4F81896228B2A6CF8C43BDC6EB70A511C5722958A6F6675093A290271555463DD5A375CC1591C1CEEC5CB079EC64C5D3312177E4DDB2367BA85E730C2A3E1013A37A41B1B3D9300D7830FC279F830BC870EAD68C0D0F09084915A75808B172FE67DBF73E74E480D9C0E0169E284D43D7BF6E0F4E9D3E8E8E8C0B973E7D0DADAAAF2890A57229401C9352484A1C86CFE8E1D3BD0D5D595B7E7B66DDB5448BB74E992AAD08C904732B9079F23E1281E7EF8211CE8BC1BC7DF7A074F3DF984AC754A12A815EDEDED78E5D5D7D5F8EC68A3E53DC562513135898AF232D86341DC191C47D45D0F7F4B1B6CA9FC438C8D729F4D7265A35558794B1EECFC82C0A73D20156B4B0438F78B2FE2DABDF7428FC55624807318F35851B1D23053DEBA75EB543C365329E7B26A20F0048B80D39BB82E730193EC860D1B4CE7D353CCF6E45C2A8D1ECECE33D206A3106010E0FCC1C12B424418DE91517CF9D5D7181D1D93B185B2EF9C901EC7E1070E614C4A68AE5729849E3FFF1B76EDEAC0B56B5E0C5CF6A868A85912E99C302FE3DE68EE4085E773144F7C83E194DA8901C1679762C5DDD2D2F20A3D202E1EA0D138AA975F2AC3494673331A4F9C802E4A5C9F917433DBECDB6F03C10521AF187D7D7D4A5966958A51DF9B7D4765B32E672949E0AF5FBFAEC6116CDAC2E4CECA8AD5C34AF309742C472024936BD04B8C3C472F64F8E545482503F961854502073C834A40D1680C0532B649EE3A956B06D0DCD2ACAA1E566424D0EB1DC126A96E486AFFC01F6A0D15528409DFB41FB76112F7D78FE0DBF605F8368790FC60D903787EAEC94FDA223D44CA5E10D05F3B76EC185886B212A1411B03013C7BF6ECAAE2DF278F3E868FFB2FAA1BB41143732F5C3C303735BB2350DD042B9E5379D1D05929470B340B1C5255104C8E33ABF7A96AA3D4CCF400DE33962B9EEC46AF09C89CDA1ADE84C7FF93646B2B2E35CD3B3D67BB100A065489BE7FFF7E6CD9B20567CE9CE1C5F4258E6E95FE6E6767E716B98D2E8AD2AACA1D0E5B8BCD16692EB14756B3F1C2E6D6F26022F9BFFB5F1009D6F9BFA048347433F7E9EBBB60BF7AF56A89DC1FE6C55B7F174F7609D697E5AEF3FC5FD16E43B3BBFA54DB0000000049454E44AE426082','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (185,1,'Zabbix_server_3D_(128)',decode('[encoded data, 6646 characters]','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (186,1,'Zabbix_server_3D_(64)',decode('89504E470D0A1A0A0000000D49484452000000400000000D080600000019AF686C0000000473424954080808087C0864880000000970485973000006EC000006EC011E7538350000001974455874536F667477617265007777772E696E6B73636170652E6F72679BEE3C1A000005034944415448C7BD564B6F135714FEE6618F1D13BF13A7499C383606F1508822405D145880845A8490BA824D77DDB22842EAA61BC40F615BB56CCAA2295D54828656904A84145854A8A94AEC90A71DC793C48F997EE7C6766340D024851B1DCDCCF5BDE79EF39DEF3B379AEBBAD8E9D0346D848F4F68E7681FD274BC9F91A7FD401BA3FDC81C96769CC37600E8E9E909D46AB533DC738EC94BE27DDB396C3760BFC19743BBCFEF31C330C61617171FF0DDF9DF00D8CB619AE639499A9F2769D62E827DA7A371CE128B73DB719C31AFD77BFBC99327F96D0170F8F0616F6767E7493A5155E6EFFBDE61B0EFC3D7A4B043D7F5B16AB53A3E3131516D038016A20DA6D3E9EE8F8E1DBF11D4F46EBAF4B49C6F59ACEFD903B7C3BFCB6077A855FE954AA5ED9CF41A1FA82E2D1716EF8DDFFDC2B6ED6228147A2C008CF9FDFEB3A4398C4A15DF562BD87BFA3460186D9B1DDBC6CD62093F25FBB1B1B1211DF0ED87371E96CF82C7E345B15884691AADD0B4B7242CC3C3B87C7EBF9A995F2CED0AFCF2EA2A7E9FBC8F60B013B1580C64C52FD2B5474F9C3881783C8E759EF9D4B2E03041777DBD65A18B17618442CAC96C6E06B148183E8FD9B203FBB2E8B0BCADEFAE681499540A07F6EFC307896E0CF6F763F8D0412CCDCF211E89C02749D12C5AB2B757CD598DEF0E9E7F6C741489AE38BA6251A48752C866D270DC3A4AE515549D1AAA7CAFA28E1AADAE39A8EB2E5C5343381E41281A56EF62307518968943C307914A0FA2509847A5B28128E31B1E1E8665592993394DD03ECEE7F3E8E8E840B552817DE74E0BB5CEF3E7618F8FA374EB167CA34761DBAB10B6ECA11CB66A509CAE132C19F23BFB8720ACAC394AAC80B0873DA6A55B59170C06DB74CC0646021A6D6B88004E9D3A89E4C0C0E677635E19FF8459D16804F57A9D891637D7689B3C8AC76358636C93BF3D50FB72B95C7D6464C42897CBF70480AF19E4596EFC8300ECAF6E09C47FFC387C478E60FEFA75F56DD0616730848542011B8D6445D44BA4B6C3837945B60213DAAE95ED7F7DF13B1289619573C595924A4ECC309755B21591551328AE11BACA783E938397ACF0B338530F1F91C2532FC9477BB396B6AC2DAF969BF1FDC5C71081FECE6C20AE3388FDC2807A23096F26A3A83F7BE54A9B339FE899097AFC9BCD506385BD1E8F4ADE61427AA33A9270C0E75349F23A42381C61135BE15A5384DDDAEBE15EA99ACC37F74A1C3EEF661F96DE11A14472B32FE0B73CE8EDED51F3CB85650C0E2471E7EEBD16F02F0FD3B4D0DF97C0674F7FC6979F7E05FB79AEC9D0B4802E26911C958A05020115B4E8DF603F885FBD8AFCE5CBAFB46DE9C4FD7D7D207D5A731220BB6A6B4E1C2793492C2C2C609595CC66B38AFA85E5650C707EEBDE307B4B85B26B7678914C8AFD637A7A5A2596A1FE05A0D9B97974F5C431941A62137510980BB03F6430FDE7DF64879F67EA58A2FFBEDE3E4C3E9A52C0D76AAE2AD84C20086F79066EB55DA204FAB400909480F9FF8E3ADC595B43E4D225B80CAAFBDAB57648BFB9C9442A4AEBE2A4A951DEAF0ABC660F68CA40129075CF9E3D535D778DBE2579A9BAE8BCB9D747A60880CD21FB9A3D448090BD72A5D8B2DF2E93A5753E6DA5EB3075DFDDD5453669649A8F79643039F5987E2BF46160A564C31D20BB22DFC3758ACABF14446260CC21E1DC05DE02371888C6CE1C3CB3B6E124EA75F73512C25C36AB3DD475CD85FB5F2EEE57464501E7D9D1152620D46A4EFDAD82DF6CCADACB31C8EBDC8B593CB8FFAB9E4824F264E83A0BF3F93FCFA63E489E26E2D60000000049454E44AE426082','hex'));
INSERT INTO images (imageid,imagetype,name,image) VALUES (187,1,'Zabbix_server_3D_(96)',decode('[encoded data, 4622 characters]','hex'));
INSERT INTO users (userid,alias,name,surname,passwd,url,autologin,autologout,lang,refresh,type,theme,rows_per_page) values ('1','Admin','Zabbix','Administrator','$2y$10$92nDno4n0Zm7Ej7Jfsz8WukBfgSS/U0QkIuu8WkJPihXBb2A1UrEK','','1','0','en_GB','30s','3','default','50');
INSERT INTO users (userid,alias,name,surname,passwd,url,autologin,autologout,lang,refresh,type,theme,rows_per_page) values ('2','guest','','','$2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06','','0','15m','en_GB','30s','1','default','50');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('1','Templates','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('2','Linux servers','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('4','Zabbix servers','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('5','Discovered hosts','1','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('6','Virtual machines','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('7','Hypervisors','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('8','Templates/Modules','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('9','Templates/Network devices','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('10','Templates/Operating systems','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('11','Templates/Server hardware','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('12','Templates/Applications','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('13','Templates/Databases','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('14','Templates/Virtualization','0','0');
INSERT INTO hstgrp (groupid,name,internal,flags) values ('15','Templates/Telephony','0','0');
INSERT INTO drules (druleid,proxy_hostid,name,iprange,delay,status) values ('2',NULL,'Local network','192.168.0.1-254','1h','1');
INSERT INTO dchecks (dcheckid,druleid,type,key_,snmp_community,ports,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,uniq,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,host_source,name_source) values ('2','2','9','system.uname','','10050','','0','','','0','0','0','','1','0');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('1','0','Email','mail.example.com','example.com','zabbix@example.com','','','','','0','25','0','0','0','0','','1','3','10s','0','','30s','0','0','','','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('3','2','SMS','','','','','/dev/ttyS0','','','0','25','0','0','0','0','','1','3','10s','1','','30s','0','0','','','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('4','0','Email (HTML)','mail.example.com','example.com','zabbix@example.com','','','','','0','25','0','0','0','0','','1','3','10s','1','','30s','0','0','','','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('5','4','Mattermost','','','','','','','','0','25','0','0','0','0','','1','1','10s','1',E'var SEVERITY_COLORS = [
    ''#97AAB3'', ''#7499FF'', ''#FFC859'',
    ''#FFA059'', ''#E97659'', ''#E45959''
];

var RESOLVE_COLOR = ''#009900'';

var SEND_MODE_HANDLERS = {
    alarm: handlerAlarm,
    event: handlerEvent
};

if (!String.prototype.format) {
    String.prototype.format = function() {
        var args = arguments;

        return this.replace(/{(\\d+)}/g, function(match, number) {
            return number in args
                ? args[number]
                : match
            ;
        });
    };
}

function isEventProblem(params) {
    return params.event_value == 1
        && params.event_update_status == 0
    ;
}

function isEventUpdate(params) {
    return params.event_value == 1
        && params.event_update_status == 1
    ;
}

function isEventResolve(params) {
    return params.event_value == 0;
}

function getPermalink(mattermost_url, team_name, postid) {
    return ''{0}/{1}/pl/{2}''.format(
        mattermost_url.replace(/\\/+$/, ''''),
        team_name,
        postid
    );
}

function getChannel(send_to) {
    switch (true) {
        case /.+\\/#.+/.test(send_to):
            return getChannelByName(send_to);

        case /@.+/.test(send_to):
            return getDirectChannel(send_to);

        default:
            return getChannelByID(send_to);
    }
}

function getChannelByName(send_to) {
    var team_chan = send_to
        .trim()
        .split(''/#'');

    var resp = JSON.parse(req.Get(
        Mattermost.channel_byname.format(team_chan[0], team_chan[1]),
        JSON.stringify(fields)
    )
    );

    if (req.Status() != 200) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    return resp;
}

function getDirectChannel(send_to) {
    Zabbix.Log(5, ''[ Mattermost Webhook ] Call {0}({1})''.format(
        arguments.callee.name,
        JSON.stringify(arguments)
    ));

    var teamUser = send_to
            .trim()
            .split(''/@''),
        bot = getBotUser(),
        user = getUserByName(teamUser[1]);

    var resp = JSON.parse(req.Post(
        Mattermost.direct_channel,
        JSON.stringify([bot.id, user.id])
    )
    );

    Zabbix.Log(5, ''[ Mattermost Webhook ] Result {0}: {1}''.format(
        arguments.callee.name,
        JSON.stringify(resp)
    ));

    if (req.Status() != 201) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    resp.team_name = teamUser[0];

    return resp;
}

function getChannelByID(channelID) {
    Zabbix.Log(5, ''[ Mattermost Webhook ] Call {0}({1})''.format(
        arguments.callee.name,
        JSON.stringify(arguments)
    ));

    var resp = JSON.parse(req.Get(
        Mattermost.get_channel.format(channelID),
        JSON.stringify(fields)
    )
    );

    Zabbix.Log(5, ''[ Mattermost Webhook ] Result {0}: {1}''.format(
        arguments.callee.name,
        JSON.stringify(resp)
    ));

    if (req.Status() != 200) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    return resp;
}

function getBotUser() {
    Zabbix.Log(5, ''[ Mattermost Webhook ] Call {0}({1})''.format(
        arguments.callee.name,
        JSON.stringify(arguments)
    ));

    var resp = JSON.parse(req.Get(
        Mattermost.bot_user,
        JSON.stringify(fields)
    )
    );

    Zabbix.Log(5, ''[ Mattermost Webhook ] Result {0}: {1}''.format(
        arguments.callee.name,
        JSON.stringify(resp)
    ));

    if (req.Status() != 200) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    return resp;
}

function getUserByName(userName) {
    Zabbix.Log(5, ''[ Mattermost Webhook ] Call {0}({1})''.format(
        arguments.callee.name,
        JSON.stringify(arguments)
    ));

    var resp = JSON.parse(req.Get(
        Mattermost.user_byname.format(userName),
        JSON.stringify(fields)
    )
    );

    Zabbix.Log(5, ''[ Mattermost Webhook ] Result {0}: {1}''.format(
        arguments.callee.name,
        JSON.stringify(resp)
    ));

    if (req.Status() != 200) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    return resp;
}

function getTeamByID(teamID) {
    Zabbix.Log(5, ''[ Mattermost Webhook ] Call {0}({1})''.format(
        arguments.callee.name,
        JSON.stringify(arguments)
    ));

    var resp = JSON.parse(req.Get(
        Mattermost.get_team.format(teamID),
        JSON.stringify(fields)
    )
    );

    Zabbix.Log(5, ''[ Mattermost Webhook ] Result {0}: {1}''.format(
        arguments.callee.name,
        JSON.stringify(resp)
    ));

    if (req.Status() != 200) {
        throw ''[{0}] {1}''.format(resp.status_code, resp.message);
    }

    return resp;
}

function createProblemURL(zabbix_url, triggerid, eventid, event_source) {
    var problem_url = '''';
    if (event_source === ''0'') {
        problem_url = ''{0}/tr_events.php?triggerid={1}&eventid={2}''
            .format(
                zabbix_url,
                triggerid,
                eventid
            );
    }
    else {
        problem_url = zabbix_url;
    }

    return problem_url;
}

function getTagValue(event_tags, key) {
    var pattern = new RegExp(''('' + key + '':.+)'');
    var tagValue = event_tags
        .split('','')
        .filter(function (v) {
            return v.match(pattern);
        })
        .map(function (v) {
            return v.split('':'')[1];
        })[0]
        || 0;

    return tagValue;
}

function handlerAlarm(req, params) {
    var channel = getChannel(params.send_to);
    var fields = {
        channel_id: channel.id,
        props: {}
    };

    if (isEventProblem(params)) {
        var team_name = channel.team_name
            ? channel.team_name
            : getTeamByID(channel.team_id).name;

        fields.props.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        var resp = JSON.parse(req.Post(
            Mattermost.post_message,
            JSON.stringify(fields)
        )
        );

        if (req.Status() != 201) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }

        result.tags.__mattermost_post_id = resp.id;
        result.tags.__mattermost_channel_id = channel.id;
        result.tags.__mattermost_channel_name = channel.name;
        result.tags.__mattermost_message_link = getPermalink(
            params.mattermost_url,
            team_name,
            resp.id
        );

    }
    else if (isEventUpdate(params)) {
        fields.root_id = getTagValue(params.event_tags, ''mattermost_post_id'');

        if (params.event_source === ''0'') {}
        fields.props.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_update_date,
                params.event_update_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source),
                true
            )
        ];

        resp = JSON.parse(req.Post(
            Mattermost.post_message, JSON.stringify(fields)
        )
        );

        if (req.Status() != 201) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }

    }
    else if (isEventResolve(params)) {
        fields.channel_id = getTagValue(params.event_tags, ''mattermost_channel_id'');
        fields.id = getTagValue(params.event_tags, ''mattermost_post_id'');
        fields.props.attachments = [
            createMessage(
                RESOLVE_COLOR,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        var post_id = getTagValue(params.event_tags, ''mattermost_post_id'');

        resp = JSON.parse(req.Put(
            Mattermost.chat_update.format(post_id),
            JSON.stringify(fields)
        )
        );

        if (req.Status() != 200) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }
    }
}

function handlerEvent(req, params) {
    var channel = getChannel(params.send_to);
    var fields = {
        channel_id: channel.id,
        props: {}
    };

    if (isEventProblem(params)) {
        var team_name = channel.team_name
            ? channel.team_name
            : getTeamByID(channel.team_id).name;

        fields.props.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        var resp = JSON.parse(req.Post(Mattermost.post_message, JSON.stringify(fields)));

        if (req.Status() != 201) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }

        result.tags.__mattermost_channel_name = channel.name;
        result.tags.__mattermost_message_link = getPermalink(
            params.mattermost_url,
            team_name,
            resp.id
        );

    }
    else if (isEventUpdate(params)) {
        fields.props.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_update_date,
                params.event_update_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source),
                false
            )
        ];

        resp = JSON.parse(req.Post(Mattermost.post_message, JSON.stringify(fields)));

        if (req.Status() != 201) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }

    }
    else if (isEventResolve(params)) {
        fields.props.attachments = [
            createMessage(
                RESOLVE_COLOR,
                params.event_recovery_date,
                params.event_recovery_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        resp = JSON.parse(req.Post(Mattermost.post_message, JSON.stringify(fields)));

        if (req.Status() != 201) {
            throw ''[{0}] {1}''.format(resp.status_code, resp.message);
        }
    }
}

function createMessage(
    event_severity_color,
    event_date,
    event_time,
    problem_url,
    isShort
) {
    var message = {
        fallbac: params.alert_subject,
        title: params.alert_subject,
        color: event_severity_color,
        title_link: problem_url,
        footer: problem_url,

        fields: [
            {
                title: ''Host'',
                value: ''{0} [{1}]''.format(params.host_name, params.host_ip),
                short: true
            },
            {
                title: ''Event time'',
                value: ''{0} {1}''.format(event_date, event_time),
                short: true
            }
        ],
    };

    
    if (params.event_source === ''0'') {
        message.fields.push(
            {
                title: ''Severity'',
                value: params.event_severity,
                short: true
            },
            {
                title: ''Opdata'',
                value: params.event_opdata,
                short: true
            }
        );
    }

    if (!isShort && params.event_source === ''0'') {
        message.fields.push(
            {
                title: ''Event tags'',
                value: ''`{0}`''.format(params.event_tags.replace(/__.+?:(.+?,|.+)/g, '''') || ''None''),
                short: true
            },
            {
                title: ''Trigger description'',
                value: params.trigger_description,
                short: true
            }
        );
    }

    if (params.event_source !== ''0'' || params.event_update_status === ''1'') {
        message.fields.push(
            {
                title: ''Details'',
                value: params.alert_message,
                short: false
            }
        );
    }

    return message;
}

function validateParams(params) {
    if (typeof params.bot_token !== ''string'' || params.bot_token.trim() === '''') {
        throw ''Field "bot_token" cannot be empty'';
    }

    if (isNaN(params.event_id)) {
        throw ''Field "event_id" is not a number'';
    }

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    if (params.event_source !== ''0'') {
        params.event_nseverity = ''0'';
        params.event_severity = ''Not classified'';
        params.event_update_status = ''0'';
        params.send_mode = ''event'';
    }

    if (params.event_source === ''1'' || params.event_source === ''2'') {
        params.event_value = ''1'';
    }

    if (params.event_source === ''1'') {
        params.host_name = params.discovery_host_dns;
        params.host_ip = params.discovery_host_ip;
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        throw ''Incorrect "event_nseverity" parameter given: '' + params.event_nseverity + ''\\nMust be 0-5.'';
    }

    if (typeof params.event_severity !== ''string'' || params.event_severity.trim() === '''') {
        throw ''Field "event_severity" cannot be empty'';
    }

    if (params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_value !== ''0'' && params.event_value !== ''1'') {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    if (typeof params.host_ip !== ''string'' || params.host_ip.trim() === '''') {
        throw ''Field "host_ip" cannot be empty'';
    }

    if (typeof params.host_name !== ''string'' || params.host_name.trim() === '''') {
        throw ''Field "host_name" cannot be empty'';
    }

    if (typeof params.mattermost_url !== ''string'' || params.mattermost_url.trim() === '''') {
        throw ''Field "mattermost_url" cannot be empty'';
    }

    if (!/^(http|https):\\/\\/.+/.test(params.mattermost_url)) {
        throw ''Field "mattermost_url" must contain a schema'';
    }

    if ([''alarm'', ''event''].indexOf(params.send_mode) === -1) {
        throw ''Incorrect "send_mode" parameter given: '' + params.send_mode + ''\\nMust be "alarm" or "event".'';
    }

    if (typeof params.send_to !== ''string'' || params.send_to.trim() === '''') {
        throw ''Field "send_to" cannot be empty'';
    }

    if (isNaN(params.trigger_id) && params.event_source === ''0'') {
        throw ''field "trigger_id" is not a number'';
    }

    if (typeof params.zabbix_url !== ''string'' || params.zabbix_url.trim() === '''') {
        throw ''Field "zabbix_url" cannot be empty'';
    }

    if (!/^(http|https):\\/\\/.+/.test(params.zabbix_url)) {
        throw ''Field "zabbix_url" must contain a schema'';
    }

}

try {
    var params = JSON.parse(value);

    validateParams(params);

    var req = new CurlHttpRequest(),
        fields = {},
        result = {tags: {}};

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        req.SetProxy(params.HTTPProxy);
    }

    req.AddHeader(''Content-Type: application/json; charset=utf-8'');
    req.AddHeader(''Authorization: Bearer '' + params.bot_token);

    params.mattermost_url = params.mattermost_url.replace(/\\/+$/, '''');
    params.zabbix_url = params.zabbix_url.replace(/\\/+$/, '''');

    var APIEndpoint = params.mattermost_url + ''/api/v4/'';

    var Mattermost = {
        post_message: APIEndpoint + ''posts'',
        get_channel: APIEndpoint + ''channels/{0}'',
        get_team: APIEndpoint + ''teams/{0}'',
        chat_update: APIEndpoint + ''posts/{0}'',
        direct_channel: APIEndpoint + ''channels/direct'',
        channel_byname: APIEndpoint + ''teams/name/{0}/channels/name/{1}'',
        user_byname: APIEndpoint + ''users/username/{0}'',
        bot_user: APIEndpoint + ''users/me''

    };

    params.send_mode = params.send_mode.toLowerCase();
    params.send_mode = params.send_mode in SEND_MODE_HANDLERS
        ? params.send_mode
        : ''alarm'';

    SEND_MODE_HANDLERS[params.send_mode](req, params);

    if (params.event_source === ''0'') {
        return JSON.stringify(result);
    }
    else {
        return ''OK'';
    }
}
catch (error) {
    Zabbix.Log(4, ''[ Mattermost Webhook ] Mattermost notification failed: '' + error);
    throw ''Mattermost notification failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__mattermost_message_link}','Open in Mattermost: {EVENT.TAGS.__mattermost_channel_name}','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('6','4','Opsgenie','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Media = {
    params: {},
    name: '''',
    labels: [],
    HTTPProxy: '''',

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        Media.params = params;
        Media.params.api += Media.params.api.endsWith(''/'') ? '''' : ''/'';
        Media.params.web += Media.params.web.endsWith(''/'') ? '''' : ''/'';
    },

    setProxy: function (HTTPProxy) {
        if (typeof HTTPProxy !== ''undefined'' && HTTPProxy.trim() !== '''') {
            Media.HTTPProxy = HTTPProxy;
        }
    },

    setTags: function(event_tags_json) {
        if (typeof event_tags_json !== ''undefined'' && event_tags_json !== ''''
                && event_tags_json !== ''{EVENT.TAGSJSON}'') {

            try {
                var tags = JSON.parse(event_tags_json),
                    label;

                tags.forEach(function (tag) {
                    if (typeof tag.tag === ''string'') {
                        label = (tag.tag + (typeof tag.value !== ''undefined''
                                && tag.value !== '''' ? ('':'' + tag.value) : '''')).replace(/\\s/g, ''_'');
                        Media.labels.push(label);
                    }
                });
            }
            catch (error) {
                Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Failed to parse "event_tags_json" param'');
            }
        }
    },

    request: function (method, query, data, allow_404) {
        if (typeof(allow_404) === ''undefined'') {
            allow_404 = false;
        }

        [''api'', ''token''].forEach(function (field) {
            if (typeof Media.params !== ''object'' || typeof Media.params[field] === ''undefined''
                    || Media.params[field] === '''') {
                throw ''Required '' + Media.name + '' param is not set: "'' + field + ''".'';
            }
        });

        var response,
            url = Media.params.api + query,
            request = new CurlHttpRequest();

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''Authorization: '' + Media.params.token);
        request.SetProxy(Media.HTTPProxy);

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Sending request: '' +
            url + ((typeof data === ''string'') ? (''\\n'' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Received response with status code '' +
            request.Status() + ''\\n'' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Failed to parse response.'');
                response = null;
            }
        }

        if ((request.Status() < 200 || request.Status() >= 300)
                && (!allow_404 || request.Status() !== 404)) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null) {
                if (typeof response.errors === ''object'' && Object.keys(response.errors).length > 0) {
                    message += '': '' + JSON.stringify(response.errors);
                }
                else if (typeof response.errorMessages === ''object'' && Object.keys(response.errorMessages).length > 0) {
                    message += '': '' + JSON.stringify(response.errorMessages);
                }
                else if (typeof response.message === ''string'') {
                    message += '': '' + response.message;
                }
            }

            throw message + '' Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    getAlertId: function (requestId) {
        do {
            resp = Media.request(''get'', ''requests/'' + requestId, undefined, true);
        }
        while (typeof resp.response !== ''object'' || typeof resp.response.data === ''undefined''
                || resp.response.data.success === false);

        if (typeof resp.response !== ''object'' || typeof resp.response.data === ''undefined'') {
            throw ''Cannot get '' + Media.name + '' issue ID. Check debug log for more information.'';
        }

        return resp;
    }
};

try {
    var result = {tags: {}},
        params = JSON.parse(value),
        media = {},
        fields = {},
        resp = {},
        responders = [],
        tags = [],
        required_params = [
            ''alert_subject'',
            ''alert_message'',
            ''event_id'',
            ''event_source'',
            ''event_value'',
            ''event_update_status'',
            ''opsgenie_api'',
            ''opsgenie_web'',
            ''opsgenie_token''
        ],
        severities = [
            ''not_classified'',
            ''information'',
            ''warning'',
            ''average'',
            ''high'',
            ''disaster'',
            ''resolved'',
            ''default''
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter "'' + key + ''" cannot be empty.'';
            }
            if (key.startsWith(''opsgenie_'')) {
                media[key.substring(9)] = params[key];
            }
        });

    // Possible values of event_source:
    // 0 - Trigger, 1 - Discovery, 2 - Autoregistration, 3 - Internal.
    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    // Check event_value for trigger-based and internal events.
    // Possible values: 1 for problem, 0 for recovering
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check event_update_status only for trigger-based events.
    // Possible values: 0 - Webhook was called because of problem/recovery event, 1 - Update operation.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    // Check event_id for a numeric value.
    if (isNaN(parseInt(params.event_id)) || params.event_id < 1) {
        throw ''Incorrect "event_id" parameter given: '' + params.event_id + ''\\nMust be a positive number.'';
    }

    if ((params.event_source === ''1'' || params.event_source === ''2'')  && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for Trigger and Internal actions.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity]];
    params.zbxurl = params.zbxurl + (params.zbxurl.endsWith(''/'') ? '''' : ''/'');

    Media.name = ''Opsgenie'';
    Media.setParams(media);
    Media.params.token = ''GenieKey '' + Media.params.token;
    Media.setProxy(params.HTTPProxy);
    Media.setTags(params.event_tags_json); // Set Media.labels

    // Create an issue.
    // Numeric value of the event that triggered an action (1 for problem, 0 for recovering).
    // Numeric value of of the problem update status. Possible values:
    // 0 - Webhook was called because of problem/recovery event, 1 - Update operation.
    if ((params.event_source == 0 && params.event_value == 1 && params.event_update_status == 0)
            || (params.event_source == 3 && params.event_value == 1)
            || params.event_source == 1 || params.event_source == 2) {
        fields.message = params.alert_subject;
        fields.alias = params.event_id;
        fields.description = params.alert_message;
        fields.priority = priority;
        fields.source = ''Zabbix'';

        if (params.event_source === ''0'') {
            fields.details = {
                ''Zabbix server'': params.zbxurl,
                Problem: params.zbxurl + ''tr_events.php?triggerid='' + params.trigger_id + ''&eventid='' + params.event_id
            };
        }
        else {
            fields.details = {''Zabbix server'': params.zbxurl};
        }

        if (typeof params.opsgenie_teams === ''string'') {
            responders = params.opsgenie_teams.split('','');
            fields.responders = responders.map(function(team) {
                return {type: ''team'', name: team.trim()};
            });
        }

        fields.tags = Media.labels;
        if (typeof params.opsgenie_tags === ''string'') {
            tags = params.opsgenie_tags.split('','');
            tags.forEach(function(item) {
                fields.tags.push(item.trim());
            });
        }

        resp = Media.request(''post'', '''', fields);
        if (typeof resp.response !== ''object'' || typeof resp.response.result === ''undefined'') {
            throw ''Cannot create '' + Media.name + '' issue. Check debug log for more information.'';
        }

        if (resp.status === 202) {
            resp = Media.getAlertId(resp.response.requestId);
            if (params.event_source == 0 && params.event_value == 1 && params.event_update_status == 0) {
                result.tags.__zbx_ops_issuekey = resp.response.data.alertId;
                result.tags.__zbx_ops_issuelink = Media.params.web + ''alert/detail/'' + resp.response.data.alertId;
            }
        }
        else {
            throw Media.name + '' response code is unexpected. Check debug log for more information.'';
        }
    }
    // Update a created issue.
    else {
        fields.user = (params.event_value != 0) ? params.zbxuser : '''';
        fields.note = params.alert_message;

        resp = Media.request(''post'', params.event_id + ''/notes?identifierType=alias'', fields);
        if (typeof resp.response !== ''object'' || typeof resp.response.result === ''undefined'') {
            throw ''Cannot update '' + Media.name + '' issue. Check debug log for more information.'';
        }

        if (resp.status === 202) {
            resp = Media.getAlertId(resp.response.requestId);
        }
        else {
            throw Media.name + '' response code is unexpected. Check debug log for more information.'';
        }
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[ '' + Media.name + '' Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_ops_issuelink}','Opsgenie: {EVENT.TAGS.__zbx_ops_issuekey}','Please refer to https://docs.opsgenie.com/docs/alert-api and https://www.zabbix.com/documentation/current/manual/config/notifications/media/webhook#example_scripts.
  
Set global macro {$ZABBIX.URL} with your Zabbix server URL.
Add dedicated user with media type "Opsgenie".
Change the values of the variables opsgenie_api (https://api.opsgenie.com/v2/alerts or https://api.eu.opsgenie.com/v2/alerts),
opsgenie_web (for example, https://myzabbix.app.opsgenie.com), opsgenie_token.');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('7','4','PagerDuty','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'try {

    var params = JSON.parse(value),
        req = new CurlHttpRequest(),
        fields = {},
        resp = '''';

    // Correspondence between the PagerDuty and Zabbix severity level
    var severityMapping = [
        ''info'',    // Not classified
        ''info'',    // Information
        ''warning'', // Warning
        ''warning'', // Average
        ''error'',   // High
        ''critical'' // Disaster
    ];

    if (!severityMapping[params.severity]) {
        params.severity = ''0'';
    }

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        req.SetProxy(params.HTTPProxy);
    }

    if (isNaN(parseInt(params.eventid)) || params.eventid < 1) {
        throw ''incorrect value for variable "eventid". The value must be a positive number.'';
    }
    if (params.eventname.length < 1) {
        throw ''incorrect value for variable "eventname". The value must be a non-empty string.'';
    }
    if (isNaN(parseInt(params.severity)) || (params.severity < 0 && params.severity > 5)) {
        throw ''incorrect value for variable "severity". The value must be a number 0..5.'';
    }

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }
    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.eventvalue !== ''0'' && params.eventvalue !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "eventvalue" parameter given: "'' + params.eventvalue + ''".\\nMust be 0 or 1.'';
    }

    if (params.event_source === ''0'') {
        if (params.hostname.length < 1) {
            throw ''incorrect value for variable "hostname". The value must be a non-empty string.'';
        }
        if (isNaN(parseInt(params.triggerid)) || params.triggerid < 1) {
            throw ''incorrect value for variable "triggerid". The value must be a positive number.'';
        }
        if (params.eventack != ''Yes'' && params.eventack != ''No'') {
            throw ''incorrect value for variable "eventack". The value must be Yes or No.'';
        }
        if (isNaN(parseInt(params.eventupdate)) || (params.eventupdate < 0 || params.eventupdate > 1)) {
            throw ''incorrect value for variable "eventupdate". The value must be 0 or 1.'';
        }
    }



    req.AddHeader(''Content-Type: application/json'');

    fields.routing_key = params.token;
    fields.dedup_key = params.eventid;

    if (((params.eventvalue == 1) && (params.eventupdate == 0)) || params.event_source !== ''0'') {
        fields.event_action = ''trigger'';
        fields.payload = {
            summary: params.eventname,
            source: (params.event_source === ''1'') ? ''Discovery'' : params.hostname + '' : '' + params.hostip,
            severity: severityMapping[params.severity],
        };
        
        if (params.event_source === ''0'') {
            fields.payload.custom_details = {
                ''Event date'': params.eventdate,
                ''Event time'': params.eventtime,
                ''Trigger description'': params.triggerdesc,
                ''Trigger opdata'': params.triggeropdata,
                ''Event tags'': params.eventtags,
                ''Event host'': params.hostname,
                ''Event host ip'': params.hostip
            };
            fields.links = [{
                href: params.url + ''/tr_events.php?triggerid='' + params.triggerid + ''&eventid='' + params.eventid,
                text: ''Event link''
            }];
        }
        else {
            fields.payload.custom_details = {
                ''Alert message'': params.alert_message
            };
        }

        fields.client = ''Zabbix'';
        fields.client_url = params.url;
    }
    else if ((params.eventvalue == 1) && (params.eventupdate == 1) && (params.eventack == ''Yes''))
        fields.event_action = ''acknowledge'';
    else if (params.eventvalue == 0)
        fields.event_action = ''resolve'';
    else
        throw ''incorrect values. Update message without ack will not be sent.'';

    Zabbix.Log(4, ''[PagerDuty Webhook] Sending request:'' + JSON.stringify(fields));
    resp = req.Post(''https://events.pagerduty.com/v2/enqueue'',
        JSON.stringify(fields)
    );
    Zabbix.Log(4, ''[PagerDuty Webhook] Receiving response:'' + resp);

    try {
        resp = JSON.parse(resp);
    }
    catch (error) {
        throw ''incorrect response. PagerDuty returned a non-JSON object.'';
    }

    if (req.Status() != 202) {
        if (typeof resp === ''object'' && typeof resp.errors === ''object'' && typeof resp.errors[0] === ''string'') {
            throw resp.errors[0];
        }
        else {
            throw ''Unknown error.'';
        }
    }

    if (resp.status != ''success'') {
        throw ''Unknown error.'';
    }

    return ''OK'';
}
catch (error) {
    Zabbix.Log(3, ''[PagerDuty Webhook] Notification failed : '' + error);
    throw ''PagerDuty notification failed : '' + error;
}','30s','0','0','','','Please refer to https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2 and https://www.zabbix.com/documentation/current/manual/config/notifications/media/webhook#example_scripts.
  
Set global macro {$ZABBIX.URL} with your Zabbix server URL.
Add a dedicated user with the media type "PagerDuty" and place the integration key in the "token" parameter to integrate into the service.');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('8','4','Pushover','','','','','','','','0','25','0','0','0','0','','0','3','10s','1',E'try {
    var params = JSON.parse(value),
        request = new CurlHttpRequest(),
        data,
        response,
        severities = [
            {name: ''not_classified'', color: ''#97AAB3''},
            {name: ''information'', color: ''#7499FF''},
            {name: ''warning'', color: ''#FFC859''},
            {name: ''average'', color: ''#FFA059''},
            {name: ''high'', color: ''#E97659''},
            {name: ''disaster'', color: ''#E45959''},
            {name: ''resolved'', color: ''#009900''},
            {name: ''default'', color: ''#000000''}
        ],
        priority;

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        request.SetProxy(params.HTTPProxy);
    }

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''priority_'' + severities[params.event_nseverity].name] || params.priority_default;

    if (isNaN(priority) || priority < -2 || priority > 2) {
        throw ''"priority" should be -2..2'';
    }

    if (params.event_source === ''0'' && isNaN(params.triggerid)) {
        throw ''field "triggerid" is not a number'';
    }

    if (isNaN(params.eventid)) {
        throw ''field "eventid" is not a number'';
    }

    if (typeof params.message !== ''string'' || params.message.trim() === '''') {
        throw ''field "message" cannot be empty'';
    }

    data = {
        token: params.token,
        user: params.user,
        title: params.title,
        message: params.message,
        url: (params.event_source === ''0'') 
            ? params.url + ''/tr_events.php?triggerid='' + params.triggerid + ''&eventid='' + params.eventid
            : params.url,
        url_title: params.url_title,
        priority: priority
    };

    if (priority == 2) {
        if (isNaN(params.retry) || params.retry < 30) {
            throw ''field "retry" should be a number with value of at least 30 if "priority" is set to 2'';
        }

        if (isNaN(params.expire) || params.expire > 10800) {
            throw ''field "expire" should be a number with value of at most 10800 if "priority" is set to 2'';
        }

        data.retry = params.retry;
        data.expire = params.expire;
    }

    data = JSON.stringify(data);
    Zabbix.Log(4, ''[ Pushover Webhook ] Sending request: '' + params.endpoint + ''\\n'' + data);

    request.AddHeader(''Content-Type: application/json'');
    response = request.Post(params.endpoint, data);

    Zabbix.Log(4, ''[ Pushover Webhook ] Received response with status code '' + request.Status() + ''\\n'' + response);

    if (response !== null) {
        try {
            response = JSON.parse(response);
        }
        catch (error) {
            Zabbix.Log(4, ''[ Pushover Webhook ] Failed to parse response received from Pushover'');
            response = null;
        }
    }

    if (request.Status() != 200 || response === null || typeof response !== ''object'' || response.status !== 1) {
        if (response !== null && typeof response === ''object'' && typeof response.errors === ''object''
                && typeof response.errors[0] === ''string'') {
            throw response.errors[0];
        }
        else {
            throw ''Unknown error. Check debug log for more information.'';
        }
    }

    return ''OK'';
}
catch (error) {
    Zabbix.Log(4, ''[ Pushover Webhook ] Pushover notification failed: '' + error);
    throw ''Pushover notification failed: '' + error;
}','30s','0','0','','','Please refer to setup guide here: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/pushover

Set token parameter with to your Pushover application key.
When assigning Pushover media to the Zabbix user - add user key into send to field.');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('9','4','Slack','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var SEVERITY_COLORS = [
    ''#97AAB3'', ''#7499FF'', ''#FFC859'',
    ''#FFA059'', ''#E97659'', ''#E45959''
];

var RESOLVE_COLOR = ''#009900'';

var SLACK_MODE_HANDLERS = {
    alarm: handlerAlarm,
    event: handlerEvent
};


if (!String.prototype.format) {
    String.prototype.format = function() {
        var args = arguments;

        return this.replace(/{(\\d+)}/g, function(match, number) {
            return number in args
                ? args[number]
                : match
            ;
        });
    };
}

function isEventProblem(params) {
    return params.event_value == 1
        && params.event_update_status == 0
    ;
}

function isEventUpdate(params) {
    return params.event_value == 1
        && params.event_update_status == 1
    ;
}

function isEventResolve(params) {
    return params.event_value == 0;
}

function getPermalink(channelId, messageTimestamp) {
    var req = new CurlHttpRequest();

    req.AddHeader(''Content-Type: application/x-www-form-urlencoded; charset=utf-8'');

    var resp = JSON.parse(req.Get(
        ''{0}?token={1}&channel={2}&message_ts={3}''.format(
            Slack.getPermalink,
            params.bot_token,
            channelId,
            messageTimestamp
        )
    ));

    if (req.Status != 200 && !resp.ok) {
        throw resp.error;
    }

    return resp.permalink;
}

function createProblemURL(zabbix_url, triggerid, eventid, event_source) {
    var problem_url = '''';
    if (event_source === ''0'') {
        problem_url = ''{0}/tr_events.php?triggerid={1}&eventid={2}''
            .format(
                zabbix_url,
                triggerid,
                eventid
            );
    }
    else {
        problem_url = zabbix_url;
    }

    return problem_url;
}

function getTagValue(event_tags, key) {
    var pattern = new RegExp(''('' + key + '':.+)'');
    var tag_value = event_tags
        .split('','')
        .filter(function (v) {
            return v.match(pattern);
        })
        .map(function (v) {
            return v.split('':'')[1];
        })[0]
        || 0;

    return tag_value;
}

function handlerAlarm(params) {
    var fields = {
        channel: params.channel,
        as_user: params.slack_as_user,
    };

    if (isEventProblem(params)) {
        fields.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        var resp = JSON.parse(req.Post(Slack.postMessage, JSON.stringify(fields)));

        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }

        result.tags.__message_ts = resp.ts;
        result.tags.__channel_id = resp.channel;
        result.tags.__channel_name = params.channel;
        result.tags.__message_link = getPermalink(resp.channel, resp.ts);
    }
    else if (isEventUpdate(params)) {
        fields.thread_ts = getTagValue(params.event_tags, ''message_ts'');
        fields.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_update_date,
                params.event_update_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source),
                true
            )
        ];

        resp = JSON.parse(req.Post(Slack.postMessage, JSON.stringify(fields)));
        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }

    }
    else if (isEventResolve(params)) {
        fields.channel = getTagValue(params.event_tags, ''channel_id'');
        fields.text = '''';
        fields.ts = getTagValue(params.event_tags, ''message_ts'');
        fields.attachments = [
            createMessage(
                RESOLVE_COLOR,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        resp = JSON.parse(req.Post(Slack.chatUpdate, JSON.stringify(fields)));
        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }
    }
}

function handlerEvent(params) {
    var fields = {
        channel: params.channel,
        as_user: params.slack_as_user
    };

    if (isEventProblem(params)) {
        fields.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_date,
                params.event_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        var resp = JSON.parse(req.Post(Slack.postMessage, JSON.stringify(fields)));

        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }

        result.tags.__channel_name = params.channel;
        result.tags.__message_link = getPermalink(resp.channel, resp.ts);

    }
    else if (isEventUpdate(params)) {
        fields.attachments = [
            createMessage(
                SEVERITY_COLORS[params.event_nseverity] || 0,
                params.event_update_date,
                params.event_update_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source),
                false
            )
        ];

        resp = JSON.parse(req.Post(Slack.postMessage, JSON.stringify(fields)));

        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }

    }
    else if (isEventResolve(params)) {
        fields.attachments = [
            createMessage(
                RESOLVE_COLOR,
                params.event_recovery_date,
                params.event_recovery_time,
                createProblemURL(params.zabbix_url, params.trigger_id, params.event_id, params.event_source)
            )
        ];

        resp = JSON.parse(req.Post(Slack.postMessage, JSON.stringify(fields)));

        if (req.Status != 200 && !resp.ok) {
            throw resp.error;
        }
    }
}

function createMessage(
    event_severity_color,
    event_date,
    event_time,
    problem_url,
    isShort,
    messageText
) {
    var message = {
        fallback: params.alert_subject,
        title: params.alert_subject,
        color: event_severity_color,
        title_link: problem_url,
        pretext: messageText || '''',

        fields: [
            {
                title: ''Host'',
                value: ''{0} [{1}]''.format(params.host_name, params.host_conn),
                short: true
            },
            {
                title: ''Event time'',
                value: ''{0} {1}''.format(event_date, event_time),
                short: true
            }
        ],
    };

    if (params.event_source === ''0'') {
        message.fields.push(
            {
                title: ''Severity'',
                value: params.event_severity,
                short: true
            },
            {
                title: ''Opdata'',
                value: params.event_opdata,
                short: true
            }
        );
    }

    if (!isShort  && params.event_source === ''0'') {
        message[''actions''] = [
            {
                type: ''button'',
                text: ''Open in Zabbix'',
                url: problem_url
            }
        ];

        message.fields.push(
            {
                title: ''Event tags'',
                value: params.event_tags.replace(/__.+?:(.+?,|.+)/g, '''') || ''None'',
                short: true
            },
            {
                title: ''Trigger description'',
                value: params.trigger_description,
                short: true
            }
        );
    }

    if (params.event_source !== ''0'' || params.event_update_status === ''1'') {
        message.fields.push(
            {
                title: ''Details'',
                value: params.alert_message,
                short: false
            }
        );
    }

    return message;
}

function validateParams(params) {
    if (typeof params.bot_token !== ''string'' || params.bot_token.trim() === '''') {
        throw ''Field "bot_token" cannot be empty'';
    }

    if (typeof params.channel !== ''string'' || params.channel.trim() === '''') {
        throw ''Field "channel" cannot be empty'';
    }

    if (isNaN(params.event_id)) {
        throw ''Field "event_id" is not a number'';
    }

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    if (params.event_source !== ''0'') {
        params.event_nseverity = ''0'';
        params.event_severity = ''Not classified'';
        params.event_update_status = ''0'';
        params.slack_mode = ''event'';
    }

    if (params.event_source === ''1'' || params.event_source === ''2'') {
        params.event_value = ''1'';
    }

    if (params.event_source === ''1'') {
        params.host_name = params.discovery_host_dns;
        params.host_ip = params.discovery_host_ip;
    }

    if (!~[0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity))) {
        throw ''Incorrect "event_nseverity" parameter given: '' + params.event_nseverity + ''\\nMust be 0-5.'';
    }

    if (typeof params.event_severity !== ''string'' || params.event_severity.trim() === '''') {
        throw ''Field "event_severity" cannot be empty'';
    }

    if (params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_value !== ''0'' && params.event_value !== ''1'') {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    if (typeof params.host_conn !== ''string'' || params.host_conn.trim() === '''') {
        throw ''Field "host_conn" cannot be empty'';
    }

    if (typeof params.host_name !== ''string'' || params.host_name.trim() === '''') {
        throw ''Field "host_name" cannot be empty'';
    }

    if (!~[''true'', ''false''].indexOf(params.slack_as_user.toLowerCase())) {
        throw ''Incorrect "slack_as_user" parameter given: '' + params.slack_as_user + ''\\nMust be "true" or "false".'';
    }

    if (!~[''alarm'', ''event''].indexOf(params.slack_mode)) {
        throw ''Incorrect "slack_mode" parameter given: '' + params.slack_mode + ''\\nMust be "alarm" or "event".'';
    }

    if (isNaN(params.trigger_id) && params.event_source === ''0'') {
        throw ''field "trigger_id" is not a number'';
    }

    if (typeof params.zabbix_url !== ''string'' || params.zabbix_url.trim() === '''') {
        throw ''Field "zabbix_url" cannot be empty'';
    }

    if (!/^(http|https):\\/\\/.+/.test(params.zabbix_url)) {
        throw ''Field "zabbix_url" must contain a schema'';
    }
}

try {
    var params = JSON.parse(value);

    validateParams(params);

    var req = new CurlHttpRequest(),
        result = {tags: {}};

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        req.SetProxy(params.HTTPProxy);
    }

    req.AddHeader(''Content-Type: application/json; charset=utf-8'');
    req.AddHeader(''Authorization: Bearer '' + params.bot_token);

    var slack_endpoint = ''https://slack.com/api/'';

    var Slack = {
        postMessage: slack_endpoint + ''chat.postMessage'',
        getPermalink: slack_endpoint + ''chat.getPermalink'',
        chatUpdate: slack_endpoint + ''chat.update''
    };

    params.slack_mode = params.slack_mode.toLowerCase();
    params.slack_mode = params.slack_mode in SLACK_MODE_HANDLERS
        ? params.slack_mode
        : ''alarm'';

    SLACK_MODE_HANDLERS[params.slack_mode](params);

    if (params.event_source === ''0'') {
        return JSON.stringify(result);
    }
    else {
        return ''OK'';
    }
}
catch (error) {
    Zabbix.Log(4, ''[ Slack Webhook ] Slack notification failed : '' + error);
    throw ''Slack notification failed : '' + error;
}','30s','1','1','{EVENT.TAGS.__message_link}','Open in Slack: {EVENT.TAGS.__channel_name}','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('10','4','Discord','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var SEVERITY_COLORS = [
    ''#97AAB3'', // Not classified.
    ''#7499FF'', // Information.
    ''#FFC859'', // Warning.
    ''#FFA059'', // Average.
    ''#E97659'', // High.
    ''#E45959'', // Disaster.
    ''#009900''  // Resolved.
];

function stringTruncate(str, len) {
    return str.length > len ? str.substring(0, len - 3) + ''...'' : str;
}

try {
    Zabbix.Log(4, ''[ Discord Webhook ] Executed with params: '' + value);

    var params = JSON.parse(value);

    if (!params.discord_endpoint) {
        throw ''Cannot get discord_endpoint'';
    }
    else {
        params.discord_endpoint = params.discord_endpoint.replace(''/api/'', ''/api/v7/'') + ''?wait=True'';
    }

    params.zabbix_url = (params.zabbix_url.endsWith(''/''))
        ? params.zabbix_url.slice(0, -1) : params.zabbix_url;

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    // Set params to true for non trigger-based events.
    if (params.event_source !== ''0'') {
        params.use_default_message = ''true'';
        params.event_nseverity = ''0'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: "'' + params.event_value + ''".\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_update_status !== ''0'' && params.event_update_status !== ''1'' && params.event_source === ''0'') {
        throw ''Incorrect "event_update_status" parameter given: "'' + params.event_update_status + ''".\\nMust be 0 or 1.'';
    }

    if (params.event_value == 0) {
        params.event_nseverity = ''6'';
    }

    if (!SEVERITY_COLORS[params.event_nseverity]) {
        throw ''Incorrect "event_nseverity" parameter given: '' + params.event_nseverity + ''\\nMust be 0-5.'';
    }

    var color = parseInt(SEVERITY_COLORS[params.event_nseverity].replace(''#'', ''''), 16),
        fields = [],
        body = {
            embeds: [
                {
                    color: color || 0,
                    url: (params.event_source === ''0'')
                        ? params.zabbix_url + ''/tr_events.php?triggerid='' + params.trigger_id +
                            ''&eventid='' + params.event_id
                        : params.zabbix_url
                }
            ]
        };

    // Default message from {ALERT.MESSAGE}.
    if (params.use_default_message.toLowerCase() == ''true'') {
        body.embeds[0].title = stringTruncate(params.alert_subject, 256);
        body.embeds[0].description = stringTruncate(params.alert_message, 2048);
    }
    else {
        fields.push(
            {
                name: ''Host'',
                value: params.host_name + '' ['' + params.host_ip + '']''
            }
        );

        // Resolved message.
        if (params.event_value == 0 && params.event_update_status == 0) {
            body.embeds[0].title = stringTruncate(''OK: '' + params.event_name, 256);
            fields.push(
                {
                    name: ''Recovery time'',
                    value: params.event_recovery_time + '' '' + params.event_recovery_date,
                    inline: ''True''
                }
            );
        }

        // Problem message.
        else if (params.event_value == 1 && params.event_update_status == 0) {
            body.embeds[0].title = stringTruncate(''PROBLEM: '' + params.event_name, 256);
            fields.push(
                {
                    name: ''Event time'',
                    value: params.event_time + '' '' + params.event_date,
                    inline: ''True''
                }
            );
        }

        // Update message.
        else if (params.event_update_status == 1) {
            body.embeds[0].title = stringTruncate(''UPDATE: '' + params.event_name, 256);
            body.embeds[0].description = params.event_update_user + '' '' + params.event_update_action + ''.'';

            if (params.event_update_message) {
                body.embeds[0].description += '' Comment:\\n>>> '' + params.event_update_message;
            }

            body.embeds[0].description = stringTruncate(body.embeds[0].description, 2048);

            fields.push(
                {
                    name: ''Event update time'',
                    value: params.event_update_time + '' '' + params.event_update_date,
                    inline: ''True''
                }
            );
        }

        fields.push(
            {
                name: ''Severity'',
                value: params.event_severity,
                inline: ''True''
            }
        );

        if (params.event_opdata) {
            fields.push(
                {
                    name: ''Operational data'',
                    value: stringTruncate(params.event_opdata, 1024),
                    inline: ''True''
                }
            );
        }

        if (params.event_value == 1 && params.event_update_status == 0 && params.trigger_description) {
            fields.push(
                {
                    name: ''Trigger description'',
                    value: stringTruncate(params.trigger_description, 1024)
                }
            );
        }

        body.embeds[0].footer = {
            text: ''Event ID: '' + params.event_id
        };

        if (params.event_tags) {
            body.embeds[0].footer.text += ''\\nEvent tags: '' + params.event_tags;
        }
        body.embeds[0].footer.text = stringTruncate(body.embeds[0].footer.text, 2048);
    }

    if (fields.length > 0) {
        body.embeds[0].fields = fields;
    }

    var req = new CurlHttpRequest();

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        req.SetProxy(params.HTTPProxy);
    }

    req.AddHeader(''Content-Type: application/json'');

    var resp = req.Post(params.discord_endpoint, JSON.stringify(body)),
        data = JSON.parse(resp);

    Zabbix.Log(4, ''[ Discord Webhook ] JSON: '' + JSON.stringify(body));
    Zabbix.Log(4, ''[ Discord Webhook ] Response: '' + resp);

    if (data.id) {
        return resp;
    }
    else {
        var message = ((typeof data.message === ''string'') ? data.message : ''Unknown error'');

        Zabbix.Log(3, ''[ Discord Webhook ] FAILED with response: '' + resp);
        throw message + ''. For more details check zabbix server log.'';
    }
}
catch (error) {
    Zabbix.Log(3, ''[ Discord Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','0','0','','','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('11','4','SIGNL4','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'// SIGNL4 Webhook
try {
    var response,
        payload,
        params = JSON.parse(value),
        endpoint = ''https://connect.signl4.com/webhook/'',
        request = new CurlHttpRequest();

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        request.SetProxy(params.HTTPProxy);
    }

    if (typeof params.teamsecret === ''string'' && params.teamsecret.trim() !== '''') {
        endpoint += params.teamsecret;
        delete params.teamsecret;
    }
    else {
        throw ''The team secret of your SIGNL4 team cannot be empty.'';
    }

    if (typeof params.Severity === ''string'' && params.Severity === ''{EVENT.SEVERITY}'') {
        params.Severity = ''Not classified'';
    }

if (typeof params.User === ''string'' && params.User === ''{USER.FULLNAME}'') {
        params.User = '''';
    }

if (typeof params.Event_Update_Action === ''string'' && params.Event_Update_Action === ''{EVENT.UPDATE.ACTION}'') {
        params.Event_Update_Action = '''';
    }

// Assemble X-S4-ExternalID for two-way integration
// Format: "ZabbixEventID: 222 ZabbixURL: https://your-zabbix-server/zabbix/"
params[''X-S4-ExternalID''] = ''ZabbixEventID: '' + params.Event_ID;
if (typeof params.Zabbix_URL === ''string'' && params.Zabbix_URL.indexOf(''http'') == 0) {
// Make sure the URL ends with ''/''
if (params.Zabbix_URL.charAt(params.Zabbix_URL.length - 1) != ''/'') {
params.Zabbix_URL = params.Zabbix_URL + ''/'';
}

params[''X-S4-ExternalID''] = params[''X-S4-ExternalID''] + '' ZabbixURL: '' +  params.Zabbix_URL;

// Add Link parameter
params[''Link''] = params.Zabbix_URL + "tr_events.php?triggerid="+params.Trigger_ID + "&eventid=" + params.Event_ID;
}

// Check if this is a new problem or a recovery
if (params.Trigger_Status == ''OK'') {
params[''X-S4-Status''] = ''resolved'';
}
else {
params[''X-S4-Status''] = ''new'';
}

    payload = JSON.stringify(params);
    Zabbix.Log(4, ''[ SIGNL4 Webhook ] Sending request: '' + payload);

    request.AddHeader(''Content-Type: application/json'');
    response = request.Post(endpoint, ''payload='' + payload);

    Zabbix.Log(4, ''[ SIGNL4 Webhook ] Received response with status code '' +
            request.Status() + ''\\n'' + response
    );

    if (request.Status() !== 201) {
        throw ''Request failed with status code '' + request.Status() +
                ''. Check debug log for more information.'';
    }

    return ''OK'';
}
catch (error) {
    Zabbix.Log(4, ''[ SIGNL4 Webhook ] ERROR: '' + error);

    throw ''Sending failed: '' + error;
}','30s','0','0','','','SIGNL4 is a mobile alert notification app for powerful alerting, alert management and mobile assignment of work items. It offers alerting via app push, SMS and voice calls including escalations, tracking, and duty scheduling.

Get the app at https://www.signl4.com.

Find out more including an integration video here: https://www.signl4.com/blog/portfolio_item/zabbix-mobile-alert-notification-duty-schedule-escalation/
');


INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('14','4','MS Teams','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var SEVERITY_COLORS = [
    ''#97AAB3'', // Not classified.
    ''#7499FF'', // Information.
    ''#FFC859'', // Warning.
    ''#FFA059'', // Average.
    ''#E97659'', // High.
    ''#E45959'', // Disaster.
    ''#009900'', // Resolved.
    ''#000000''  // Default.
];

try {
    var params = JSON.parse(value);

    if (!params.teams_endpoint) {
        throw ''Cannot get teams_endpoint'';
    }
    else if (!params.teams_endpoint.startsWith(''https://outlook.office.com/webhook/'')) {
        throw ''Invalid MS Teams webhook URL: '' + params.teams_endpoint;
    }

    params.zabbix_url = (params.zabbix_url.endsWith(''/''))
        ? params.zabbix_url.slice(0, -1) : params.zabbix_url;

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    // Set "use_default_message" to true for non trigger-based events.
    if (params.event_source !== ''0'') {
        params.use_default_message = ''true'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: "'' + params.event_value + ''".\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_update_status !== ''0'' && params.event_update_status !== ''1'' && params.event_source === ''0'') {
        throw ''Incorrect "event_update_status" parameter given: "'' + params.event_update_status + ''".\\nMust be 0 or 1.'';
    }

    if (params.event_value == 0) {
        params.event_nseverity = ''6'';
    }

    if (!SEVERITY_COLORS[params.event_nseverity]) {
        params.event_nseverity = ''7'';
    }

    var request = new CurlHttpRequest(),
        facts = [],
        body = {
            themeColor: SEVERITY_COLORS[params.event_nseverity].replace(''#'', ''''),
            summary: ''Zabbix'',
            sections: [
                {
                    markdown: ''false'',
                    activityTitle: params.alert_subject,
                    activitySubtitle: ''On '' + params.host_name + '' ['' + params.host_ip + '']'',
                    text: (params.use_default_message.toLowerCase() == ''true'')
                        ? params.alert_message
                        : params.trigger_description
                }
            ],
            potentialAction: [
                {
                    ''@type'': ''OpenUri'',
                    name: (params.event_source === ''0'')
                        ? ''Event Info''
                        : ''Zabbix Home'',
                    targets: [
                        {
                            os: ''default'',
                            uri: (params.event_source === ''0'')
                                ? params.zabbix_url + ''/tr_events.php?triggerid='' +
                                    params.trigger_id + ''&eventid='' + params.event_id
                                : params.zabbix_url
                        }
                    ]
                }
            ]
        };

    if (params.use_default_message.toLowerCase() !== ''true'') {
        // Problem message.
        if (params.event_value === ''1'' && params.event_update_status === ''0'') {
            facts.push({
                name: ''Event time'',
                value: params.event_time + '' '' + params.event_date
            });
        }
        // Update message.
        else if (params.event_update_status === ''1'') {
            body.sections[0].text = params.event_update_user + '' '' + params.event_update_action + ''.'';

            if (params.event_update_message) {
                body.sections[0].text += ''<br>Message:<br>'' + params.event_update_message;
            }

            facts.push({
                name: ''Event update time'',
                value: params.event_update_time + '' '' + params.event_update_date
            });
        }
        // Resolved message.
        else {
            facts.push({
                name: ''Recovery time'',
                value: params.event_recovery_time + '' '' + params.event_recovery_date
            });
        }

        if (params.event_severity && params.event_severity !== ''{EVENT.SEVERITY}'') {
            facts.push({
                name: ''Severity'',
                value: params.event_severity
            });
        }


        if (params.event_opdata && params.event_opdata !== ''{EVENT.OPDATA}'') {
            facts.push({
                name: ''Operational data'',
                value: params.event_opdata
            });
        }

        if (params.event_tags && params.event_tags !== ''{EVENT.TAGS}'') {
            facts.push({
                name: ''Event tags'',
                value: params.event_tags
            });
        }

        Object.keys(params)
            .forEach(function (key) {
                if (key.startsWith(''fact_'') && params[key] !== '''') {
                    facts.push({
                        name: key.substring(5),
                        value: params[key]
                    });
                }
                else if (key.startsWith(''openUri_'') && params[key] !== '''' && !params[key].startsWith(''{'')) {
                    body.potentialAction.push({
                        ''@type'': ''OpenUri'',
                        name: key.substring(8),
                        targets: [
                            {
                                os: ''default'',
                                uri: params[key]
                            }
                        ]
                    });
                }
            });
        body.sections[0].facts = facts;
    }

    body.sections[0].text = body.sections[0].text.replace(/(?:\\r\\n|\\r|\\n)/g, ''<br>'');

    request.AddHeader(''Content-Type: application/json'');

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy !== '''') {
        request.SetProxy(params.HTTPProxy);
    }

    Zabbix.Log(4, ''[ MS Teams Webhook ] JSON: '' + JSON.stringify(body));

    var response = request.Post(params.teams_endpoint, JSON.stringify(body));

    Zabbix.Log(4, ''[ MS Teams Webhook ] Response: '' + response);

    if (response === ''1'') {
        return ''OK'';
    }
    else {
        Zabbix.Log(4, ''[ MS Teams Webhook ] FAILED with response: '' + response);
        throw response;
    }
}
catch (error) {
    Zabbix.Log(3, ''[ MS Teams Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','0','0','','','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('15','4','Redmine','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Redmine = {
    params: {},

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        Redmine.params = params;
        if (typeof Redmine.params.url === ''string'') {
            if (!Redmine.params.url.endsWith(''/'')) {
                Redmine.params.url += ''/'';
            }
        }
    },

    addCustomFields: function (data, fields) {
        if (typeof fields === ''object'' && Object.keys(fields).length) {
            var schema = Redmine.getSchema();

            if (schema) {
                data.issue.custom_fields = [];

                Object.keys(fields)
                    .forEach(function(field) {
                        for (var idx in schema.custom_fields) {
                            if (schema.custom_fields[idx].id != field) {
                                continue;
                            }

                            var field_value;

                            switch (schema.custom_fields[idx].field_format) {
                                case ''string'':
                                    field_value = fields[field];
                                    break;

                                case ''int'':
                                    field_value = parseInt(fields[field]);
                                    break;

                                case ''float'':
                                    field_value = parseFloat(fields[field]);
                                    break;

                                case ''date'':
                                    if (fields[field].match(/^\\d{4}[.-]\\d{2}[.-]\\d{2}$/)) {
                                        field_value = fields[field].replace(/\\./g, ''-'');
                                    }
                                    break;
                            }

                            if (field_value !== undefined) {
                                data.issue.custom_fields.push({id: field, value: field_value});
                            }
                        }
                    });
            }
            else {
                Zabbix.Log(4, ''[ Redmine Webhook ] Failed to retrieve field schema.'');
            }
        }

        return data;
    },

    request: function (method, query, data) {
        [''url'', ''access_key''].forEach(function (field) {
            if (typeof Redmine.params !== ''object'' || typeof Redmine.params[field] === ''undefined''
                || Redmine.params[field] === '''' ) {
                throw ''Required param is not set: "'' + field + ''".'';
            }
        });

        var response,
            url = Redmine.params.url + query,
            request = new CurlHttpRequest();

        if (typeof Redmine.HTTPProxy === ''string'' && Redmine.HTTPProxy.trim() !== '''') {
            request.SetProxy(Redmine.HTTPProxy);
        }

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''X-Redmine-API-Key: '' + Redmine.params.access_key);

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ Redmine Webhook ] Sending request: '' +
            url + ((typeof data === ''string'') ? ('' '' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ Redmine Webhook ] Received response with status code '' + request.Status() + '': '' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ Redmine Webhook ] Failed to parse response received from Redmine'');
                response = null;
            }
        }

        if (request.Status() < 200 || request.Status() >= 300) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null && typeof response.errors !== ''undefined''
                && Object.keys(response.errors).length > 0) {
                message += '': '' + JSON.stringify(response.errors);
            }
            else if (response !== null && typeof response.errorMessages !== ''undefined''
                && Object.keys(response.errorMessages).length > 0) {
                message += '': '' + JSON.stringify(response.errorMessages);
            }

            throw message + '' Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    getProjectID: function(name) {
        var result = Redmine.request(''get'', ''projects.json''),
            project_id;

        if (result.response) {
            var projects = result.response.projects || [];

            for (var i in projects) {
                if (projects[i].name === name) {
                    project_id = projects[i].id;
                    break;
                }
            }
        }
        else {
            Zabbix.Log(4, ''[ Redmine Webhook ] Failed to retrieve project data.'');
        }

        if (typeof project_id === ''undefined'') {
            throw ''Cannot find project with name: '' + name;
        }

        return project_id;
    },

    getSchema: function() {
        var result = Redmine.request(''get'', ''custom_fields.json'');

        return result.response;
    },

    createIssue: function(subject, description, priority, fields) {
        var project_id = /^\\d+$/.test(Redmine.params.project)
                ? Redmine.params.project
                : Redmine.getProjectID(Redmine.params.project),
            data = {
                issue: {
                    project_id: project_id,
                    tracker_id: Redmine.params.tracker_id,
                    subject: subject,
                    description: description
                }
            },
            result;

        if (priority) {
            data.issue.priority_id = priority;
        }

        result = Redmine.request(''post'', ''issues.json'', Redmine.addCustomFields(data, fields));

        if (typeof result.response !== ''object''
            || typeof result.response.issue.id === ''undefined''
            || result.status != 201) {
            throw ''Cannot create Redmine issue. Check debug log for more information.'';
        }

        return result.response.issue.id;
    },

    updateIssue: function(note, fields) {
        var data = {
            issue: {
                notes: note || ''''
            }
        };

        Redmine.request(''put'', ''issues/'' + Redmine.params.issue_key + ''.json'', Redmine.addCustomFields(data, fields));
    }
};

try {
    var params = JSON.parse(value),
        params_redmine = {},
        params_fields = {},
        params_update = {},
        result = {tags: {}},
        required_params = [
            ''alert_subject'', ''tracker_id'', ''project'',
            ''event_source'', ''event_value'',  ''event_update_status''
        ],
        severities = [
            {name: ''not_classified'', color: ''#97AAB3''},
            {name: ''information'', color: ''#7499FF''},
            {name: ''warning'', color: ''#FFC859''},
            {name: ''average'', color: ''#FFA059''},
            {name: ''high'', color: ''#E97659''},
            {name: ''disaster'', color: ''#E45959''},
            {name: ''resolved'', color: ''#009900''},
            {name: null, color: ''#000000''}
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (key.startsWith(''redmine_'')) {
                params_redmine[key.substring(8)] = params[key];
            }
            else if (key.startsWith(''customfield_'')) {
                params_fields[key.substring(12)] = params[key];
            }
            else if (key.startsWith(''event_update_'')) {
                params_update[key.substring(13)] = params[key];
            }
            else if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter "'' + key + ''" cannot be empty.'';
            }
        });

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: '' + params.event_source + ''\\nMust be 0-3.'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_source !== ''0'' && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for trigger-based actions.'';
    }

    if (params.event_source === ''0''
        && ((params.event_value === ''1'' && params.event_update_status === ''1'')
            || (params.event_value === ''0''
                && (params.event_update_status === ''0'' || params.event_update_status === ''1'')))
        && (isNaN(parseInt(params.redmine_issue_key)) || parseInt(params.redmine_issue_key) < 1 )) {
        throw ''Incorrect "redmine_issue_key" parameter given: '' + params.redmine_issue_key +
            ''\\nMust be positive integer.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity].name];
    priority = priority && priority.trim() || severities[7].name;

    Redmine.setParams(params_redmine);
    Redmine.HTTPProxy = params.HTTPProxy;

    // Create issue for non trigger-based events.
    if (params.event_source !== ''0''
        && params.event_value !== ''0'') {
        Redmine.createIssue(params.alert_subject, params.alert_message, priority);
    }
    // Create issue for trigger-based events.
    else if (params.event_value === ''1'' && params_update.status === ''0'') {
        var issue_id = Redmine.createIssue(params.alert_subject,
            params.alert_subject + ''\\n'' + params.alert_message + ''\\n'' +
            params.zabbix_url + (params.zabbix_url.endsWith(''/'') ? '''' : ''/'') +
            ''tr_events.php?triggerid='' + params.trigger_id + ''&eventid='' + params.event_id + ''\\n'',
            priority,
            params_fields);

        result.tags.__zbx_redmine_issue_id = issue_id;
        result.tags.__zbx_redmine_issuelink = params.redmine_url +
            (params.redmine_url.endsWith(''/'') ? '''' : ''/'') + ''issues/'' + issue_id;
    }
    // Update created issue for trigger-based event.
    else {
        Redmine.updateIssue(params.alert_subject + ''\\n'' + params.alert_message, params_fields);
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[ Redmine Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_redmine_issuelink}','Redmine: issue #{EVENT.TAGS.__zbx_redmine_issue_id}','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('16','4','Telegram','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Telegram = {
    token: null,
    to: null,
    message: null,
    proxy: null,
    parse_mode: null,

    sendMessage: function() {
        var params = {
            chat_id: Telegram.to,
            text: Telegram.message,
            disable_web_page_preview: true,
            disable_notification: false
        },
        data,
        response,
        request = new CurlHttpRequest(),
        url = ''https://api.telegram.org/bot'' + Telegram.token + ''/sendMessage'';

        if (Telegram.parse_mode !== null) {
            params[''parse_mode''] = Telegram.parse_mode;
        }

        if (Telegram.proxy) {
            request.SetProxy(Telegram.proxy);
        }

        request.AddHeader(''Content-Type: application/json'');
        data = JSON.stringify(params);

        // Remove replace() function if you want to see the exposed token in the log file.
        Zabbix.Log(4, ''[Telegram Webhook] URL: '' + url.replace(Telegram.token, ''<TOKEN>''));
        Zabbix.Log(4, ''[Telegram Webhook] params: '' + data);
        response = request.Post(url, data);
        Zabbix.Log(4, ''[Telegram Webhook] HTTP code: '' + request.Status());

        try {
            response = JSON.parse(response);
        }
        catch (error) {
            response = null;
        }

        if (request.Status() !== 200 || typeof response.ok !== ''boolean'' || response.ok !== true) {
            if (typeof response.description === ''string'') {
                throw response.description;
            }
            else {
                throw ''Unknown error. Check debug log for more information.''
            }
        }
    }
}

try {
    var params = JSON.parse(value);

    if (typeof params.Token === ''undefined'') {
        throw ''Incorrect value is given for parameter "Token": parameter is missing'';
    }

    Telegram.token = params.Token;

    if (params.HTTPProxy) {
        Telegram.proxy = params.HTTPProxy;
    } 

    if ([''Markdown'', ''HTML'', ''MarkdownV2''].indexOf(params.ParseMode) !== -1) {
        Telegram.parse_mode = params.ParseMode;
    }

    Telegram.to = params.To;
    Telegram.message = params.Subject + ''\\n'' + params.Message;
    Telegram.sendMessage();

    return ''OK'';
}
catch (error) {
    Zabbix.Log(4, ''[Telegram Webhook] notification failed: '' + error);
    throw ''Sending failed: '' + error + ''.'';
}','10s','0','0','','','https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/telegram

1. Register bot: send "/newbot" to @BotFather and follow instructions
2. Copy and paste the obtained token into the "Token" field above
3. If you want to send personal notifications, you need to get chat id of the user you want to send messages to:
    3.1. Send "/getid" to "@myidbot" in Telegram messenger
    3.2. Copy returned chat id and save it in the "Telegram Webhook" media for the user
    3.3. Ask the user to send "/start" to your bot (Telegram bot won''t send anything to the user without it)
4. If you want to send group notifications, you need to get group id of the group you want to send messages to:
    4.1. Add "@myidbot" to your group
    4.2. Send "/getgroupid@myidbot" in your group
    4.3. Copy returned group id save it in the "Telegram Webhook" media for the user you created for  group notifications
    4.4. Send "/start@your_bot_name_here" in your group (Telegram bot won''t send anything to the group without it)');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('17','4','Zendesk','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Zendesk = {
    params: {},

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        Zendesk.params = params;
        if (typeof Zendesk.params.url === ''string'') {
            if (!Zendesk.params.url.endsWith(''/'')) {
                Zendesk.params.url += ''/'';
            }
            Zendesk.params.url += ''api/v2/'';
        }
    },

    addCustomFields: function (data, fields) {
        if (typeof fields === ''object'' && Object.keys(fields).length) {
            var schema = Zendesk.getSchema(),
                arr = [],
                i,
                n;

            if (schema) {
                Object.keys(fields)
                    .forEach(function(field) {
                        for (i = 0, n = schema.ticket_fields.length; i < n; i++) {
                            if (schema.ticket_fields[i].id == field
                                && [''text'', ''integer'', ''date''].indexOf(schema.ticket_fields[i].type) !== -1){

                                switch (schema.ticket_fields[i].type) {
                                    case ''integer'':
                                        fields[field] = parseInt(fields[field]);
                                        break;
                                    case ''date'':
                                        if (fields[field].match(/^\\d{4}[.-]\\d{2}[.-]\\d{2}$/) !== null) {
                                            fields[field] = fields[field].replace(/\\./g, ''-'');
                                        }
                                        else {
                                            fields[field] = '''';
                                        }
                                        break;
                                }

                                arr.push({id: field, value: fields[field]});
                                break;
                            }
                        }
                    });

                if (arr.length) {
                    data.ticket[''custom_fields''] = arr;
                }
            }
            else {
                Zabbix.Log(4, ''[Zendesk Webhook] Failed to retrieve field schema.'');
            }
        }

        return data;
    },

    request: function (method, query, data) {
        [''url'', ''token'', ''type''].forEach(function (field) {
            if (typeof Zendesk.params !== ''object'' || typeof Zendesk.params[field] === ''undefined'') {
                throw ''Required Zendesk param is not set: '' + field + ''\\n'' + Zendesk.params[field];
            }
        });

        var response,
            url = Zendesk.params.url + query,
            request = new CurlHttpRequest();

        if (typeof Zendesk.HTTPProxy === ''string'' && Zendesk.HTTPProxy.trim() !== '''') {
            request.SetProxy(Zendesk.HTTPProxy);
        }

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''Authorization: Basic '' + btoa(Zendesk.params.token));

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[Zendesk Webhook] Sending request: '' + url + ((typeof data === ''string'') ? ('' '' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[Zendesk Webhook] Received response with status code '' + request.Status() + ''. '' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[Zendesk Webhook] Failed to parse response received from Zendesk.'');
            }
        }

        if (request.Status() < 200 || request.Status() >= 300) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null && typeof response.error !== ''undefined''
                && Object.keys(response.error).length > 0) {
                message += '': '' + JSON.stringify(response.error);
            }
            else if (response !== null && typeof response.description !== ''undefined''
                && Object.keys(response.description).length > 0) {
                message += '': '' + JSON.stringify(response.description);
            }
            else {
                message += ''. '' + response;
            }
            throw message + ''. Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    getSchema: function() {
        var result = Zendesk.request(''get'', ''ticket_fields.json'');

        return result.response;
    },

    createIssue: function(data, fields) {
        var result = Zendesk.request(''post'', ''tickets.json'', Zendesk.addCustomFields(data, fields));

        if (typeof result.response !== ''object'' || typeof result.response.ticket.id === ''undefined''
            || result.status != 201) {
            throw ''Cannot create Zendesk issue. Check debug log for more information.'';
        }

        return result.response.ticket.id;
    },

    updateIssue: function(data, fields) {
        Zendesk.request(''put'', ''tickets/'' + Zendesk.params.issue_key + ''.json'', Zendesk.addCustomFields(data, fields));
    }
};

try {
    var params = JSON.parse(value),
        fields = {},
        zendesk = {},
        update = {},
        data = {},
        result = {tags: {}},
        required_params = [
            ''alert_subject'',
            ''alert_message'',
            ''event_id'',
            ''event_source'',
            ''event_value'',
            ''event_update_status''
        ],
        severities = [
            {name: ''not_classified'', color: ''#97AAB3''},
            {name: ''information'', color: ''#7499FF''},
            {name: ''warning'', color: ''#FFC859''},
            {name: ''average'', color: ''#FFA059''},
            {name: ''high'', color: ''#E97659''},
            {name: ''disaster'', color: ''#E45959''},
            {name: ''resolved'', color: ''#009900''},
            {name: ''default'', color: ''#000000''}
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (key.startsWith(''zendesk_'')) {
                zendesk[key.substring(8)] = params[key];
            }
            else if (key.startsWith(''customfield_'')) {
                fields[key.substring(12)] = params[key];
            }
            else if (key.startsWith(''event_update_'')) {
                update[key.substring(13)] = params[key];
            }
            else if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter '' + key + '' cannot be empty.'';
            }
        });

    // Possible values: question, incident, problems, task
    if ([''question'', ''incident'', ''problem'', ''task''].indexOf(params.zendesk_type) === -1) {
        throw ''Incorrect "zendesk_type" parameter given: '' + params.zendesk_type +
            ''\\nMust be one of question, incident, problem, task.'';
    }

    // Possible values: 0 - Trigger, 1 - Discovery, 2 - Autoregistration, 3 - Internal.
    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: '' + params.event_source + ''\\nMust be 0-3.'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    // Possible values: 1 for problem, 0 for recovering
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    // Possible values: 0 - Webhook was called because of problem/recovery event, 1 - Update operation.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_source !== ''0'' && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for trigger-based actions.'';
    }

    // Zendesk_issue_key must be a positive integer if an update action is being performed.
    if (params.event_source === ''0'' && ((params.event_value === ''1'' && params.event_update_status === ''1'')
        || (params.event_value === ''0'' && (params.event_update_status === ''0'' || params.event_update_status === ''1'')))
        && (isNaN(parseInt(params.zendesk_issue_key)) || parseInt(params.zendesk_issue_key) < 1 )) {
        throw ''Incorrect "zendesk_issue_key" parameter given: '' + params.zendesk_issue_key +
            ''\\nMust be positive integer.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity].name] || severities[7].name;

    Zendesk.setParams(zendesk);
    Zendesk.HTTPProxy = params.HTTPProxy;

    // Create issue for non trigger-based events.
    if (params.event_source !== ''0'' && params.event_value !== ''0'') {
        data = {
            ticket: {
                external_id: params.event_id,
                type: Zendesk.params.type,
                status: ''new'',
                subject: params.alert_subject,
                comment: {
                    body: params.alert_message,
                    public: ''false''
                },
                priority: priority,
                tags: params.event_tags
            }
        };

        Zendesk.createIssue(data, fields);
    }
    // Create issue for trigger-based events.
    else if (params.event_value === ''1'' && update.status === ''0'') {
        data = {
            ticket: {
                external_id: params.event_id,
                type: Zendesk.params.type,
                status: ''new'',
                subject: params.alert_subject,
                comment: {
                    body: params.zbxurl + (params.zbxurl.endsWith(''/'') ? '''' : ''/'') + ''tr_events.php?triggerid='' +
                        params.trigger_id + ''&eventid='' + params.event_id + ''\\n'' + params.alert_message,
                    public: ''false''
                },
                priority: priority,
                tags: params.event_tags
            }
        };
        var key = Zendesk.createIssue(data, fields);

        result.tags.__zbx_zdk_issuekey = key;
        result.tags.__zbx_zdk_issuelink = params.zendesk_url +
            (params.zendesk_url.endsWith(''/'') ? '''' : ''/'') + ''agent/tickets/'' + key;
    }
    // Update created issue for trigger-based event.
    else {
        data = {
            ticket: {
                type: Zendesk.params.type,
                subject: params.alert_subject,
                comment: {
                    body: params.alert_message,
                    public: ''false''
                }
            }
        };

        Zendesk.updateIssue(data, fields);
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[Zendesk Webhook] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_zdk_issuelink}','Zendesk: {EVENT.TAGS.__zbx_zdk_issuekey}','');

INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('19','4','Zammad','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Zammad = {
    params: {},

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        Zammad.params = params;
        if (typeof Zammad.params.url === ''string'') {
            if (!Zammad.params.url.endsWith(''/'')) {
                Zammad.params.url += ''/'';
            }
        }
    },

    request: function (method, query, data) {
        [''url'', ''access_token''].forEach(function (field) {
            if (typeof Zammad.params !== ''object'' || typeof Zammad.params[field] === ''undefined''
                || Zammad.params[field] === '''' ) {
                throw ''Required param is not set: "'' + field + ''".'';
            }
        });

        var response,
            url = Zammad.params.url + query,
            request = new CurlHttpRequest();

        if (typeof Zammad.HTTPProxy === ''string'' && Zammad.HTTPProxy.trim() !== '''') {
            request.SetProxy(Zammad.HTTPProxy);
        }

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''Authorization: Token token='' + Zammad.params.access_token);

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ Zammad Webhook ] Sending request: '' +
            url + ((typeof data === ''string'') ? ('' '' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ Zammad Webhook ] Received response with status code '' + request.Status() + '': '' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ Zammad Webhook ] Failed to parse response received from Zammad'');
                response = null;
            }
        }

        if (request.Status() < 200 || request.Status() >= 300) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null && typeof response.errors !== ''undefined''
                && Object.keys(response.errors).length > 0) {
                message += '': '' + JSON.stringify(response.errors);
            }
            else if (response !== null && typeof response.errorMessages !== ''undefined''
                && Object.keys(response.errorMessages).length > 0) {
                message += '': '' + JSON.stringify(response.errorMessages);
            }

            throw message + '' Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    setTicketTags: function(tags, ticket_id) {
        try {
            var tags_json = JSON.parse(tags),
                result;

            for (var i in tags_json) {
                result = Zammad.request(''get'',
                    ''/api/v1/tags/add?object=Ticket&o_id='' + ticket_id +
                    ''&item='' + tags_json[i].tag);

                if (typeof result.response !== ''object''
                    || result.status != 200) {
                    Zabbix.Log(4, ''[ Zammad Webhook ] Cannot add ticket tag:'' + tags_json[i].tag);
                }
            }
        }
        catch (error) {
            Zabbix.Log(4, ''[ Zammad Webhook ] Failed to add ticket tags:'' + error);
        }

        return;
    },

    createTicket: function(subject, message, priority) {
        var data = {
                title: subject,
                group: ''Users'',
                article: {
                    subject: subject,
                    body: message,
                    type: ''note'',
                    internal: false
                },
                customer: Zammad.params.customer
            },
            result;

        if (priority) {
            data.priority_id = priority;
        }

        result = Zammad.request(''post'', ''api/v1/tickets'', data);

        if (typeof result.response !== ''object''
            || typeof result.response.id === ''undefined''
            || result.status != 201) {
            throw ''Cannot create Zammad ticket. Check debug log for more information.'';
        }

        return result.response.id;
    },

    updateTicket: function(subject, message) {
        var data = {
            ticket_id: Zammad.params.ticket_id,
            subject: subject,
            body: message || '''',
            type: ''note'',
            internal: false
        };

        result = Zammad.request(''post'', ''api/v1/ticket_articles'', data);

        if (typeof result.response !== ''object''
            || typeof result.response.id === ''undefined''
            || result.status != 201) {
            throw ''Cannot update Zammad ticket. Check debug log for more information.'';
        }
    }
};

try {
    var params = JSON.parse(value),
        params_zammad = {},
        params_update = {},
        result = {tags: {}},
        required_params = [
            ''alert_subject'', ''customer'',
            ''event_source'', ''event_value'',
            ''event_update_status''
        ],
        severities = [
            {name: ''not_classified'', color: ''#97AAB3''},
            {name: ''information'', color: ''#7499FF''},
            {name: ''warning'', color: ''#FFC859''},
            {name: ''average'', color: ''#FFA059''},
            {name: ''high'', color: ''#E97659''},
            {name: ''disaster'', color: ''#E45959''},
            {name: ''resolved'', color: ''#009900''},
            {name: null, color: ''#000000''}
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (key.startsWith(''zammad_'')) {
                params_zammad[key.substring(7)] = params[key].trim();
            }
            else if (key.startsWith(''event_update_'')) {
                params_update[key.substring(13)] = params[key];
            }
            else if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter "'' + key + ''" cannot be empty.'';
            }
        });

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: '' + params.event_source + ''\\nMust be 0-3.'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_source !== ''0'' && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for trigger-based actions.'';
    }

    if (params.event_source === ''0''
        && ((params.event_value === ''1'' && params.event_update_status === ''1'')
            || (params.event_value === ''0''
                && (params.event_update_status === ''0'' || params.event_update_status === ''1'')))
        && (isNaN(parseInt(params.zammad_ticket_id)) || parseInt(params.zammad_ticket_id) < 1 )) {
        throw ''Incorrect "zammad_ticket_id" parameter given: '' + params.zammad_ticket_id +
            ''\\nMust be positive integer.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity].name];
    priority = priority && priority.trim() || severities[7].name;

    Zammad.setParams(params_zammad);
    Zammad.HTTPProxy = params.HTTPProxy;

    // Create ticket for non trigger-based events.
    if (params.event_source !== ''0''
        && params.event_value !== ''0'') {
        Zammad.createTicket(params.alert_subject, params.alert_message, priority, params.event_tags);
    }
    // Create ticket for trigger-based events.
    else if (params.event_value === ''1'' && params_update.status === ''0'') {
        var ticket_id = Zammad.createTicket(params.alert_subject,
            params.alert_subject + ''\\n'' + params.alert_message + ''\\n'' +
            params.zabbix_url + (params.zabbix_url.endsWith(''/'') ? '''' : ''/'') +
            ''tr_events.php?triggerid='' + params.trigger_id + ''&eventid='' + params.event_id + ''\\n'',
            priority);

        result.tags.__zbx_zammad_ticket_id = ticket_id;
        result.tags.__zbx_zammad_ticketlink = params.zammad_url +
            (params.zammad_url.endsWith(''/'') ? '''' : ''/'') + ''#ticket/zoom/'' + ticket_id;

        if (Zammad.params.enable_tags.toLowerCase() === ''true'') {
            Zammad.setTicketTags(params.event_tags, ticket_id);
        }
    }
    // Update created ticket for trigger-based event.
    else {
        Zammad.updateTicket(params.alert_subject, params.alert_message);
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[ Zammad Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_zammad_ticketlink}','Zammad: ticket #{EVENT.TAGS.__zbx_zammad_ticket_id}','');


INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('22','4','iLert','','','','','','','','0','25','0','0','0','0','','1','3','10s','1','try {
    var result = { tags: {} },
        params = JSON.parse(value),
        req = new CurlHttpRequest(),
        resp = '''';

    if (typeof params.HTTPProxy === ''string'' && params.HTTPProxy.trim() !== '''') {
        req.SetProxy(params.HTTPProxy);
    }
    var alertSourceKey = params[''.ILERT.ALERT.SOURCE.KEY''];
    if (!alertSourceKey || (typeof alertSourceKey === ''string'' && alertSourceKey.trim() === '''')) {
        throw ''incorrect value for variable "ILERT.ALERT.SOURCE.KEY". The value must be a non-empty string.'';
    }
    delete params[''.ILERT.ALERT.SOURCE.KEY''];
    
    var ilertApiBaseURL = "https://api.ilert.com";
    var reqURL = encodeURI(ilertApiBaseURL + "/api/v1/events/zabbix-mt/" + alertSourceKey)

    var incidentKey = "zabbix-" + params[''EVENT.ID''];
    var incidentViewURL = ilertApiBaseURL + "/api/v1/incidents/resolve-ik/" + alertSourceKey + "/" + incidentKey;

    req.AddHeader(''Accept: application/json'');
    req.AddHeader(''Content-Type: application/json'');

    Zabbix.Log(4, ''[iLert Webhook] Sending request:'' + JSON.stringify(params));
    resp = req.Post(reqURL, JSON.stringify(params));
    Zabbix.Log(4, ''[iLert Webhook] Receiving response:'' + resp);

    try {
        resp = JSON.parse(resp);
    }
    catch (error) {
        throw ''incorrect response. iLert returned a non-JSON object.'';
    }

    if (req.Status() == 200) {
        result.tags.__ilert_incident_url = incidentViewURL;
        return JSON.stringify(result);
    }

    if (req.Status() == 400 && typeof resp === ''object'' && typeof resp.code === ''string'') {
        if (resp.code === ''NO_OPEN_INCIDENT_WITH_KEY'') {
          return JSON.stringify(result);
        }
        if (resp.code === ''INCIDENT_ALREADY_ACCEPTED'') {
          result.tags.__ilert_incident_url = incidentViewURL;
          return JSON.stringify(result);
        }
    }

    if (typeof resp === ''object'' && typeof resp.message === ''string'') {
        throw resp.message;
    }
    else {
        throw ''Unknown error.'';
    }
}
catch (error) {
    Zabbix.Log(3, ''[iLert Webhook] Notification failed : '' + error);
    throw ''iLert notification failed : '' + error;
}','30s','1','1','{EVENT.TAGS.__ilert_incident_url}','iLert incident','Please refer to https://docs.ilert.com/integrations/zabbix/native 
  
Set global macro {$ZABBIX.URL} with your Zabbix server URL.
Add a dedicated user with the media type "iLert". You can also rewrite the incident summary via ".ILERT.INCIDENT.SUMMARY" parameter or leave it empty to use the standard pattern.');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('23','4','SolarWinds Service Desk','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var SolarWinds = {
    params: {},

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        SolarWinds.params = params;
        SolarWinds.params.endpoint = ''https://api.samanage.com/'';
    },

    setProxy: function (HTTPProxy) {
        SolarWinds.HTTPProxy = HTTPProxy;
    },

    addCustomFields: function (data, fields) {
        if (typeof data.incident === ''object'' && typeof fields === ''object'' && Object.keys(fields).length) {
            if (typeof fields.sw_fields === ''object'' && Object.keys(fields.sw_fields).length) {
                Object.keys(fields.sw_fields)
                    .forEach(function(field) {
                        try {
                            data.incident[field] = JSON.parse(fields.sw_fields[field]);
                        }
                        catch (error) {
                            data.incident[field] = fields.sw_fields[field];
                        }
                    });
            }

            if (typeof fields.sw_customfields === ''object'' && Object.keys(fields.sw_customfields).length) {
                data.incident.custom_fields_values = {custom_fields_value: []};
                Object.keys(fields.sw_customfields)
                    .forEach(function(field) {
                        data.incident.custom_fields_values.custom_fields_value.push({
                            name: field,
                            value: fields.sw_customfields[field]
                        });
                    });
            }
        }

        return data;
    },

    request: function (method, query, data) {
        [''token''].forEach(function (field) {
            if (typeof SolarWinds.params !== ''object'' || typeof SolarWinds.params[field] === ''undefined''
                || SolarWinds.params[field] === '''' ) {
                throw ''Required SolarWinds param is not set: "'' + field + ''".'';
            }
        });

        var response,
            url = SolarWinds.params.endpoint + query,
            request = new CurlHttpRequest();

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''X-Samanage-Authorization: Bearer '' + SolarWinds.params.token);
        request.AddHeader(''Accept: application/vnd.samanage.v2.1+json'');

        if (typeof SolarWinds.HTTPProxy !== ''undefined'' && SolarWinds.HTTPProxy !== '''') {
            request.SetProxy(SolarWinds.HTTPProxy);
        }

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ SolarWinds SD Webhook ] Sending request: '' + url + ((typeof data === ''string'')
            ? (''\\n'' + data)
            : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ SolarWinds SD Webhook ] Received response with status code '' + request.Status() +
            ''\\n'' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ SolarWinds SD Webhook ] Failed to parse response received from SolarWinds'');
                response = null;
            }
        }

        if (request.Status() < 200 || request.Status() >= 300) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null && typeof response.error !== ''undefined''
                && Object.keys(response.error).length > 0) {
                message += '': '' + JSON.stringify(response.error);
            }
            else if (response !== null && typeof response === ''object''
                && Object.keys(response).length > 0) {
                Object.keys(response)
                    .forEach(function(field) {
                        message += ''\\n'' + field + '': '' + response[field][0];
                    });
            }

            throw message + '' Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    createIncident: function(name, description, fields) {
        var data = {
            incident: {
                name: name,
                description: description,
                priority: SolarWinds.params.priority
            }
        };

        var result = SolarWinds.request(''post'', ''incidents.json'', SolarWinds.addCustomFields(data, fields));

        if (typeof result.response !== ''object'' || typeof result.response.id === ''undefined'') {
            throw ''Cannot create SolarWinds incident. Check debug log for more information.'';
        }

        return result.response.id;
    },

    updateIncident: function(name, fields, message) {
        var data = {
            incident: {
                name: name,
                priority: SolarWinds.params.priority
            }
        };

        SolarWinds.request(
            ''put'',
            ''incidents/'' + SolarWinds.params.incident_id + ''.json'',
            SolarWinds.addCustomFields(data, fields));

        SolarWinds.commenIncident(message);
    },

    commenIncident: function(message) {
        var data = {
            comment: {
                body: message
            }
        };

        SolarWinds.request(''post'', ''incidents/'' + SolarWinds.params.incident_id + ''/comments.json'', data);
    }
};

try {
    var params = JSON.parse(value),
        fields = {},
        samanage = {},
        result = {tags: {}},
        required_params = [''alert_subject'', ''event_recovery_value'', ''event_source'', ''event_value'', ''priority_default''],
        severities = [
            {name: ''not_classified''},
            {name: ''information''},
            {name: ''warning''},
            {name: ''average''},
            {name: ''high''},
            {name: ''disaster''},
            {name: ''resolved''},
            {name: ''default''}
        ];

    fields.sw_fields = {};
    fields.sw_customfields = {};

    Object.keys(params)
        .forEach(function (key) {
            if (key.startsWith(''samanage_'')) {
                samanage[key.substring(9)] = params[key];
            }
            else if (key.startsWith(''sw_field_'')) {
                fields.sw_fields[key.substring(9)] = params[key];
            }
            else if (key.startsWith(''sw_customfield_'')) {
                fields.sw_customfields[key.substring(15)] = params[key];
            }
            else if (required_params.indexOf(key) !== -1 && params[key] === '''') {
                throw ''Parameter "'' + key + ''" can\\''t be empty.'';
            }
        });

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: '' + params.event_source + ''\\nMust be 0-3.'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_update_status !== ''0'' && params.event_update_status !== ''1'' && params.event_source === ''0'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_source !== ''0'' && params.event_recovery_value === ''0'') {
        throw ''Recovery operations are supported only for trigger-based actions.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    samanage.priority = params[''priority_'' + severities[params.event_nseverity].name] || params.priority_default;

    SolarWinds.setParams(samanage);
    SolarWinds.setProxy(params.HTTPProxy);

    // Create incident for non trigger-based events.
    if (params.event_source !== ''0'' && params.event_recovery_value !== ''0'') {
        SolarWinds.createIncident(params.alert_subject, params.alert_message);
    }
    // Create incident for trigger-based events.
    else if (params.event_value === ''1'' && params.event_update_status === ''0''
            && samanage.incident_id === ''{EVENT.TAGS.__zbx_solarwinds_inc_id}'') {
        var key = SolarWinds.createIncident(params.alert_subject, params.alert_message, fields);


        result.tags.__zbx_solarwinds_inc_id = key;
        result.tags.__zbx_solarwinds_inc_link = params.samanage_url +
            (params.samanage_url.endsWith(''/'') ? '''' : ''/'') + ''incidents/'' + key;
    }
    // Update created incident for trigger-based event.
    else {
        if (samanage.incident_id === ''{EVENT.TAGS.__zbx_solarwinds_inc_id}'' || samanage.incident_id === '''') {
            throw ''Incorrect incident key given: '' + samanage.incident_id;
        }
        if (!params.alert_message) {
            throw ''Parameter "alert_message" can\\''t be empty.'';
        }
        SolarWinds.updateIncident(params.alert_subject, fields, params.alert_message);
    }

    if (params.event_source === ''0'') {
        return JSON.stringify(result);
    }
    else {
        return ''OK'';
    }
}
catch (error) {
    Zabbix.Log(3, ''[ SolarWinds SD Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_solarwinds_inc_link}','SolarWinds incident ID: {EVENT.TAGS.__zbx_solarwinds_inc_id}','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('24','4','SysAid','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var SysAid = {
    params: {},

    setParams: function (params) {
        var required = [''url'', ''auth_user'', ''auth_password'', ''category_level_1'', ''category_level_2'',
            ''category_level_3'', ''incident_id'', ''template_id'', ''urgency_id'', ''incident_state'',
            ''default_priority_id''
        ];

        required.forEach(function (field) {
            if (typeof params !== ''object'' || typeof params[field] === ''undefined'' || params[field] === '''') {
                throw ''Required param is not set: "'' + field + ''".'';
            }
        });

        SysAid.params = params;
        if (typeof SysAid.params.url === ''string'' && !SysAid.params.url.endsWith(''/'')) {
            SysAid.params.url += ''/'';
        }
    },

    login: function () {
        var result = SysAid.request(''post'', ''api/v1/login'', {
            user_name: SysAid.params.auth_user,
            password: SysAid.params.auth_password
        });

        return result.response.user.id;
    },

    request: function (method, query, data) {
        var response,
            request = SysAid.req || (SysAid.req = new CurlHttpRequest()),
            url = SysAid.params.url + query;

        if (typeof SysAid.HTTPProxy !== ''undefined'' && SysAid.HTTPProxy.trim() !== '''') {
            request.SetProxy(SysAid.HTTPProxy);
        }

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ SysAid Webhook ] Sending request: '' +
            url + ((typeof data === ''string'') ? ('' '' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ SysAid Webhook ] Received response with status code '' + request.Status() + '': '' + response);

        if (request.Status() !== 200) {
            var message = ''Request failed with status code '' + request.Status();

            message += '': '' + response;
            throw message + '' Check debug log for more information.'';
        }

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ SysAid Webhook ] Failed to parse response received from SysAid'');
                response = null;
            }
        }

        if (response === null || (typeof response.Error !== ''undefined'' && Object.keys(response.Error).length > 0)) {
            throw ''Request failed: '' + JSON.stringify(response.Error);
        }

        return {
            status: request.Status(),
            response: response
        };
    },

    createIncident: function(subject, message, priority) {
        var result = SysAid.request(''post'', ''api/v1/sr/?template='' + encodeURIComponent(SysAid.params.template_id), {
            info: [
                {
                    key: ''problem_type'',
                    value: [
                        SysAid.params.category_level_1,
                        SysAid.params.category_level_2,
                        SysAid.params.category_level_3
                    ].join(''_'')
                },
                {
                    key: ''title'',
                    value: subject
                },
                {
                    key: ''description'',
                    value: message
                },
                {
                    key: ''status'',
                    value: ''1''
                },
                {
                    key: ''urgency'',
                    value: SysAid.params.urgency_id
                },
                {
                    key: ''priority'',
                    value: priority || SysAid.params.default_priority_id,
                }
            ]
        });

        if (result.response.id === ''undefined'') {
            throw ''Cannot create SysAid incident. Check debug log for more information.'';
        }

        return result.response.id;
    },

    updateTicket: function(note) {
        var date = new Date().getTime();

        SysAid.request(''put'', ''api/v1/sr/'' + encodeURIComponent(SysAid.params.incident_id), {
            id: SysAid.params.incident_id,
            info: [
                {
                    key: ''update_time'',
                    value: date
                },
                {
                    key: ''notes'',
                    value: [
                        {
                            userName: ''Zabbix'',
                            createDate: date,
                            text: note
                        }
                    ]
                }
            ]
        });
    }
};

try {
    var params = JSON.parse(value),
        params_sysaid = {},
        params_update = {},
        result = {tags: {}},
        required_params = [''alert_subject'', ''event_source'', ''event_value'',  ''event_update_status''],
        severities = [
            {name: ''not_classified'', color: ''#97AAB3''},
            {name: ''information'', color: ''#7499FF''},
            {name: ''warning'', color: ''#FFC859''},
            {name: ''average'', color: ''#FFA059''},
            {name: ''high'', color: ''#E97659''},
            {name: ''disaster'', color: ''#E45959''},
            {name: ''resolved'', color: ''#009900''},
            {name: null, color: ''#000000''}
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (key.startsWith(''sysaid_'')) {
                params_sysaid[key.substring(7)] = params[key];
            }
            else if (key.startsWith(''event_update_'')) {
                params_update[key.substring(13)] = params[key];
            }
            else if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter "'' + key + ''" cannot be empty.'';
            }
        });

    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: '' + params.event_source + ''\\nMust be 0-3.'';
    }

    // Check {EVENT.VALUE} for trigger-based and internal events.
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check {EVENT.UPDATE.STATUS} only for trigger-based events.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    if (params.event_source !== ''0'' && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for trigger-based actions.'';
    }

    if (params.event_source === ''0'' && ((params.event_value === ''1'' && params.event_update_status === ''1'')
            || (params.event_value === ''0'' && (params.event_update_status === ''0'' || params.event_update_status === ''1'')))
            && (isNaN(parseInt(params.sysaid_incident_id)) || parseInt(params.sysaid_incident_id) < 1 )) {
        throw ''Incorrect "sysaid_incident_id" parameter given: '' + params.sysaid_incident_id + ''\\nMust be positive integer.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity].name];
    priority = priority && priority.trim() || severities[7].name;

    SysAid.setParams(params_sysaid);
    SysAid.HTTPProxy = params.HTTPProxy;
    SysAid.login();

    if (params.event_source !== ''0'' && params.event_value !== ''0'') {
        // Create ticket for non trigger-based events.
        SysAid.createIncident(params.alert_subject, params.alert_message, priority);
    }
    else if (params.event_value === ''1'' && params_update.status === ''0'') {
        // Create ticket for trigger-based events.
        var incident_id = SysAid.createIncident(params.alert_subject, params.alert_subject + ''\\n'' + params.alert_message +
                ''\\n'' + params.zabbix_url + (params.zabbix_url.endsWith(''/'') ? '''' : ''/'') + ''tr_events.php?triggerid='' +
                params.trigger_id + ''&eventid='' + params.event_id + ''\\n'', priority
        );

        result.tags.__zbx_sysaid_incident_id = incident_id;
        result.tags.__zbx_sysaid_incidentlink = params.sysaid_url +
            (params.sysaid_url.endsWith(''/'') ? '''' : ''/'') + ''SREdit.jsp?id='' + incident_id + ''&fromId=IncidentsList'';
    }
    else {
        // Update created ticket for trigger-based event.
        SysAid.updateTicket(params.alert_subject + ''\\n'' + params.alert_message);
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[ SysAid Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_sysaid_incidentlink}','SysAid: incident #{EVENT.TAGS.__zbx_sysaid_incident_id}','');
INSERT INTO media_type (mediatypeid,type,name,smtp_server,smtp_helo,smtp_email,exec_path,gsm_modem,username,passwd,status,smtp_port,smtp_security,smtp_verify_peer,smtp_verify_host,smtp_authentication,exec_params,maxsessions,maxattempts,attempt_interval,content_type,script,timeout,process_tags,show_event_menu,event_menu_url,event_menu_name,description) values ('25','4','TOPdesk','','','','','','','','0','25','0','0','0','0','','1','3','10s','1',E'var Media = {
    params: {},
    name: '''',
    labels: [],
    HTTPProxy: '''',

    setParams: function (params) {
        if (typeof params !== ''object'') {
            return;
        }

        Media.params = params;
        Media.params.api += Media.params.api.endsWith(''/'') ? '''' : ''/'';
    },

    setProxy: function (HTTPProxy) {
        if (typeof HTTPProxy !== ''undefined'' && HTTPProxy.trim() !== '''') {
            Media.HTTPProxy = HTTPProxy;
        }
    },

    request: function (method, query, data) {
        [''api'', ''token''].forEach(function (field) {
            if (typeof Media.params !== ''object'' || typeof Media.params[field] === ''undefined''
                    || Media.params[field] === '''') {
                throw ''Required '' + Media.name + '' param is not set: "'' + field + ''".'';
            }
        });

        var response,
            url = Media.params.api + query,
            request = new CurlHttpRequest();

        request.AddHeader(''Content-Type: application/json'');
        request.AddHeader(''Accept: application/json'');
        request.AddHeader(''Authorization: '' + Media.params.token);
        request.SetProxy(Media.HTTPProxy);

        if (typeof data !== ''undefined'') {
            data = JSON.stringify(data);
        }

        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Sending request: '' +
            url + ((typeof data === ''string'') ? (''\\n'' + data) : ''''));

        switch (method) {
            case ''get'':
                response = request.Get(url, data);
                break;

            case ''post'':
                response = request.Post(url, data);
                break;

            case ''put'':
                response = request.Put(url, data);
                break;

            default:
                throw ''Unsupported HTTP request method: '' + method;
        }

        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Received response with status code '' +
            request.Status() + ''\\n'' + response);

        if (response !== null) {
            try {
                response = JSON.parse(response);
            }
            catch (error) {
                Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Failed to parse response.'');
                response = null;
            }
        }

        if (request.Status() < 200 || request.Status() >= 300) {
            var message = ''Request failed with status code '' + request.Status();

            if (response !== null) {
                if (typeof response.errors === ''object'' && Object.keys(response.errors).length > 0) {
                    message += '': '' + JSON.stringify(response.errors);
                }
                else if (typeof response.errorMessages === ''object'' && Object.keys(response.errorMessages).length > 0) {
                    message += '': '' + JSON.stringify(response.errorMessages);
                }
                else if (typeof response.message === ''string'') {
                    message += '': '' + response.message;
                }
            }

            throw message + '' Check debug log for more information.'';
        }

        return {
            status: request.Status(),
            response: response
        };
    }
};

try {
    var result = {tags: {}},
        params = JSON.parse(value),
        media = {},
        fields = {},
        resp = {},
        required_params = [
            ''alert_subject'',
            ''alert_message'',
            ''event_id'',
            ''event_source'',
            ''event_value'',
            ''event_update_status'',
            ''topdesk_api'',
            ''topdesk_user'',
            ''topdesk_password''
        ],
        severities = [
            ''not_classified'',
            ''information'',
            ''warning'',
            ''average'',
            ''high'',
            ''disaster'',
            ''resolved'',
            ''default''
        ],
        priority;

    Object.keys(params)
        .forEach(function (key) {
            if (required_params.indexOf(key) !== -1 && params[key].trim() === '''') {
                throw ''Parameter "'' + key + ''" cannot be empty.'';
            }
            if (key.startsWith(''topdesk_'')) {
                media[key.substring(8)] = params[key];
            }
        });

    // Possible values of event_source:
    // 0 - Trigger, 1 - Discovery, 2 - Autoregistration, 3 - Internal.
    if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
        throw ''Incorrect "event_source" parameter given: "'' + params.event_source + ''".\\nMust be 0-3.'';
    }

    // Check event_value for trigger-based and internal events.
    // Possible values: 1 for problem, 0 for recovering
    if (params.event_value !== ''0'' && params.event_value !== ''1''
        && (params.event_source === ''0'' || params.event_source === ''3'')) {
        throw ''Incorrect "event_value" parameter given: '' + params.event_value + ''\\nMust be 0 or 1.'';
    }

    // Check event_update_status only for trigger-based events.
    // Possible values: 0 - Webhook was called because of problem/recovery event, 1 - Update operation.
    if (params.event_source === ''0'' && params.event_update_status !== ''0'' && params.event_update_status !== ''1'') {
        throw ''Incorrect "event_update_status" parameter given: '' + params.event_update_status + ''\\nMust be 0 or 1.'';
    }

    // Check event_id for a numeric value.
    if (isNaN(parseInt(params.event_id)) || params.event_id < 1) {
        throw ''Incorrect "event_id" parameter given: '' + params.event_id + ''\\nMust be a positive number.'';
    }

    if ((params.event_source === ''1'' || params.event_source === ''2'')  && params.event_value === ''0'') {
        throw ''Recovery operations are supported only for Trigger and Internal actions.'';
    }

    if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
        params.event_nseverity = ''7'';
    }

    if (params.event_value === ''0'') {
        params.event_nseverity = ''6'';
    }

    priority = params[''severity_'' + severities[params.event_nseverity]];
    params.zbxurl = params.zbxurl + (params.zbxurl.endsWith(''/'') ? '''' : ''/'');

    Media.name = ''TOPdesk'';
    Media.setParams(media);
    Media.params.token = ''Basic '' + btoa(Media.params.user + '':'' + Media.params.password);
    Media.setProxy(params.HTTPProxy);

    // Create an issue.
    // Numeric value of the event that triggered an action (1 for problem, 0 for recovering).
    // Numeric value of of the problem update status. Possible values:
    // 0 - Webhook was called because of problem/recovery event, 1 - Update operation.
    if ((params.event_source == 0 && params.event_value == 1 && params.event_update_status == 0)
            || (params.event_source == 3 && params.event_value == 1)
            || params.event_source == 1 || params.event_source == 2) {
        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Request of the ticket creating.'');
        fields.caller = {dynamicName: ''Zabbix''};
        fields.briefDescription = params.alert_subject;
        fields.request = params.alert_message.replace(/\\n/g, ''<br>'');
        fields.priority = {name: priority};
        fields.processingStatus = {name: Media.params.status};
        fields.externalNumber = params.event_id;
        fields.request += ''<br>'' + params.zbxurl;

        if (params.event_source === ''0'') {
            fields.request += ''tr_events.php?triggerid='' + params.trigger_id + ''&eventid='' + params.event_id;
        }

        resp = Media.request(''post'', ''tas/api/incidents'', fields);
        if (typeof resp.response !== ''object'' || typeof resp.response.id === ''undefined'') {
            throw ''Cannot create '' + Media.name + '' issue. Check debug log for more information.'';
        }

        if (params.event_source == 0 && params.event_value == 1 && params.event_update_status == 0) {
            result.tags.__zbx_tpd_issuekey = resp.response.number;
            result.tags.__zbx_tpd_issuelink = Media.params.api +
                ''tas/secure/incident?action=show&unid='' + resp.response.id;
        }
    }
    // Update a created issue.
    else {
        if (params.event_source == 3 && params.event_value == 0) {
            throw ''Internal event recovery actions are not supported.'';
        }

        Zabbix.Log(4, ''[ '' + Media.name + '' Webhook ] Request of the ticket updating.'');
        fields.action = params.alert_message.replace(/\\n/g, ''<br>'');

        resp = Media.request(''put'', ''tas/api/incidents/number/'' + Media.params.issue_key, fields);
        if (typeof resp.response !== ''object'' || typeof resp.response.id === ''undefined''
                || resp.response.number !== Media.params.issue_key) {
            throw ''Cannot update '' + Media.name + '' issue. Check debug log for more information.'';
        }
    }

    return JSON.stringify(result);
}
catch (error) {
    Zabbix.Log(3, ''[ '' + Media.name + '' Webhook ] ERROR: '' + error);
    throw ''Sending failed: '' + error;
}','30s','1','1','{EVENT.TAGS.__zbx_tpd_issuelink}','TOPdesk: {EVENT.TAGS.__zbx_tpd_issuekey}','Please refer to https://developers.topdesk.com/documentation/index.html and https://www.zabbix.com/documentation/current/manual/config/notifications/media/webhook#example_scripts.
  
Set global macro {$ZABBIX.URL} with your Zabbix server URL.
Add a dedicated user with the media type "TOPdesk".
Change the values of the variables topdesk_api (URL), topdesk_password, topdesk_user. The topdesk_status is the default status for creating a new TOPdesk ticket.');

INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('1','5','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('2','5','bot_token','<YOUR BOT TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('3','5','mattermost_url','<YOUR MATTERMOST URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('4','5','send_mode','alarm');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('5','5','send_to','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('6','5','event_tags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('8','5','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('10','5','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('11','5','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('12','5','event_date','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('13','5','event_time','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('14','5','event_severity','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('15','5','event_opdata','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('16','5','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('18','5','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('19','5','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('20','5','host_name','{HOST.HOST}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('21','5','host_ip','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('22','5','event_update_date','{EVENT.UPDATE.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('23','5','event_update_time','{EVENT.UPDATE.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('24','5','event_recovery_date','{EVENT.RECOVERY.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('25','5','event_recovery_time','{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('37','6','zbxurl','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('39','7','token','<put your key>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('40','7','eventid','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('41','7','eventname','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('42','7','hostname','{HOST.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('43','7','hostip','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('44','7','severity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('45','7','triggerdesc','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('46','7','triggeropdata','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('47','7','eventtags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('48','7','triggerid','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('49','7','eventdate','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('50','7','eventtime','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('52','7','eventack','{EVENT.ACK.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('53','7','eventupdate','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('54','7','eventvalue','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('55','7','url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('56','8','token','<PUSHOVER TOKEN HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('57','8','user','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('58','8','message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('59','8','title','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('60','8','url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('61','8','url_title','Zabbix');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('63','8','eventid','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('64','8','triggerid','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('65','9','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('66','9','bot_token','<PLACE YOUR KEY HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('67','9','channel','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('68','9','slack_mode','alarm');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('69','9','slack_as_user','true');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('71','9','event_tags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('73','9','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('75','9','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('76','9','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('77','9','event_date','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('78','9','event_time','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('79','9','event_severity','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('80','9','event_opdata','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('81','9','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('83','9','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('84','9','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('85','9','host_name','{HOST.HOST}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('87','9','event_update_date','{EVENT.UPDATE.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('88','9','event_update_time','{EVENT.UPDATE.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('89','9','event_recovery_date','{EVENT.RECOVERY.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('90','9','event_recovery_time','{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('91','10','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('92','10','discord_endpoint','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('93','10','use_default_message','false');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('94','10','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('95','10','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('96','10','event_name','{EVENT.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('97','10','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('98','10','event_severity','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('99','10','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('100','10','event_opdata','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('101','10','event_tags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('102','10','event_time','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('103','10','event_date','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('104','10','event_recovery_date','{EVENT.RECOVERY.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('105','10','event_recovery_time','{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('106','10','event_update_date','{EVENT.UPDATE.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('107','10','event_update_time','{EVENT.UPDATE.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('108','10','event_update_action','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('109','10','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('110','10','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('111','10','event_update_user','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('112','10','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('113','10','host_ip','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('114','10','host_name','{HOST.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('115','10','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('116','10','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('117','8','endpoint','https://api.pushover.net/1/messages.json');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('118','8','retry','60');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('119','8','expire','1200');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('120','11','teamsecret','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('121','11','Subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('122','11','Message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('123','11','Severity','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('125','11','Hostname','{HOST.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('127','12','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('128','12','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('129','12','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('130','12','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('131','12','event_tags_json','{EVENT.TAGSJSON}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('132','12','event_update_action','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('133','12','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('134','12','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('135','12','event_update_user','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('136','12','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('137','12','jira_issue_key','{EVENT.TAGS.__zbx_jira_issuekey}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('138','12','jira_issue_type','<PLACE ISSUETYPE NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('139','12','jira_password','<PLACE PASSWORD OR TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('140','12','jira_project_key','<PLACE PROJECT KEY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('141','12','jira_url','<PLACE YOUR JIRA URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('142','12','jira_user','<PLACE LOGIN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('143','12','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('144','13','<''DATETIME'' CUSTOMFIELD FOR EVENT RECOVERY TIME>','{EVENT.RECOVERY.DATE}T{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('145','13','<''DATETIME'' CUSTOMFIELD FOR EVENT TIME>','{EVENT.DATE}T{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('146','13','<''NUMBER'' CUSTOMFIELD FOR EVENT.ID>','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('147','13','<''NUMBER'' CUSTOMFIELD FOR TRIGGER.ID>','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('148','13',E'<''STRING'' CUSTOMFIELD FOR HOST\\IP>','{HOST.HOST} [{HOST.IP}]');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('149','13','<''STRING'' CUSTOMFIELD FOR OPERATIONAL DATA>','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('150','13','<''STRING'' CUSTOMFIELD FOR SEVERITY>','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('151','13','<''URL'' CUSTOMFIELD FOR EVENT URL>','{$ZABBIX.URL}/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('152','13','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('153','13','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('154','13','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('155','13','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('156','13','event_tags_json','{EVENT.TAGSJSON}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('157','13','event_update_action','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('158','13','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('159','13','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('160','13','event_update_user','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('161','13','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('162','13','jira_issue_key','{EVENT.TAGS.__zbx_jira_issuekey}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('163','13','jira_issue_type','<PLACE ISSUETYPE NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('164','13','jira_password','<PLACE PASSWORD OR TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('165','13','jira_project_key','<PLACE PROJECT KEY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('166','13','jira_url','<PLACE YOUR JIRA URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('167','13','jira_user','<PLACE LOGIN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('168','13','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('169','14','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('170','14','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('171','14','event_date','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('172','14','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('173','14','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('174','14','event_opdata','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('175','14','event_recovery_date','{EVENT.RECOVERY.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('176','14','event_recovery_time','{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('177','14','event_severity','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('178','14','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('179','14','event_status','{EVENT.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('180','14','event_tags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('181','14','event_time','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('182','14','event_update_action','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('183','14','event_update_date','{EVENT.UPDATE.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('184','14','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('185','14','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('186','14','event_update_time','{EVENT.UPDATE.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('187','14','event_update_user','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('188','14','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('189','14','host_ip','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('190','14','host_name','{HOST.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('191','14','teams_endpoint','<PLACE WEBHOOK URL HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('192','14','trigger_description','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('193','14','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('194','14','use_default_message','false');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('195','14','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('196','15','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('197','15','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('198','15','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('199','15','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('200','15','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('201','15','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('202','15','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('203','15','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('204','15','redmine_access_key','<PUT YOUR ACCESS KEY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('205','15','redmine_issue_key','{EVENT.TAGS.__zbx_redmine_issue_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('206','15','redmine_project','<PUT YOUR PROJECT ID OR NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('207','15','redmine_tracker_id','<PUT YOUR TRACKER ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('208','15','redmine_url','<PUT YOUR REDMINE URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('209','15','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('210','15','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('211','16','Message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('212','16','ParseMode','');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('213','16','Subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('214','16','To','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('215','16','Token','<PLACE YOUR TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('216','17','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('217','17','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('218','17','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('219','17','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('220','17','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('221','17','event_tags','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('222','17','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('223','17','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('224','17','severity_average','normal');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('225','17','severity_default','-');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('226','17','severity_disaster','urgent');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('227','17','severity_high','high');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('228','17','severity_information','low');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('229','17','severity_not_classified','low');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('230','17','severity_warning','normal');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('231','17','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('232','17','zbxurl','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('233','17','zendesk_issue_key','{EVENT.TAGS.__zbx_zdk_issuekey}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('234','17','zendesk_token','<put your {enduser_email_address}/token:{api_token}>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('235','17','zendesk_type','incident');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('236','17','zendesk_url','<put your Zendesk URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('237','18','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('238','18','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('239','18','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('240','18','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('241','18','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('242','18','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('243','18','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('244','18','servicenow_password','<PLACE PASSWORD HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('245','18','servicenow_sys_id','{EVENT.TAGS.__zbx_servicenow_sys_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('246','18','servicenow_url','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('247','18','servicenow_user','<PLACE USERNAME HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('248','18','urgency_for_average','2');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('249','18','urgency_for_disaster','1');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('250','18','urgency_for_high','2');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('251','18','urgency_for_information','3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('252','18','urgency_for_not_classified','3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('253','18','urgency_for_warning','3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('254','19','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('255','19','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('256','19','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('257','19','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('258','19','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('259','19','event_tags','{EVENT.TAGSJSON}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('260','19','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('261','19','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('262','19','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('263','19','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('264','19','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('265','19','zammad_access_token','<PUT YOUR ACCESS TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('266','19','zammad_customer','<PUT YOUR CUSTOMER EMAIL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('267','19','zammad_enable_tags','true');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('268','19','zammad_ticket_id','{EVENT.TAGS.__zbx_zammad_ticket_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('269','19','zammad_url','<PUT YOUR ZAMMAD URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('270','20','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('271','20','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('272','20','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('273','20','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('274','20','event_tags_json','{EVENT.TAGSJSON}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('275','20','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('276','20','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('277','20','jira_password','<PLACE PASSWORD OR TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('278','20','jira_request_key','{EVENT.TAGS.__zbx_jira_requestkey}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('279','20','jira_request_type_id','<PLACE REQUEST TYPE ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('280','20','jira_servicedesk_id','<PLACE SERVICEDESK ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('281','20','jira_url','<PLACE YOUR JIRA URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('282','20','jira_user','<PLACE LOGIN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('283','21','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('284','21','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('285','21','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('286','21','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('287','21','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('288','21','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('289','21','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('290','21','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('291','21','otrs_auth_password','<PUT YOUR USER PASSWORD>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('292','21','otrs_auth_user','<PUT YOUR USER NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('293','21','otrs_customer','<PUT YOUR CUSTOMER EMAIL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('294','21','otrs_default_priority_id','3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('295','21','otrs_queue','<PUT YOUR QUEUE NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('296','21','otrs_ticket_id','{EVENT.TAGS.__zbx_otrs_ticket_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('297','21','otrs_ticket_state','new');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('298','21','otrs_time_unit','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('299','21','otrs_url','<PUT YOUR OTRS URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('300','21','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('301','21','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('302','11','Event_Ack_Status','{EVENT.ACK.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('303','11','Event_Date_Time','{EVENT.DATE} {EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('304','11','Event_ID','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('305','11','Event_Update_Action','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('306','11','Event_Update_Status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('307','11','Host_IP','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('308','11','Trigger_ID','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('309','11','Trigger_Status','{TRIGGER.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('310','11','User','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('311','11','Zabbix_URL','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('312','10','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('313','22','.ILERT.ALERT.SOURCE.KEY','{ALERT.SENDTO}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('314','22','.ILERT.INCIDENT.SUMMARY','');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('315','22','ALERT.MESSAGE','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('316','22','ALERT.SUBJECT','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('317','22','EVENT.ACK.STATUS','{EVENT.ACK.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('318','22','EVENT.DATE','{EVENT.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('319','22','EVENT.ID','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('320','22','EVENT.NAME','{EVENT.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('321','22','EVENT.NSEVERITY','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('322','22','EVENT.OPDATA','{EVENT.OPDATA}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('323','22','EVENT.RECOVERY.DATE','{EVENT.RECOVERY.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('324','22','EVENT.RECOVERY.TIME','{EVENT.RECOVERY.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('325','22','EVENT.RECOVERY.VALUE','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('326','22','EVENT.SEVERITY','{EVENT.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('327','22','EVENT.TAGS','{EVENT.TAGS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('328','22','EVENT.TIME','{EVENT.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('329','22','EVENT.UPDATE.ACTION','{EVENT.UPDATE.ACTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('330','22','EVENT.UPDATE.DATE','{EVENT.UPDATE.DATE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('331','22','EVENT.UPDATE.MESSAGE','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('332','22','EVENT.UPDATE.STATUS','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('333','22','EVENT.UPDATE.TIME','{EVENT.UPDATE.TIME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('334','22','EVENT.VALUE','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('335','22','HOST.HOST','{HOST.HOST}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('336','22','HOST.IP','{HOST.IP}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('337','22','HOST.NAME','{HOST.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('338','22','ITEM.ID1','{ITEM.ID1}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('339','22','ITEM.ID2','{ITEM.ID2}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('340','22','ITEM.ID3','{ITEM.ID3}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('341','22','ITEM.ID4','{ITEM.ID4}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('342','22','ITEM.ID5','{ITEM.ID5}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('343','22','ITEM.NAME1','{ITEM.NAME1}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('344','22','ITEM.NAME2','{ITEM.NAME2}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('345','22','ITEM.NAME3','{ITEM.NAME3}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('346','22','ITEM.NAME4','{ITEM.NAME4}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('347','22','ITEM.NAME5','{ITEM.NAME5}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('348','22','TRIGGER.DESCRIPTION','{TRIGGER.DESCRIPTION}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('349','22','TRIGGER.ID','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('350','22','TRIGGER.NAME','{TRIGGER.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('351','22','TRIGGER.SEVERITY','{TRIGGER.SEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('352','22','TRIGGER.STATUS','{TRIGGER.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('353','22','TRIGGER.URL','{TRIGGER.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('354','22','TRIGGER.VALUE','{TRIGGER.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('355','22','USER.FULLNAME','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('356','22','ZABBIX.URL','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('357','5','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('358','5','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('359','5','discovery_host_dns','{DISCOVERY.DEVICE.DNS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('360','5','discovery_host_ip','{DISCOVERY.DEVICE.IPADDRESS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('361','5','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('362','6','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('363','6','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('364','6','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('365','6','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('366','6','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('367','6','event_tags_json','{EVENT.TAGSJSON}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('368','6','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('369','6','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('370','6','opsgenie_api','<put your opsgenie api>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('371','6','opsgenie_tags','');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('372','6','opsgenie_teams','');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('373','6','opsgenie_token','<put your token>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('374','6','opsgenie_web','<put your opsgenie web>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('375','6','severity_average','P3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('376','6','severity_default','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('377','6','severity_disaster','P1');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('378','6','severity_high','P2');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('379','6','severity_information','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('380','6','severity_not_classified','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('381','6','severity_warning','P4');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('382','6','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('383','6','zbxuser','{USER.FULLNAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('384','7','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('385','7','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('386','8','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('387','8','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('388','8','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('389','8','priority_average','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('390','8','priority_default','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('391','8','priority_disaster','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('392','8','priority_high','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('393','8','priority_information','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('394','8','priority_not_classified','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('395','8','priority_warning','0');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('396','9','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('397','9','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('398','9','discovery_host_dns','{DISCOVERY.DEVICE.DNS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('399','9','discovery_host_ip','{DISCOVERY.DEVICE.IPADDRESS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('400','9','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('401','9','host_conn','{HOST.CONN}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('402','23','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('403','23','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('404','23','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('405','23','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('406','23','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('407','23','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('408','23','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('409','23','priority_average','Medium');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('410','23','priority_default','Low');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('411','23','priority_disaster','Critical');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('412','23','priority_high','High');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('413','23','samanage_incident_id','{EVENT.TAGS.__zbx_solarwinds_inc_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('414','23','samanage_token','<PUT YOUR TOKEN HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('415','23','samanage_url','<PUT YOUR INSTANCE URL HERE>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('416','24','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('417','24','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('418','24','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('419','24','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('420','24','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('421','24','event_update_message','{EVENT.UPDATE.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('422','24','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('423','24','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('424','24','sysaid_auth_password','<PUT YOUR USER PASSWORD>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('425','24','sysaid_auth_user','<PUT YOUR USER NAME>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('426','24','sysaid_category_level_1','<PUT YOUR CATEGORY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('427','24','sysaid_category_level_2','<PUT YOUR SUB-CATEGORY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('428','24','sysaid_category_level_3','<PUT YOUR THIRD LEVEL CATEGORY>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('429','24','sysaid_default_priority_id','1');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('430','24','sysaid_incident_id','{EVENT.TAGS.__zbx_sysaid_incident_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('431','24','sysaid_incident_state','1');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('432','24','sysaid_template_id','<PUT YOUR TEMPLATE ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('433','24','sysaid_urgency_id','<PUT YOUR URGENCY ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('434','24','sysaid_url','<PUT YOUR SYSAID URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('435','24','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('436','24','zabbix_url','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('437','25','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('438','25','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('439','25','event_id','{EVENT.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('440','25','event_nseverity','{EVENT.NSEVERITY}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('441','25','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('442','25','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('443','25','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('444','25','severity_average','P3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('445','25','severity_default','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('446','25','severity_disaster','P1');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('447','25','severity_high','P2');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('448','25','severity_information','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('449','25','severity_not_classified','P5');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('450','25','severity_warning','P4');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('451','25','topdesk_api','<put your TOPdesk API URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('452','25','topdesk_issue_key','{EVENT.TAGS.__zbx_tpd_issuekey}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('453','25','topdesk_password','<put your TOPdesk application password>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('454','25','topdesk_status','<put default status for new tickets>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('455','25','topdesk_user','<put your TOPdesk username>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('456','25','trigger_id','{TRIGGER.ID}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('457','25','zbxurl','{$ZABBIX.URL}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('458','26','alert_message','{ALERT.MESSAGE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('459','26','alert_subject','{ALERT.SUBJECT}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('460','26','event_recovery_value','{EVENT.RECOVERY.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('461','26','event_source','{EVENT.SOURCE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('462','26','event_update_status','{EVENT.UPDATE.STATUS}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('463','26','event_value','{EVENT.VALUE}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('464','26','itop_api_version','1.3');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('465','26','itop_class','UserRequest');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('466','26','itop_comment','Created by Zabbix action {ACTION.NAME}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('467','26','itop_id','{EVENT.TAGS.__zbx_itop_id}');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('468','26','itop_log','private_log');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('469','26','itop_organization_id','<PLACE ORGANIZATION ID>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('470','26','itop_password','<PLACE PASSWORD OR TOKEN>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('471','26','itop_url','<PLACE YOUR ITOP URL>');
INSERT INTO media_type_param (mediatype_paramid,mediatypeid,name,value) values ('472','26','itop_user','<PLACE LOGIN>');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('1','1','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('2','1','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('3','1','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('4','1','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('5','1','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('6','3','0','0','','{EVENT.SEVERITY}: {EVENT.NAME}
Host: {HOST.NAME}
{EVENT.DATE} {EVENT.TIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('7','3','0','1','','Resolved in {EVENT.DURATION}: {EVENT.NAME}
Host: {HOST.NAME}
{EVENT.DATE} {EVENT.TIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('8','3','0','2','','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem in {EVENT.AGE} at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('9','3','1','0','','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('10','3','2','0','','Autoregistration: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('11','4','0','0','Problem: {EVENT.NAME}','<b>Problem started</b> at {EVENT.TIME} on {EVENT.DATE}<br><b>Problem name:</b> {EVENT.NAME}<br><b>Host:</b> {HOST.NAME}<br><b>Severity:</b> {EVENT.SEVERITY}<br><b>Operational data:</b> {EVENT.OPDATA}<br><b>Original problem ID:</b> {EVENT.ID}<br>{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('12','4','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','<b>Problem has been resolved</b> at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}<br><b>Problem name:</b> {EVENT.NAME}<br><b>Problem duration:</b> {EVENT.DURATION}<br><b>Host:</b> {HOST.NAME}<br><b>Severity:</b> {EVENT.SEVERITY}<br><b>Original problem ID:</b> {EVENT.ID}<br>{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('13','4','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','<b>{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem</b> at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.<br>{EVENT.UPDATE.MESSAGE}<br><br><b>Current problem status:</b> {EVENT.STATUS}<br><b>Age:</b> {EVENT.AGE}<br><b>Acknowledged:</b> {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('14','4','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','<b>Discovery rule:</b> {DISCOVERY.RULE.NAME}<br><br><b>Device IP:</b> {DISCOVERY.DEVICE.IPADDRESS}<br><b>Device DNS:</b> {DISCOVERY.DEVICE.DNS}<br><b>Device status:</b> {DISCOVERY.DEVICE.STATUS}<br><b>Device uptime:</b> {DISCOVERY.DEVICE.UPTIME}<br><br><b>Device service name:</b> {DISCOVERY.SERVICE.NAME}<br><b>Device service port:</b> {DISCOVERY.SERVICE.PORT}<br><b>Device service status:</b> {DISCOVERY.SERVICE.STATUS}<br><b>Device service uptime:</b> {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('15','4','2','0','Autoregistration: {HOST.HOST}','<b>Host name:</b> {HOST.HOST}<br><b>Host IP:</b> {HOST.IP}<br><b>Agent port:</b> {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('16','11','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('17','11','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('18','11','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('19','11','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('20','11','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('21','12','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('22','12','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('23','12','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('24','12','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('25','12','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('26','13','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('27','13','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('28','13','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('29','13','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('30','13','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('31','14','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('32','14','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('33','14','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('34','14','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('35','14','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('36','15','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('37','15','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('38','15','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('39','15','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('40','15','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('41','16','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('42','16','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('43','16','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('44','16','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('45','16','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('46','17','0','0','{EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('47','17','0','1','{EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('48','17','0','2','{EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('49','17','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('50','17','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('51','17','3','0','Internal problem: {EVENT.NAME}','Internal problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('52','18','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('53','18','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('54','18','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('55','18','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('56','18','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('57','19','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('58','19','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('59','19','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('60','19','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('61','19','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('62','20','0','0','{EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('63','20','0','1','{EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('64','20','0','2','{EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('65','20','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('66','20','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('67','21','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('68','21','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('69','21','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('70','21','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('71','21','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('72','10','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('73','10','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('74','10','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('75','10','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('76','10','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('77','22','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('78','22','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('79','22','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('80','5','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('81','5','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('82','5','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('83','5','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('84','5','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('85','6','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('86','6','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('87','6','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('88','6','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('89','6','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('90','7','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('91','7','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('92','7','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('93','7','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('94','7','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('95','8','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('96','8','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('97','8','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('98','8','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('99','8','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('100','9','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('101','9','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('102','9','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('103','9','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('104','9','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('105','23','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}

Trigger description: {TRIGGER.DESCRIPTION}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('106','23','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('107','23','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('108','23','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('109','23','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('110','24','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('111','24','0','1','Resolved: {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('112','24','0','2','Updated problem: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('113','24','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('114','24','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('115','25','0','0','Problem: {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('116','25','0','1','Resolved in {EVENT.DURATION}: {EVENT.NAME}','Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('117','25','0','2','Updated problem in {EVENT.AGE}: {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('118','25','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('119','25','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('120','26','0','0','[{EVENT.STATUS}] {EVENT.NAME}','Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('121','26','0','1','[{EVENT.STATUS}] {EVENT.NAME}','Problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('122','26','0','2','[{EVENT.STATUS}] {EVENT.NAME}','{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}

Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('123','26','1','0','Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}','Discovery rule: {DISCOVERY.RULE.NAME}

Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}

Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}');
INSERT INTO media_type_message (mediatype_messageid,mediatypeid,eventsource,recovery,subject,message) values ('124','26','2','0','Autoregistration: {HOST.HOST}','Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}');
INSERT INTO usrgrp (usrgrpid,name,gui_access,users_status,debug_mode) values ('7','Zabbix administrators','0','0','0');
INSERT INTO usrgrp (usrgrpid,name,gui_access,users_status,debug_mode) values ('8','Guests','1','0','0');
INSERT INTO usrgrp (usrgrpid,name,gui_access,users_status,debug_mode) values ('9','Disabled','0','1','0');
INSERT INTO usrgrp (usrgrpid,name,gui_access,users_status,debug_mode) values ('11','Enabled debug mode','0','0','1');
INSERT INTO usrgrp (usrgrpid,name,gui_access,users_status,debug_mode) values ('12','No access to the frontend','3','0','0');
INSERT INTO users_groups (id,usrgrpid,userid) values ('2','8','2');
INSERT INTO users_groups (id,usrgrpid,userid) values ('3','9','2');
INSERT INTO users_groups (id,usrgrpid,userid) values ('4','7','1');
INSERT INTO scripts (scriptid,name,command,host_access,usrgrpid,groupid,description,confirmation,type,execute_on) values ('1','Ping','ping -c 3 {HOST.CONN}; case $? in [01]) true;; *) false;; esac','2',NULL,NULL,'','','0','2');
INSERT INTO scripts (scriptid,name,command,host_access,usrgrpid,groupid,description,confirmation,type,execute_on) values ('2','Traceroute','/bin/traceroute {HOST.CONN}','2',NULL,NULL,'','','0','2');
INSERT INTO scripts (scriptid,name,command,host_access,usrgrpid,groupid,description,confirmation,type,execute_on) values ('3','Detect operating system','sudo /usr/bin/nmap -O {HOST.CONN}','2','7',NULL,'','','0','2');
INSERT INTO actions (actionid,name,eventsource,evaltype,status,esc_period,formula,pause_suppressed) values ('2','Auto discovery. Linux servers.','1','0','1','0','','1');
INSERT INTO actions (actionid,name,eventsource,evaltype,status,esc_period,formula,pause_suppressed) values ('3','Report problems to Zabbix administrators','0','0','1','1h','','1');
INSERT INTO actions (actionid,name,eventsource,evaltype,status,esc_period,formula,pause_suppressed) values ('4','Report not supported items','3','0','1','1h','','1');
INSERT INTO actions (actionid,name,eventsource,evaltype,status,esc_period,formula,pause_suppressed) values ('5','Report not supported low level discovery rules','3','0','1','1h','','1');
INSERT INTO actions (actionid,name,eventsource,evaltype,status,esc_period,formula,pause_suppressed) values ('6','Report unknown triggers','3','0','1','1h','','1');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('1','2','6','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('2','2','4','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('3','3','0','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('4','4','0','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('5','5','0','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('6','6','0','0','1','1','0','0');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('7','3','11','0','1','1','0','1');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('8','4','11','0','1','1','0','1');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('9','5','11','0','1','1','0','1');
INSERT INTO operations (operationid,actionid,operationtype,esc_period,esc_step_from,esc_step_to,evaltype,recovery) values ('10','6','11','0','1','1','0','1');
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('3','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('4','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('5','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('6','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('7','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('8','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('9','1','','',NULL);
INSERT INTO opmessage (operationid,default_msg,subject,message,mediatypeid) values ('10','1','','',NULL);
INSERT INTO opmessage_grp (opmessage_grpid,operationid,usrgrpid) values ('1','3','7');
INSERT INTO opmessage_grp (opmessage_grpid,operationid,usrgrpid) values ('2','4','7');
INSERT INTO opmessage_grp (opmessage_grpid,operationid,usrgrpid) values ('3','5','7');
INSERT INTO opmessage_grp (opmessage_grpid,operationid,usrgrpid) values ('4','6','7');
INSERT INTO opgroup (opgroupid,operationid,groupid) values ('1','2','2');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('2','2','10','0','0','');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('3','2','8','0','9','');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('4','2','12','2','Linux','');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('6','4','23','0','0','');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('7','5','23','0','2','');
INSERT INTO conditions (conditionid,actionid,conditiontype,operator,value,value2) values ('8','6','23','0','4','');
INSERT INTO config (configid,refresh_unsupported,work_period,alert_usrgrpid,discovery_groupid) values ('1','10m','1-5,09:00-18:00','7','5');
INSERT INTO graph_theme (graphthemeid,theme,backgroundcolor,graphcolor,gridcolor,maingridcolor,gridbordercolor,textcolor,highlightcolor,leftpercentilecolor,rightpercentilecolor,nonworktimecolor,colorpalette) values ('1','blue-theme','FFFFFF','FFFFFF','CCD5D9','ACBBC2','ACBBC2','1F2C33','E33734','429E47','E33734','EBEBEB','1A7C11,F63100,2774A4,A54F10,FC6EA3,6C59DC,AC8C14,611F27,F230E0,5CCD18,BB2A02,5A2B57,89ABF8,7EC25C,274482,2B5429,8048B4,FD5434,790E1F,87AC4D,E89DF4');
INSERT INTO graph_theme (graphthemeid,theme,backgroundcolor,graphcolor,gridcolor,maingridcolor,gridbordercolor,textcolor,highlightcolor,leftpercentilecolor,rightpercentilecolor,nonworktimecolor,colorpalette) values ('2','dark-theme','2B2B2B','2B2B2B','454545','4F4F4F','4F4F4F','F2F2F2','E45959','59DB8F','E45959','333333','199C0D,F63100,2774A4,F7941D,FC6EA3,6C59DC,C7A72D,BA2A5D,F230E0,5CCD18,BB2A02,AC41A5,89ABF8,7EC25C,3165D5,79A277,AA73DE,FD5434,F21C3E,87AC4D,E89DF4');
INSERT INTO graph_theme (graphthemeid,theme,backgroundcolor,graphcolor,gridcolor,maingridcolor,gridbordercolor,textcolor,highlightcolor,leftpercentilecolor,rightpercentilecolor,nonworktimecolor,colorpalette) values ('3','hc-light','FFFFFF','FFFFFF','555555','000000','333333','000000','333333','000000','000000','EBEBEB','1A7C11,F63100,2774A4,A54F10,FC6EA3,6C59DC,AC8C14,611F27,F230E0,5CCD18,BB2A02,5A2B57,89ABF8,7EC25C,274482,2B5429,8048B4,FD5434,790E1F,87AC4D,E89DF4');
INSERT INTO graph_theme (graphthemeid,theme,backgroundcolor,graphcolor,gridcolor,maingridcolor,gridbordercolor,textcolor,highlightcolor,leftpercentilecolor,rightpercentilecolor,nonworktimecolor,colorpalette) values ('4','hc-dark','000000','000000','666666','888888','4F4F4F','FFFFFF','FFFFFF','FFFFFF','FFFFFF','333333','199C0D,F63100,2774A4,F7941D,FC6EA3,6C59DC,C7A72D,BA2A5D,F230E0,5CCD18,BB2A02,AC41A5,89ABF8,7EC25C,3165D5,79A277,AA73DE,FD5434,F21C3E,87AC4D,E89DF4');
INSERT INTO globalmacro (globalmacroid,macro,value,description,type) values ('2','{$SNMP_COMMUNITY}','public','','0');
INSERT INTO regexps (regexpid,name,test_string) values ('1','File systems for discovery','ext3');
INSERT INTO regexps (regexpid,name,test_string) values ('2','Network interfaces for discovery','eth0');
INSERT INTO regexps (regexpid,name,test_string) values ('3','Storage devices for SNMP discovery','/boot');
INSERT INTO regexps (regexpid,name,test_string) values ('4','Windows service names for discovery','SysmonLog');
INSERT INTO regexps (regexpid,name,test_string) values ('5','Windows service startup states for discovery','automatic');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('1','1','^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$','3',',','0');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('3','3','^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('5','4','^(MMCSS|gupdate|SysmonLog|clr_optimization_v2.0.50727_32|clr_optimization_v4.0.30319_32)$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('6','5','^(automatic|automatic delayed)$','3',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('7','2','^Software Loopback Interface','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('8','2','^(In)?[Ll]oop[Bb]ack[0-9._]*$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('9','2','^NULL[0-9.]*$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('10','2','^[Ll]o[0-9.]*$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('11','2','^[Ss]ystem$','4',',','1');
INSERT INTO expressions (expressionid,regexpid,expression,expression_type,exp_delimiter,case_sensitive) values ('12','2','^Nu[0-9.]*$','4',',','1');
INSERT INTO config_autoreg_tls (autoreg_tlsid,tls_psk_identity,tls_psk) values ('1','','');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10001',NULL,'Template OS Linux by Zabbix agent','3','-1','2','','','Template OS Linux by Zabbix agent','0',NULL,'Official Linux template. Requires agent of Zabbix 3.0.14, 3.4.5 and 4.0.0 or newer.

Known Issues:

  Description: Network discovery. Zabbix agent as of 4.2 doesn''t support items such as net.if.status, net.if.speed.

You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/387225-discussion-thread-for-official-zabbix-template-for-linux

Template tooling version used: 0.38','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10047',NULL,'Template App Zabbix Server','3','-1','2','','','Template App Zabbix Server','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10048',NULL,'Template App Zabbix Proxy','3','-1','2','','','Template App Zabbix Proxy','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10050',NULL,'Template Module Zabbix agent','3','-1','2','','','Template Module Zabbix agent','0',NULL,'Use this template for agents reachable from Zabbix server/proxy (passive mode).

Template tooling version used: 0.34','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10074',NULL,'Template OS OpenBSD','3','-1','2','','','Template OS OpenBSD','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10075',NULL,'Template OS FreeBSD','3','-1','2','','','Template OS FreeBSD','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10076',NULL,'Template OS AIX','3','-1','2','','','Template OS AIX','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10077',NULL,'Template OS HP-UX','3','-1','2','','','Template OS HP-UX','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10078',NULL,'Template OS Solaris','3','-1','2','','','Template OS Solaris','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10079',NULL,'Template OS Mac OS X','3','-1','2','','','Template OS Mac OS X','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10081',NULL,'Template OS Windows by Zabbix agent','3','-1','2','','','Template OS Windows by Zabbix agent','0',NULL,'Official Windows template. Requires agent of Zabbix 4.4 and newer.


You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/387224-discussion-thread-for-official-zabbix-template-for-windows

Template tooling version used: 0.38','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10084',NULL,'Zabbix server','0','-1','2','','','Zabbix server','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10093',NULL,'Template App FTP Service','3','-1','2','','','Template App FTP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10094',NULL,'Template App HTTP Service','3','-1','2','','','Template App HTTP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10095',NULL,'Template App HTTPS Service','3','-1','2','','','Template App HTTPS Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10096',NULL,'Template App IMAP Service','3','-1','2','','','Template App IMAP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10097',NULL,'Template App LDAP Service','3','-1','2','','','Template App LDAP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10098',NULL,'Template App NNTP Service','3','-1','2','','','Template App NNTP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10099',NULL,'Template App NTP Service','3','-1','2','','','Template App NTP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10100',NULL,'Template App POP Service','3','-1','2','','','Template App POP Service','0',NULL,'','1','1','','','','','','1','0');
INSERT INTO hosts (hostid,proxy_hostid,host,status,ipmi_authtype,ipmi_privilege,ipmi_username,ipmi_password,name,flags,templateid,description,tls_connect,tls_accept,tls_issuer,tls_subject,tls_psk_identity,tls_psk,proxy_address,auto_compress,discover) values ('10101',NULL,'Template App SMTP Service','3','-1','2','','','Template App SMTP Service','0',NULL,'','1','1','','','','','','1','0');
