From 37af4e786df4bd7e18fc48e7e7b193e4c8b284ee Mon Sep 17 00:00:00 2001 From: Dennis Ahrens <dennis.ahrens@hs-hannover.de> Date: Thu, 28 Apr 2016 13:32:53 +0200 Subject: [PATCH] Add snmpd states; move pythonpackages into seperate .sls --- README.md | 29 +++++++++++++++++++++-- hshbase/defaults.yaml | 1 + hshbase/init.sls | 19 ++-------------- hshbase/pythonpackages.sls | 16 +++++++++++++ hshbase/snmpd/files/default.snmpd | 3 +++ hshbase/snmpd/files/snmpd.conf | 23 +++++++++++++++++++ hshbase/snmpd/init.sls | 38 +++++++++++++++++++++++++++++++ 7 files changed, 110 insertions(+), 19 deletions(-) create mode 100644 hshbase/pythonpackages.sls create mode 100644 hshbase/snmpd/files/default.snmpd create mode 100644 hshbase/snmpd/files/snmpd.conf create mode 100644 hshbase/snmpd/init.sls diff --git a/README.md b/README.md index f17ad41..1264177 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,35 @@ Basic server configuration used for most unix based servers at HsH. * **apt** proxy, sources.list and sources.list.d * **openvmtools** use them for vmware * **locale** setup your servers locales -* **python-packages** we are using for salt grains or modules. +* **time** use the configured time server and zone +* **snmpd** let whats up gold talk to you +* **python-packages** we are using for salt grains or modules * **netifaces** useful information in grains about net cfg - * **psutil** who needs that?! + * **psutil** TODO: who needs that?! +### hshbase + +Installs everything + +### hshbase.apt + +Configures apt package manager on debian and ubuntu machines + +### hshbase.time + +Install NTP, and sets timezone + timeserver + +### hshbase.openvmtools + +Install the package open-vm-tools + +### hshbase.locale + +Install system locales and additional ones optionally + +### hshbase.snmpd + +Install snmpd ready to be used with [Whats Up Gold](https://whatsup.fh-h.de/) ## Configuration diff --git a/hshbase/defaults.yaml b/hshbase/defaults.yaml index 7f80411..ecbeb53 100644 --- a/hshbase/defaults.yaml +++ b/hshbase/defaults.yaml @@ -10,3 +10,4 @@ hshbase: system: en_US.UTF-8 present: - de_DE.UTF-8 + snmpd: True diff --git a/hshbase/init.sls b/hshbase/init.sls index da8c903..c4f6ed6 100644 --- a/hshbase/init.sls +++ b/hshbase/init.sls @@ -2,24 +2,9 @@ # Include all submodules by default - they ca be disable in pillar, if necessary include: + - .pythonpackages - .apt - .openvmtools - .time - .locale - -# Always ships this packages - we need them for grains -{% if grains['os'] == 'Debian' and grains['oscodename'] != 'squeeze' or grains['os'] == 'Ubuntu' %} -salt-python-packages: - pkg.installed: - - pkgs: - - python-netifaces - - python-psutil - -{% elif grains['os'] == 'FreeBSD' %} -salt-python-packages: - pkg.installed: - - pkgs: - - net/py-netifaces - - py27-psutil - -{% endif %} + - .snmpd diff --git a/hshbase/pythonpackages.sls b/hshbase/pythonpackages.sls new file mode 100644 index 0000000..e8367fb --- /dev/null +++ b/hshbase/pythonpackages.sls @@ -0,0 +1,16 @@ +# Always ships this packages - we need them for grains +{% if grains['os'] == 'Debian' and grains['oscodename'] != 'squeeze' or grains['os'] == 'Ubuntu' %} +hsh_python_packages_salt: + pkg.installed: + - pkgs: + - python-netifaces + - python-psutil + +{% elif grains['os'] == 'FreeBSD' %} +hsh_python_packages_salt: + pkg.installed: + - pkgs: + - net/py-netifaces + - py27-psutil + +{% endif %} diff --git a/hshbase/snmpd/files/default.snmpd b/hshbase/snmpd/files/default.snmpd new file mode 100644 index 0000000..60af2f2 --- /dev/null +++ b/hshbase/snmpd/files/default.snmpd @@ -0,0 +1,3 @@ +# Don't load any MIBs by default. +# You might comment this lines once you have the MIBs downloaded. +export MIBS=UCD-SNMP-MIB diff --git a/hshbase/snmpd/files/snmpd.conf b/hshbase/snmpd/files/snmpd.conf new file mode 100644 index 0000000..b2d713e --- /dev/null +++ b/hshbase/snmpd/files/snmpd.conf @@ -0,0 +1,23 @@ +# Listen on all interfaces - default is good +agentAddress udp:161,udp6:[::1]:161 +# Credentials for SNMPv3 - used in What's Up Gold +createUser hshuser MD5 "hshmonitoringtest" +defaultMonitors yes +# specific disk monitoring +disk / 10000 +disk /var 5% +# also list all other disks +includeAllDisks 10% +iquerySecName hshuser +linkUpDownNotifications yes +# maximum load threshold (1min, 5min, 15min) +load 12 10 5 +master agentx +rouser hshuser +sysContact HsH Webteam +sysLocation HsH IT VDC +# 72 is alright for now. (No idea) +sysServices 72 +# default systemonly view is fine +view systemonly included .1.3.6.1.2.1.1 +view systemonly included .1.3.6.1.2.1.25.1 diff --git a/hshbase/snmpd/init.sls b/hshbase/snmpd/init.sls new file mode 100644 index 0000000..239a909 --- /dev/null +++ b/hshbase/snmpd/init.sls @@ -0,0 +1,38 @@ +{% from "hshbase/map.jinja" import hshbase with context %} + +{% if hshbase.snmpd %} + +{% if grains['os'] == 'Debian' or grains['os'] == 'Ubuntu' %} +hsh_snmpd_installed: + pkg.installed: + - pkgs: [snmpd, snmp-mibs-downloader] + +/etc/snmp/snmpd.conf: + file.managed: + - source: salt://hshbase/snmpd/files/snmpd.conf + - mode: 644 + - user: root + - group: root + +/etc/default/snmpd: + file.managed: + - source: salt://hshbase/snmpd/files/default.snmpd + - mode: 644 + - user: root + - group: root + +hsh_snmpd_service_running: + service.running: + - name: snmpd + - reload: True + - enable: True + - watch: + - file: /etc/snmp/snmpd.conf + - file: /etc/default/snmpd + - require: + - file: /etc/snmp/snmpd.conf + - file: /etc/default/snmpd + - pkg: hsh_snmpd_installed +{% endif %} + +{% endif %} -- GitLab