Last active
January 11, 2020 22:56
-
-
Save sigio/5363718 to your computer and use it in GitHub Desktop.
Ansible play to install snmpd on centos (5/6)
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
# Install and configure snmpd | |
--- | |
- hosts: centos5:centos6 | |
gather_facts: yes | |
vars: | |
tasks: | |
- name: Install snmpd package | |
yum: name=net-snmp state=latest | |
- name: Enable snmpd service | |
service: name=snmpd enabled=yes | |
notify: Restart snmpd | |
- name: Template snmpd.conf | |
template: src=templates/etc-snmp-snmpd-conf.j2 dest=/etc/snmp/snmpd.conf owner=root group=root mode=644 backup=yes | |
notify: Restart snmpd | |
handlers: | |
- name: Restart snmpd | |
action: service name=snmpd state=restarted |
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
# {{ ansible_managed }} | |
# Access-Control-data here | |
# ----------------------------------------------------------------------------- | |
syslocation XXX | |
syscontact XXX | |
sysname {{ ansible_hostname }} | |
# ----------------------------------------------------------------------------- | |
############################################################################### | |
# Process checks. | |
# proc NAME [MAX=0] [MIN=0] | |
# Generic | |
proc sshd 0 1 | |
proc crond 0 1 | |
proc ntpd 1 1 | |
proc rsyslogd 1 1 | |
{% if hostvars[ansible_hostname]['frontend'] %} | |
# Frontend processes | |
proc httpd 1500 3 | |
proc java 0 2 | |
{% endif %} | |
{% if hostvars[ansible_hostname]['backend'] %} | |
# Backend processes | |
proc java 0 1 | |
proc something 0 1 | |
proc whatever 0 2 | |
{% endif %} | |
############################################################################### | |
# disk checks | |
# | |
# disk PATH [MIN=100000] | |
{% for mountpoint in ansible_mounts %} | |
disk {{ mountpoint["mount"] }} 10% | |
{% endfor %} | |
############################################################################### | |
# load average checks | |
# | |
# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] | |
# | |
# 1MAX: If the 1 minute load average is above this limit at query | |
# time, the errorFlag will be set. | |
# 5MAX: Similar, but for 5 min average. | |
# 15MAX: Similar, but for 15 min average. | |
load 5 10 14 | |
############################################################################### | |
# Extensible sections. | |
# | |
############################################################################### | |
# Pass through control. | |
# | |
# Usage: | |
# pass MIBOID EXEC-COMMAND | |
# | |
# This will pass total control of the mib underneath the MIBOID | |
# portion of the mib to the EXEC-COMMAND. | |
# | |
# Note: You'll have to change the path of the passtest script to your | |
# source directory or install it in the given location. | |
# | |
# Example: (see the script for details) | |
# (commented out here since it requires that you place the | |
# script in the right location. (its not installed by default)) | |
# For specific usage information, see the man/snmpd.conf.5 manual page | |
# as well as the local/passtest script used in the above example. | |
dontLogTCPWrappersConnects 1 | |
# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX | |
smuxpeer .1.3.6.1.4.1.674.10892.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment