Icinga / icingaweb2-module-jira

GNU General Public License v2.0
42 stars 16 forks source link

issues keep getting duplicated #47

Open yoshi314 opened 4 years ago

yoshi314 commented 4 years ago

This just started happening today. No clue as to what changed.

icinga2:/usr/share/icingaweb2/modules/jira# icingacli jira send problem --project DC --issuetype Bug --summary Test --description "Test alertu" --state CRITICAL --host enc07 --service enc-blades --template jirabug --benchmark --verbose --trace
New JIRA issue DC-96069 has been created
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+
| Time         | Description                         |    Off (ms) |      Dur (ms) |  Mem (diff) | Mem (total) |
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+
| 08:21:27.151 | Bootstrap, autoloader registered    |       0.005 |         0.005 |  505.81 KiB |  505.81 KiB |
| 08:21:27.164 | Dispatching CLI command             |      12.937 |        12.932 |  478.12 KiB |  983.94 KiB |
| 08:21:27.193 | Rest Api, sending search            |      42.027 |        29.090 | 1431.85 KiB |    2.36 MiB |
| 08:21:27.251 | Rest Api, got response              |      99.841 |        57.814 |   1160.00 B |    2.36 MiB |
| 08:21:27.252 | Found no (optional) issue           |     100.571 |         0.730 |   13.89 KiB |    2.37 MiB |
| 08:21:27.254 | Need to fetch custom field mappings |     102.140 |         1.569 |   48.95 KiB |    2.42 MiB |
| 08:21:27.254 | Rest Api, sending field             |     102.189 |         0.049 |    3.44 KiB |    2.43 MiB |
| 08:21:27.291 | Rest Api, got response              |     139.641 |        37.452 |   46.58 KiB |    2.47 MiB |
| 08:21:27.294 | Got 52 custom field mappings        |     142.977 |         3.336 |  227.48 KiB |    2.69 MiB |
| 08:21:27.295 | Rest Api, sending issue             |     143.299 |         0.322 | -234.48 KiB |    2.46 MiB |
| 08:21:27.469 | Rest Api, got response              |     317.444 |       174.145 |  -19.66 KiB |    2.44 MiB |
| 08:21:27.470 | A new issue has been created        |     318.290 |         0.846 |   -464.00 B |    2.44 MiB |
| 08:21:27.499 | Fetching one row started            |     347.842 |        29.552 |    2.16 MiB |    4.61 MiB |
| 08:21:27.504 | Fetching one row finished           |     352.529 |         4.687 |   21.77 KiB |    4.63 MiB |
| 08:21:27.504 | All done                            |     352.688 |         0.159 | -141.07 KiB |    4.49 MiB |
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+

icinga2:/usr/share/icingaweb2/modules/jira# icingacli jira send problem --project DC --issuetype Bug --summary Test --description "Test alertu" --state CRITICAL --host enc07 --service enc-blades --template jirabug --benchmark --verbose --trace
New JIRA issue DC-96070 has been created
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+
| Time         | Description                         |    Off (ms) |      Dur (ms) |  Mem (diff) | Mem (total) |
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+
| 08:21:28.762 | Bootstrap, autoloader registered    |       0.005 |         0.005 |  505.81 KiB |  505.81 KiB |
| 08:21:28.778 | Dispatching CLI command             |      15.627 |        15.622 |  478.12 KiB |  983.94 KiB |
| 08:21:28.804 | Rest Api, sending search            |      41.435 |        25.808 | 1431.85 KiB |    2.36 MiB |
| 08:21:28.864 | Rest Api, got response              |     101.489 |        60.054 |   1160.00 B |    2.36 MiB |
| 08:21:28.864 | Found no (optional) issue           |     102.200 |         0.711 |   13.89 KiB |    2.37 MiB |
| 08:21:28.866 | Need to fetch custom field mappings |     103.622 |         1.422 |   48.95 KiB |    2.42 MiB |
| 08:21:28.866 | Rest Api, sending field             |     103.690 |         0.068 |    3.44 KiB |    2.43 MiB |
| 08:21:28.903 | Rest Api, got response              |     141.073 |        37.383 |   46.58 KiB |    2.47 MiB |
| 08:21:28.906 | Got 52 custom field mappings        |     143.713 |         2.640 |  227.48 KiB |    2.69 MiB |
| 08:21:28.906 | Rest Api, sending issue             |     143.914 |         0.201 | -234.48 KiB |    2.46 MiB |
| 08:21:29.011 | Rest Api, got response              |     248.545 |       104.631 |  -19.66 KiB |    2.44 MiB |
| 08:21:29.011 | A new issue has been created        |     248.749 |         0.204 |   -464.00 B |    2.44 MiB |
| 08:21:29.050 | Fetching one row started            |     287.455 |        38.706 |    2.16 MiB |    4.61 MiB |
| 08:21:29.057 | Fetching one row finished           |     295.004 |         7.549 |   21.77 KiB |    4.63 MiB |
| 08:21:29.057 | All done                            |     295.221 |         0.217 | -141.07 KiB |    4.49 MiB |
+--------------+-------------------------------------+-------------+---------------+-------------+-------------+
Thomas-Gelf commented 4 years ago

@yoshi314: do these issues show up, when you navigate to that service's Issue list (from the Icinga Web monitoring detail view)?

yoshi314 commented 4 years ago

i actually cannot see any issues in jira module. That's odd.

Thomas-Gelf commented 4 years ago

I'm confused, the last two statements seem to contradict each other. Could you please share more details?

yoshi314 commented 4 years ago

Issues pop up in JIRA as duplicates (they even have the same icingaKey), but i cannot see any issues from icingaweb2 module's view.

Thomas-Gelf commented 4 years ago

Are they somehow transformed in a specific JIRA workflow? Does the creator in JIRA match the JIRA user used by this module? Is the resolution still empty?

yoshi314 commented 4 years ago

creator is the same, issues are all not resolved, i don't see how they would differ wrt workflow.

I'll inspect them in a bit more detail, unless i can get out some more debug info out of the module.

yoshi314 commented 4 years ago

I tried applying the query from jira module to my jira instance and i cannot find issues i am looking for.

e.g.

icingaKey ~ "BEGINconniedb*"

works, but it lists plenty of issues.

But icingaKey ~ "BEGINconniedb!queue sizeEND"

returns nothing. even though i can directly see that icingaKey listed.

I am at a loss here. What could be wrong?

yoshi314 commented 4 years ago

Turns out that avoiding special characters like ! _ or anything nonnumber or digit helps. Jira's ~ operator is rather quirky.

Perhaps the sdcript ought to avoid using host!service notation. and instead use e.g. capital i for separator. Or other fixed string

yoshi314 commented 4 years ago

I have replaced the makeIcingaKey function with one that adds a fixed text separator and removes all non a-zA-Z0-9 characters from the field during generation. It seems to work so far.

theFeu commented 2 years ago

I know it has been forever and I am also not sure if it is still relevant, but do you still have the code you used and want to share it in a PR?

yoshi314 commented 2 years ago

in function makeIcingaKey i basically added this :

  $icingaKey .= preg_replace('/[^A-Za-z0-9]/', '', $service);
raviks789 commented 1 year ago

Hi @yoshi314,

Could you also mention the icingaweb2-module-jira version you were using when the issue occurred? Also, could you check if this issue still persists in the latest icingaweb2-module-jira (v1.2.2) version?

Note: Instead of icingaKey ~ "BEGINconniedb!queue sizeEND" use icingaKey ~ "\"BEGINconniedb!queue sizeEND\"". Refer the documentation for search syntax for text fields with special characters.

yoshi314 commented 1 year ago

i'll test this sometime next week