Last active
October 14, 2021 22:09
-
-
Save isaqueprofeta/bf1cdc5ca4466b956a81543d764258c2 to your computer and use it in GitHub Desktop.
Instalação Grafana no Rocky 8 para o Zabbix 5.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [[ -z "$ZABBIX_URL" ]]; then | |
| echo "ATENÇÃO: DEFINA A VARIAVEL de ambiente \$ZABBIX_URL com a URL do zabbix usando o comando EXEMPLO abaixo:" 1>&2 | |
| echo "export ZABBIX_URL=http://url.do.zabbix.frontend" 1>&2 | |
| echo "OU ENTÃO:" 1>&2 | |
| echo "export ZABBIX_URL=http://url.do.zabbix.frontend/zabbix" 1>&2 | |
| exit 1 | |
| fi | |
| if [[ -z "$ZABBIX_USUARIO" ]]; then | |
| echo "ATENÇÃO: DEFINA A VARIAVEL de ambiente \$ZABBIX_USUARIO com a URL do zabbix usando o comando EXEMPLO abaixo:" 1>&2 | |
| echo "export ZABBIX_USUARIO=integracao_grafana" 1>&2 | |
| exit 1 | |
| fi | |
| if [[ -z "$ZABBIX_SENHA" ]]; then | |
| echo "ATENÇÃO: DEFINA A VARIAVEL de ambiente \$ZABBIX_URL com a URL do zabbix usando o comando EXEMPLO abaixo:" 1>&2 | |
| echo "export ZABBIX_SENHA=1nt3gr4c40gr4f4n4" 1>&2 | |
| exit 1 | |
| fi | |
| # Desabilitar selinux | |
| sudo sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config | |
| sudo setenforce 0 | |
| # Configurar o firewall | |
| sudo firewall-cmd --add-port=3000/tcp --permanent | |
| sudo firewall-cmd --reload | |
| ## Repositório | |
| sudo tee /etc/yum.repos.d/grafana.repo <<EOL | |
| [grafana] | |
| name=grafana | |
| baseurl=https://packages.grafana.com/oss/rpm | |
| repo_gpgcheck=1 | |
| enabled=1 | |
| gpgcheck=1 | |
| gpgkey=https://packages.grafana.com/gpg.key | |
| sslverify=1 | |
| sslcacert=/etc/pki/tls/certs/ca-bundle.crt | |
| EOL | |
| ## Instalação grafana | |
| sudo dnf -y install grafana | |
| ## Instalação plugin integração zabbix | |
| sudo tee /etc/grafana/provisioning/datasources/zabbix.yaml <<EOL | |
| apiVersion: 1 | |
| datasources: | |
| - name: Zabbix-Frontend | |
| type: alexanderzobnin-zabbix-datasource | |
| access: proxy | |
| url: $ZABBIX_URL/api_jsonrpc.php | |
| isDefault: true | |
| jsonData: | |
| # Creds | |
| username: $ZABBIX_USUARIO | |
| password: $ZABBIX_SENHA | |
| # Trends | |
| trends: true | |
| trendsFrom: "7d" | |
| trendsRange: "4d" | |
| cacheTTL: "1h" | |
| # Alerting | |
| alerting: true | |
| addThresholds: false | |
| alertingMinSeverity: 3 | |
| disableReadOnlyUsersAck: true | |
| dbConnectionEnable: false | |
| version: 1 | |
| editable: false | |
| EOL | |
| ## Inicializar serviço | |
| sudo systemctl enable --now grafana-server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment