Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from hddtemp to smartmontools #281

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions roles/debian/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions src/debian/snmp_tempdisk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
insatomcat marked this conversation as resolved.
Show resolved Hide resolved

/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
1 change: 1 addition & 0 deletions src/debian/snmpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/debian/sudoers/Debian-snmp
Original file line number Diff line number Diff line change
@@ -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 ""
Expand Down