PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 131
// Copyright 2019 Prometheus Team // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package opsgenie import ( "context" "fmt" "io" "net/http" "net/url" "os" "testing" "time" "github.com/go-kit/log" commoncfg "github.com/prometheus/common/config" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" "github.com/prometheus/alertmanager/config" "github.com/prometheus/alertmanager/notify" "github.com/prometheus/alertmanager/notify/test" "github.com/prometheus/alertmanager/types" ) func TestOpsGenieRetry(t *testing.T) { notifier, err := New( &config.OpsGenieConfig{ HTTPConfig: &commoncfg.HTTPClientConfig{}, }, test.CreateTmpl(t), log.NewNopLogger(), ) require.NoError(t, err) retryCodes := append(test.DefaultRetryCodes(), http.StatusTooManyRequests) for statusCode, expected := range test.RetryTests(retryCodes) { actual, _ := notifier.retrier.Check(statusCode, nil) require.Equal(t, expected, actual, fmt.Sprintf("error on status %d", statusCode)) } } func TestOpsGenieRedactedURL(t *testing.T) { ctx, u, fn := test.GetContextWithCancelingURL() defer fn() key := "key" notifier, err := New( &config.OpsGenieConfig{ APIURL: &config.URL{URL: u}, APIKey: config.Secret(key), HTTPConfig: &commoncfg.HTTPClientConfig{}, }, test.CreateTmpl(t), log.NewNopLogger(), ) require.NoError(t, err) test.AssertNotifyLeaksNoSecret(ctx, t, notifier, key) } func TestGettingOpsGegineApikeyFromFile(t *testing.T) { ctx, u, fn := test.GetContextWithCancelingURL() defer fn() key := "key" f, err := os.CreateTemp("", "opsgenie_test") require.NoError(t, err, "creating temp file failed") _, err = f.WriteString(key) require.NoError(t, err, "writing to temp file failed") notifier, err := New( &config.OpsGenieConfig{ APIURL: &config.URL{URL: u}, APIKeyFile: f.Name(), HTTPConfig: &commoncfg.HTTPClientConfig{}, }, test.CreateTmpl(t), log.NewNopLogger(), ) require.NoError(t, err) test.AssertNotifyLeaksNoSecret(ctx, t, notifier, key) } func TestOpsGenie(t *testing.T) { u, err := url.Parse("https://opsgenie/api") if err != nil { t.Fatalf("failed to parse URL: %v", err) } logger := log.NewNopLogger() tmpl := test.CreateTmpl(t) for _, tc := range []struct { title string cfg *config.OpsGenieConfig expectedEmptyAlertBody string expectedBody string }{ { title: "config without details", cfg: &config.OpsGenieConfig{ NotifierConfig: config.NotifierConfig{ VSendResolved: true, }, Message: `{{ .CommonLabels.Message }}`, Description: `{{ .CommonLabels.Description }}`, Source: `{{ .CommonLabels.Source }}`, Responders: []config.OpsGenieConfigResponder{ { Name: `{{ .CommonLabels.ResponderName1 }}`, Type: `{{ .CommonLabels.ResponderType1 }}`, }, { Name: `{{ .CommonLabels.ResponderName2 }}`, Type: `{{ .CommonLabels.ResponderType2 }}`, }, }, Tags: `{{ .CommonLabels.Tags }}`, Note: `{{ .CommonLabels.Note }}`, Priority: `{{ .CommonLabels.Priority }}`, Entity: `{{ .CommonLabels.Entity }}`, Actions: `{{ .CommonLabels.Actions }}`, APIKey: `{{ .ExternalURL }}`, APIURL: &config.URL{URL: u}, HTTPConfig: &commoncfg.HTTPClientConfig{}, }, expectedEmptyAlertBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"","details":{},"source":""} `, expectedBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"message","description":"description","details":{"Actions":"doThis,doThat","Description":"description","Entity":"test-domain","Message":"message","Note":"this is a note","Priority":"P1","ResponderName1":"TeamA","ResponderName2":"EscalationA","ResponderName3":"TeamA,TeamB","ResponderType1":"team","ResponderType2":"escalation","ResponderType3":"teams","Source":"http://prometheus","Tags":"tag1,tag2"},"source":"http://prometheus","responders":[{"name":"TeamA","type":"team"},{"name":"EscalationA","type":"escalation"}],"tags":["tag1","tag2"],"note":"this is a note","priority":"P1","entity":"test-domain","actions":["doThis","doThat"]} `, }, { title: "config with details", cfg: &config.OpsGenieConfig{ NotifierConfig: config.NotifierConfig{ VSendResolved: true, }, Message: `{{ .CommonLabels.Message }}`, Description: `{{ .CommonLabels.Description }}`, Source: `{{ .CommonLabels.Source }}`, Details: map[string]string{ "Description": `adjusted {{ .CommonLabels.Description }}`, }, Responders: []config.OpsGenieConfigResponder{ { Name: `{{ .CommonLabels.ResponderName1 }}`, Type: `{{ .CommonLabels.ResponderType1 }}`, }, { Name: `{{ .CommonLabels.ResponderName2 }}`, Type: `{{ .CommonLabels.ResponderType2 }}`, }, }, Tags: `{{ .CommonLabels.Tags }}`, Note: `{{ .CommonLabels.Note }}`, Priority: `{{ .CommonLabels.Priority }}`, Entity: `{{ .CommonLabels.Entity }}`, Actions: `{{ .CommonLabels.Actions }}`, APIKey: `{{ .ExternalURL }}`, APIURL: &config.URL{URL: u}, HTTPConfig: &commoncfg.HTTPClientConfig{}, }, expectedEmptyAlertBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"","details":{"Description":"adjusted "},"source":""} `, expectedBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"message","description":"description","details":{"Actions":"doThis,doThat","Description":"adjusted description","Entity":"test-domain","Message":"message","Note":"this is a note","Priority":"P1","ResponderName1":"TeamA","ResponderName2":"EscalationA","ResponderName3":"TeamA,TeamB","ResponderType1":"team","ResponderType2":"escalation","ResponderType3":"teams","Source":"http://prometheus","Tags":"tag1,tag2"},"source":"http://prometheus","responders":[{"name":"TeamA","type":"team"},{"name":"EscalationA","type":"escalation"}],"tags":["tag1","tag2"],"note":"this is a note","priority":"P1","entity":"test-domain","actions":["doThis","doThat"]} `, }, { title: "config with multiple teams", cfg: &config.OpsGenieConfig{ NotifierConfig: config.NotifierConfig{ VSendResolved: true, }, Message: `{{ .CommonLabels.Message }}`, Description: `{{ .CommonLabels.Description }}`, Source: `{{ .CommonLabels.Source }}`, Details: map[string]string{ "Description": `adjusted {{ .CommonLabels.Description }}`, }, Responders: []config.OpsGenieConfigResponder{ { Name: `{{ .CommonLabels.ResponderName3 }}`, Type: `{{ .CommonLabels.ResponderType3 }}`, }, }, Tags: `{{ .CommonLabels.Tags }}`, Note: `{{ .CommonLabels.Note }}`, Priority: `{{ .CommonLabels.Priority }}`, APIKey: `{{ .ExternalURL }}`, APIURL: &config.URL{URL: u}, HTTPConfig: &commoncfg.HTTPClientConfig{}, }, expectedEmptyAlertBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"","details":{"Description":"adjusted "},"source":""} `, expectedBody: `{"alias":"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b","message":"message","description":"description","details":{"Actions":"doThis,doThat","Description":"adjusted description","Entity":"test-domain","Message":"message","Note":"this is a note","Priority":"P1","ResponderName1":"TeamA","ResponderName2":"EscalationA","ResponderName3":"TeamA,TeamB","ResponderType1":"team","ResponderType2":"escalation","ResponderType3":"teams","Source":"http://prometheus","Tags":"tag1,tag2"},"source":"http://prometheus","responders":[{"name":"TeamA","type":"team"},{"name":"TeamB","type":"team"}],"tags":["tag1","tag2"],"note":"this is a note","priority":"P1"} `, }, } { t.Run(tc.title, func(t *testing.T) { notifier, err := New(tc.cfg, tmpl, logger) require.NoError(t, err) ctx := context.Background() ctx = notify.WithGroupKey(ctx, "1") expectedURL, _ := url.Parse("https://opsgenie/apiv2/alerts") // Empty alert. alert1 := &types.Alert{ Alert: model.Alert{ StartsAt: time.Now(), EndsAt: time.Now().Add(time.Hour), }, } req, retry, err := notifier.createRequests(ctx, alert1) require.NoError(t, err) require.Len(t, req, 1) require.True(t, retry) require.Equal(t, expectedURL, req[0].URL) require.Equal(t, "GenieKey http://am", req[0].Header.Get("Authorization")) require.Equal(t, tc.expectedEmptyAlertBody, readBody(t, req[0])) // Fully defined alert. alert2 := &types.Alert{ Alert: model.Alert{ Labels: model.LabelSet{ "Message": "message", "Description": "description", "Source": "http://prometheus", "ResponderName1": "TeamA", "ResponderType1": "team", "ResponderName2": "EscalationA", "ResponderType2": "escalation", "ResponderName3": "TeamA,TeamB", "ResponderType3": "teams", "Tags": "tag1,tag2", "Note": "this is a note", "Priority": "P1", "Entity": "test-domain", "Actions": "doThis,doThat", }, StartsAt: time.Now(), EndsAt: time.Now().Add(time.Hour), }, } req, retry, err = notifier.createRequests(ctx, alert2) require.NoError(t, err) require.True(t, retry) require.Len(t, req, 1) require.Equal(t, tc.expectedBody, readBody(t, req[0])) // Broken API Key Template. tc.cfg.APIKey = "{{ kaput " _, _, err = notifier.createRequests(ctx, alert2) require.Error(t, err) require.Equal(t, "templating error: template: :1: function \"kaput\" not defined", err.Error()) }) } } func TestOpsGenieWithUpdate(t *testing.T) { u, err := url.Parse("https://test-opsgenie-url") require.NoError(t, err) tmpl := test.CreateTmpl(t) ctx := context.Background() ctx = notify.WithGroupKey(ctx, "1") opsGenieConfigWithUpdate := config.OpsGenieConfig{ Message: `{{ .CommonLabels.Message }}`, Description: `{{ .CommonLabels.Description }}`, UpdateAlerts: true, APIKey: "test-api-key", APIURL: &config.URL{URL: u}, HTTPConfig: &commoncfg.HTTPClientConfig{}, } notifierWithUpdate, err := New(&opsGenieConfigWithUpdate, tmpl, log.NewNopLogger()) alert := &types.Alert{ Alert: model.Alert{ StartsAt: time.Now(), EndsAt: time.Now().Add(time.Hour), Labels: model.LabelSet{ "Message": "new message", "Description": "new description", }, }, } require.NoError(t, err) requests, retry, err := notifierWithUpdate.createRequests(ctx, alert) require.NoError(t, err) require.True(t, retry) require.Len(t, requests, 3) body0 := readBody(t, requests[0]) body1 := readBody(t, requests[1]) body2 := readBody(t, requests[2]) key, _ := notify.ExtractGroupKey(ctx) alias := key.Hash() require.Equal(t, "https://test-opsgenie-url/v2/alerts", requests[0].URL.String()) require.NotEmpty(t, body0) require.Equal(t, requests[1].URL.String(), fmt.Sprintf("https://test-opsgenie-url/v2/alerts/%s/message?identifierType=alias", alias)) require.Equal(t, `{"message":"new message"} `, body1) require.Equal(t, requests[2].URL.String(), fmt.Sprintf("https://test-opsgenie-url/v2/alerts/%s/description?identifierType=alias", alias)) require.Equal(t, `{"description":"new description"} `, body2) } func readBody(t *testing.T, r *http.Request) string { t.Helper() body, err := io.ReadAll(r.Body) require.NoError(t, err) return string(body) }