Skip to content

Commit

Permalink
execute dmesg by sudo
Browse files Browse the repository at this point in the history
Some distributions restrict the usage of dmesg.
For better portability we use sudo now.
  • Loading branch information
Marc Schoechlin committed Jan 15, 2018
1 parent 5604d50 commit f67c384
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 118 deletions.
2 changes: 1 addition & 1 deletion extension-files/agent-config/zabbix_dmesg.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UserParameter=linux.dmesg,/usr/bin/zabbix_check_dmesg
UserParameter=linux.dmesg,sudo /usr/bin/zabbix_check_dmesg
12 changes: 0 additions & 12 deletions extension-files/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,3 @@ else
echo "Notice: no postinstall implemented for you distribution, contributions and merge requests are very welcome ;-)"
fi

if (grep -qi "Centos" /etc/os-release);then
echo "Installing SELinux rules"
checkmodule -M -m -o /var/run/zabbix/zabbix_agent.mod /usr/share/zabbix-agent-extensions/selinux/centos_zabbix_agent.te
semodule_package -m /var/run/zabbix/zabbix_agent.mod -o /var/run/zabbix/centos_zabbix_agent.pp
semodule -i /var/run/zabbix/centos_zabbix_agent.pp
fi

if (grep -q "Debian" /etc/os-release);then
echo "Installing sysctl config"
echo "kernel.dmesg_restrict=0" > /etc/sysctl.d/99-dmesg.conf
sysctl -p
fi
2 changes: 1 addition & 1 deletion extension-files/sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Defaults:zabbix !syslog
zabbix ALL=(ALL) NOPASSWD: /usr/bin/zabbix_check_multipath
zabbix ALL=(ALL) NOPASSWD: /usr/bin/zabbix_check_smartmontools
zabbix ALL=(ALL) NOPASSWD: /usr/bin/mailq

zabbix ALL=(ALL) NOPASSWD: /usr/bin/zabbix_check_dmesg
47 changes: 34 additions & 13 deletions zabbix_templates/3.4/custom-os-linux.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.4</version>
<date>2018-01-03T09:40:59Z</date>
<date>2018-01-15T03:33:16Z</date>
<groups>
<group>
<name>Templates</name>
Expand Down Expand Up @@ -730,7 +730,7 @@ A man with one watch knows what time it is. A man with two watches is never sure
</item>
<item>
<name>Memory in Userspace</name>
<type>7</type>
<type>15</type>
<snmp_community/>
<snmp_oid/>
<key>os.linux.memory.userspace</key>
Expand Down Expand Up @@ -2808,10 +2808,27 @@ md1 : active raid1 sdb2[2] sda2[0]&#13;
<master_item_prototype/>
</item_prototype>
</item_prototypes>
<trigger_prototypes/>
<trigger_prototypes>
<trigger_prototype>
<expression>{Custom - OS - Linux:vfs.dev.write[{#BLOCKDEVICE},ops,avg1].avg(#10)}&gt; {$DISK_HIGH_IOPS_LIMIT}</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>Blockdevice {#BLOCKDEVICE} write limit {$DISK_HIGH_IOPS_LIMIT}/sec reached, currently {ITEM.VALUE1}/sec</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>1</status>
<priority>1</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
</trigger_prototypes>
<graph_prototypes>
<graph_prototype>
<name>Blockdevice {#BLOCKDEVICE} BPS</name>
<name>Blockdevice {#BLOCKDEVICE} IOPS</name>
<width>900</width>
<height>300</height>
<yaxismin>0.0000</yaxismin>
Expand All @@ -2837,25 +2854,25 @@ md1 : active raid1 sdb2[2] sda2[0]&#13;
<type>0</type>
<item>
<host>Custom - OS - Linux</host>
<key>vfs.dev.read[{#BLOCKDEVICE},sps,avg1]</key>
<key>vfs.dev.read[{#BLOCKDEVICE},ops,avg1]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>DD0000</color>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom - OS - Linux</host>
<key>vfs.dev.write[{#BLOCKDEVICE},sps,avg1]</key>
<key>vfs.dev.write[{#BLOCKDEVICE},ops,avg1]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
<graph_prototype>
<name>Blockdevice {#BLOCKDEVICE} IOPS</name>
<name>Blockdevice {#BLOCKDEVICE} SPS</name>
<width>900</width>
<height>300</height>
<yaxismin>0.0000</yaxismin>
Expand All @@ -2881,19 +2898,19 @@ md1 : active raid1 sdb2[2] sda2[0]&#13;
<type>0</type>
<item>
<host>Custom - OS - Linux</host>
<key>vfs.dev.read[{#BLOCKDEVICE},ops,avg1]</key>
<key>vfs.dev.read[{#BLOCKDEVICE},sps,avg1]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>C80000</color>
<color>DD0000</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom - OS - Linux</host>
<key>vfs.dev.write[{#BLOCKDEVICE},ops,avg1]</key>
<key>vfs.dev.write[{#BLOCKDEVICE},sps,avg1]</key>
</item>
</graph_item>
</graph_items>
Expand Down Expand Up @@ -3348,6 +3365,10 @@ md1 : active raid1 sdb2[2] sda2[0]&#13;
</discovery_rules>
<httptests/>
<macros>
<macro>
<macro>{$DISK_HIGH_IOPS_LIMIT}</macro>
<value>150</value>
</macro>
<macro>
<macro>{$DISK_USAGE_PERCENT_ALARM}</macro>
<value>97</value>
Expand Down Expand Up @@ -3418,7 +3439,7 @@ md1 : active raid1 sdb2[2] sda2[0]&#13;
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<resource>
<name>Blockdevice {#BLOCKDEVICE} BPS</name>
<name>Blockdevice {#BLOCKDEVICE} SPS</name>
<host>Custom - OS - Linux</host>
</resource>
<max_columns>1</max_columns>
Expand Down Expand Up @@ -4050,7 +4071,7 @@ This trigger does not recover automatically, to get rid of this trigger, you hav
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<priority>2</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
Expand Down
Loading

0 comments on commit f67c384

Please sign in to comment.