diff --git a/roles/debian/tasks/main.yml b/roles/debian/tasks/main.yml index 4d36e42ea..79d2b2b17 100644 --- a/roles/debian/tasks/main.yml +++ b/roles/debian/tasks/main.yml @@ -410,33 +410,6 @@ line: "{{ logstash_server_ip }} logstash-seapath" state: present -- name: lineinfile in /etc/default/hddtemp file for DISKS - lineinfile: - dest: /etc/default/hddtemp - regexp: '^DISKS=' - line: "DISKS=\"{{ main_disk }} {{ ceph_osd_disk if ceph_osd_disk is defined else none }}\"" - state: present - register: updatehddtemp1 -- name: lineinfile in /etc/default/hddtemp file for RUN_DAEMON - lineinfile: - dest: /etc/default/hddtemp - regexp: '^RUN_DAEMON=' - line: "RUN_DAEMON=\"true\"" - state: present - register: updatehddtemp2 -- name: lineinfile in /etc/default/hddtemp file for INTERFACE - lineinfile: - dest: /etc/default/hddtemp - regexp: '^INTERFACE=' - line: "INTERFACE=\"{{ ansible_host }}\"" - state: present - register: updatehddtemp3 -- name: Restart hddtemp - ansible.builtin.systemd: - state: restarted - name: hddtemp - when: updatehddtemp1.changed or updatehddtemp2.changed or updatehddtemp3.changed - - block: - name: Remove all file in /etc/apt/sources.list.d file: diff --git a/src/debian/snmp_tempdisk.sh b/src/debian/snmp_tempdisk.sh new file mode 100644 index 000000000..fcaa97406 --- /dev/null +++ b/src/debian/snmp_tempdisk.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +/usr/sbin/smartctl --scan | awk '{ print $1 }' | while read i; do + temp=$(/usr/sbin/smartctl -a $i | grep Temperature_Celsius | awk '{ print $10 }') + if [ ! -z "$temp" ] + then + echo "$i;$temp" + fi +done diff --git a/src/debian/snmpd.conf.j2 b/src/debian/snmpd.conf.j2 index 949c9a2b6..cc84589ee 100644 --- a/src/debian/snmpd.conf.j2 +++ b/src/debian/snmpd.conf.j2 @@ -22,4 +22,5 @@ extend virshlist /usr/bin/timeout 2s /usr/bin/sudo -u libvirt /usr/local/bin/snm extend cephstatus /usr/bin/timeout 2s /usr/bin/sudo -u ceph /usr/local/bin/snmp_cephstatus.sh extend cephusage /usr/bin/timeout 2s /usr/bin/sudo -u ceph /usr/local/bin/snmp_cephusage.sh extend diskusage /usr/bin/timeout 40s /usr/bin/sudo /usr/local/bin/snmp_diskusage.sh +extend tempdisk /usr/bin/timeout 2s /usr/bin/sudo /usr/local/bin/snmp_tempdisk.sh agentAddress udp:{{ admin_ip_addr }}:161 diff --git a/src/debian/sudoers/Debian-snmp b/src/debian/sudoers/Debian-snmp index b0c712453..b79ba106a 100644 --- a/src/debian/sudoers/Debian-snmp +++ b/src/debian/sudoers/Debian-snmp @@ -1,5 +1,6 @@ Defaults:Debian-snmp !requiretty Debian-snmp ALL = NOPASSWD:EXEC: /usr/local/bin/snmp_diskusage.sh "" +Debian-snmp ALL = NOPASSWD:EXEC: /usr/local/bin/snmp_tempdisk.sh "" Debian-snmp ALL = (hacluster) NOPASSWD:EXEC: /usr/local/bin/snmp_crmstatus.sh "" Debian-snmp ALL = (libvirt) NOPASSWD:EXEC: /usr/local/bin/snmp_virshlist.sh "" Debian-snmp ALL = (libvirt) NOPASSWD:EXEC: /usr/local/bin/snmp_domstats.sh ""