Role Name ========= ansible-perforce_sdp_monitoring-role Role Function ========= Ansible role for installing p4prometheus log scraper utility and configuring an additional metrics scripts to collect additional metrics that can be fed into node_exporter. Monitoring solution based off perforce employee repo: [p4prometheus](https://github.com/perforce/p4prometheus) Steps: * Updates the node_exporter file /etc/sysconfig/node_exporter with additional options for p4prometheus * Copies p4prometheus binary to /usr/local/bin (Binary is stored in ansible repo) * Creates /etc/systemd/system/p4prometheus.service from a template file * Creates *p4prometheus_config* file from a template * Enables the p4prometheus systemd service * Creates the /p4/common/bin/monitor_metrics.sh from a file * Updates /p4/p4.crontab with a task for monitor_metrics.sh * Reloads the /p4/p4.crontab for *perforce_user* Requirements ------------ - The role expects that the perforce sdp framework has already been installed. (install via ansible) - The role expects that node_exporter has already been installed Role Variables -------------- | Name | Description | Default Value | |:--------------------------:|:---------------------------------------------------------:|:-----------------------------------:| | perforce_id | The instance id used for perforce directories | "1" | perforce_case_sensitve | Turn case insensitivity on for p4prometheus with '0' | "1" | node_exporter_sysconfig_opts | Options added to node_exporter execution | "\"--collector.systemd --collector.systemd.unit-whitelist=\"(p4.*| node_exporter)\\.service\"\"" | p4prometheus_version | Version of p4prometheus binary | "v0.7.5" | p4prometheus_file | p4prometheus file name | "p4prometheus.linux-amd64" | p4prometheus_tar | p4prometheus tar file name | "{{ p4prometheus_version }}-{{ p4prometheus_file }}.tar.gz" | p4prometheus_config | p4prometheus config file | "/p4/common/config/p4prometheus.yml" | p4prometheus_metrics_dir | p4prometheus textfile directory | "/srv/prometheus/node_exporter" | perforce_user | perforce os user | "perforce" | perforce_group | perforce os group | "perforce" Example Usage ------------ ``` # Sample playbook and inventory files below ansible-playbook -i ``` Example Playbook ---------------- example-playbook.yml: ``` - hosts: all roles: - "ansible-perforce_sdp_install-role" ``` Example Inventory ----------------- example-inventory.yml ``` all: # Vars at Global level - Can also be defined at group/host level vars: perforce_clean: false children: p4d_master: hosts: master: p4d_replica: hosts: replica: ```