Answers: <p>Based on the github reply I received, it looks only way is to allow it in Jira as it will spam same alert otherwise:</p>
  
  <blockquote>
    <p>Labels are how JIRAlert matches alerts to tickets. Without them, it
    would simply create a new ticket every time it gets called by
    Alertmanager for the same alert, i.e. once every few minutes.</p>
    
    <p>If I understand the error correctly, it looks like you'll have to
    enable labels for your JIRA project. I don't have admin access to a
    JIRA instance, so I can't tell you exactly how to do that.</p>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2020-05-11T09:05:06.653Z
Answers: 2020-05-11T09:05:06.653Z
Answers: anVzdGFub3RoZXJodW1hbg
Body: <p>Following the base instructions I can't create new Jira item through API request due to failing because of trying to create labels. Even if I am using  add_group_labels: false it tries to create label anyway, isn't this option supposed to disable this behavior? From what I read I need to allow the user to create labels through rest api, but I just don't want the albels on the ticket.</p>
  
  <p>Testing with:
  curl -H "Content-type: application/json" -X POST -d '{"receiver": "prometheus-customer-non-production", "status": "firing", "alerts": [{"status": "firing", "labels": {"alertname": "TestAlert", "key": "value"} }], "groupLabels": {"alertname": "TestAlert"}}' <a href="http://xx.x.xxx.xx:9097/alert" rel="nofollow noreferrer">http://xx.x.xxx.xx:9097/alert</a></p>
  
  <p>Output:
  {"Error":true,"Status":500,"Message":"JIRA request <a href="https://customer.atlassian.net/rest/api/2/issue" rel="nofollow noreferrer">https://customer.atlassian.net/rest/api/2/issue</a> returned status 400 Bad Request, body \"{\\"errorMessages\\":[],\\"errors\\":{\\"labels\\":\\"Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.\\"}}\""}</p>
  
  <p>Here is the configuration jiralert.yaml:</p>
  
  <pre><code># Global defaults, applied to all receivers where not explicitly overridden. Optional.
  defaults:
    # API access fields.
    api_url: https://customer.atlassian.net
    user: 'example@customer.com'
    password: 'customerpassword'
  
    # The type of JIRA issue to create. Required.
    issue_type: Alert
    # Issue priority. Optional.
    # priority: Low
    # Go template invocation for generating the summary. Required.
    summary: '{{ template "jira.summary" . }}'
    # Go template invocation for generating the description. Optional.
    description: '{{ template "jira.description" . }}'
    # State to transition into when reopening a closed issue. Required.
    reopen_state: "To Do"
    # Do not reopen issues with this resolution. Optional.
    wont_fix_resolution: "Won't Fix"
    # Amount of time after being closed that an issue should be reopened, after which, a new issue is created.
    # Optional (default: always reopen)
    reopen_duration: 0h
  
  # Receiver definitions. At least one must be defined.
  receivers:
      # Must match the Alertmanager receiver name. Required.
    - name: 'prometheus-customer-non-production'
      # JIRA project to create the issue in. Required.
      project: customer
      # Copy all Prometheus labels into separate JIRA labels. Optional (default: false).
      add_group_labels: false
  
  # File containing template definitions. Required.
  template: jiralert.tmpl
  </code></pre>
  
  <p>Below you can find versions info: </p>
  
  <p>Package release utilized -> <a href="https://github.com/prometheus-community/jiralert/releases/download/1.0/jiralert-1.0.linux-amd64.tar.gz" rel="nofollow noreferrer">https://github.com/prometheus-community/jiralert/releases/download/1.0/jiralert-1.0.linux-amd64.tar.gz</a></p>
  
  <pre><code>cat /etc/*-release
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=18.04
  DISTRIB_CODENAME=bionic
  DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
  NAME="Ubuntu"
  VERSION="18.04.2 LTS (Bionic Beaver)"
  ID=ubuntu
  ID_LIKE=debian
  PRETTY_NAME="Ubuntu 18.04.2 LTS"
  VERSION_ID="18.04"
  HOME_URL="https://www.ubuntu.com/"
  SUPPORT_URL="https://help.ubuntu.com/"
  BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  VERSION_CODENAME=bionic
  UBUNTU_CODENAME=bionic
  </code></pre>
  
  <pre><code>kubectl version
  Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
  Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
  </code></pre>
  
  <pre><code>helm list prometheus-operator --tiller-namespace=monitoring
  NAME                    REVISION        UPDATED                         STATUS          CHART                           APP VERSION     NAMESPACE
  prometheus-operator     3               Thu Apr  9 16:44:37 2020        DEPLOYED        prometheus-operator-8.12.12     0.37.0          monitoring
  </code></pre>
  
Tags: <prometheus><jira>
Title: Disable creation of labels in Jira?
UserDisplayName: anVzdGFub3RoZXJodW1hbg
ThreadText: # Disable creation of labels in Jira?
  
  (Asked by: username_0 on 2020-05-07)
  
  Following the base instructions I can't create new Jira item through API request due to failing because of trying to create labels. Even if I am using add\_group\_labels: false it tries to create label anyway, isn't this option supposed to disable this behavior? From what I read I need to allow the user to create labels through rest api, but I just don't want the albels on the ticket.
  
  Testing with:
  curl -H "Content-type: application/json" -X POST -d '{"receiver": "prometheus-customer-non-production", "status": "firing", "alerts": [{"status": "firing", "labels": {"alertname": "TestAlert", "key": "value"} }], "groupLabels": {"alertname": "TestAlert"}}' <http://xx.x.xxx.xx:9097/alert>
  
  Output:
  {"Error":true,"Status":500,"Message":"JIRA request <https://customer.atlassian.net/rest/api/2/issue> returned status 400 Bad Request, body \"{\\"errorMessages\\":[],\\"errors\\":{\\"labels\\":\\"Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.\\"}}\""}
  
  Here is the configuration jiralert.yaml:
  
  ```
  # Global defaults, applied to all receivers where not explicitly overridden. Optional.
  defaults:
    # API access fields.
    api_url: https://customer.atlassian.net
    user: 'example@customer.com'
    password: 'customerpassword'
  
    # The type of JIRA issue to create. Required.
    issue_type: Alert
    # Issue priority. Optional.
    # priority: Low
    # Go template invocation for generating the summary. Required.
    summary: '{{ template "jira.summary" . }}'
    # Go template invocation for generating the description. Optional.
    description: '{{ template "jira.description" . }}'
    # State to transition into when reopening a closed issue. Required.
    reopen_state: "To Do"
    # Do not reopen issues with this resolution. Optional.
    wont_fix_resolution: "Won't Fix"
    # Amount of time after being closed that an issue should be reopened, after which, a new issue is created.
    # Optional (default: always reopen)
    reopen_duration: 0h
  
  # Receiver definitions. At least one must be defined.
  receivers:
      # Must match the Alertmanager receiver name. Required.
    - name: 'prometheus-customer-non-production'
      # JIRA project to create the issue in. Required.
      project: customer
      # Copy all Prometheus labels into separate JIRA labels. Optional (default: false).
      add_group_labels: false
  
  # File containing template definitions. Required.
  template: jiralert.tmpl
  
  ```
  
  Below you can find versions info:
  
  Package release utilized -> <https://github.com/prometheus-community/jiralert/releases/download/1.0/jiralert-1.0.linux-amd64.tar.gz>
  
  ```
  cat /etc/*-release
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=18.04
  DISTRIB_CODENAME=bionic
  DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
  NAME="Ubuntu"
  VERSION="18.04.2 LTS (Bionic Beaver)"
  ID=ubuntu
  ID_LIKE=debian
  PRETTY_NAME="Ubuntu 18.04.2 LTS"
  VERSION_ID="18.04"
  HOME_URL="https://www.ubuntu.com/"
  SUPPORT_URL="https://help.ubuntu.com/"
  BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  VERSION_CODENAME=bionic
  UBUNTU_CODENAME=bionic
  
  ```
  
  ```
  kubectl version
  Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
  Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
  
  ```
  
  ```
  helm list prometheus-operator --tiller-namespace=monitoring
  NAME                    REVISION        UPDATED                         STATUS          CHART                           APP VERSION     NAMESPACE
  prometheus-operator     3               Thu Apr  9 16:44:37 2020        DEPLOYED        prometheus-operator-8.12.12     0.37.0          monitoring
  
  ```
  
  **Tags:** prometheus, jira
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-05-11. Score: 0 | Accepted answer
  
  Based on the github reply I received, it looks only way is to allow it in Jira as it will spam same alert otherwise:
  
  > Labels are how JIRAlert matches alerts to tickets. Without them, it
  > would simply create a new ticket every time it gets called by
  > Alertmanager for the same alert, i.e. once every few minutes.
  >
  > If I understand the error correctly, it looks like you'll have to
  > enable labels for your JIRA project. I don't have admin access to a
  > JIRA instance, so I can't tell you exactly how to do that.
  
  
  ---
  
  