Hello Everybody,
could you please tell me the Best way to monitor Database Server based on OS Linux and Microsoft
Thaaaanks
could you please tell me the Best way to monitor Database Server based on OS Linux and Microsoft
Thaaaanks
[root@z347 ~]# getenforce #check SELinux status
Enforcing
[root@z347 ~]# setenforce 0 #trun off SELinux
[root@z347 ~]# getenforce #check SELinux status
Permissive
[root@z347 ~]# grep zabbix /etc/passwd #note the home dir for user 'zabbix'
zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin
[root@z347 ~]# grep "^Hostname=" /etc/zabbix/zabbix_agentd.conf #note hostname if plan to use active checks
Hostname=Zabbix server
[root@z347 ~]# grep "^Include" /etc/zabbix/zabbix_agentd.conf #make sure 'zabbix_agentd.d' direcotry is enabled
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@z347 ~]# grep -v "^$\|^#" /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf #output active content of MySQL metric query. note the HOME dir
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
[root@z347 ~]# ls -la /var/lib/zabbix/.my.cnf #necessary permissions and owner
-rw-------. 1 zabbix zabbix 47 May 8 02:18 /var/lib/zabbix/.my.cnf
[root@z347 ~]# cat /var/lib/zabbix/.my.cnf #direct content
[client]
user=zabbix
password=TaL2gPU5U9FcCU2u
[root@z347 ~]# sudo -H -u zabbix bash -c 'zabbix_agentd -t mysql.status[Uptime]' #test key from 'zabbix' user. in this way we ensure zabbix agent can reach the credentials to access DB
mysql.status[Uptime] [t|3477]
[root@z347 ~]# systemctl restart zabbix-agent #restart agent
atabases(master)\Active Transactions"][root@z347 ~]# getenforce #check SELinux status
Enforcing
[root@z347 ~]# setenforce 0 #trun off SELinux
[root@z347 ~]# getenforce #check SELinux status
Permissive
[root@z347 ~]# grep zabbix /etc/passwd #note the home dir for user 'zabbix'
zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin
[root@z347 ~]# grep "^Hostname=" /etc/zabbix/zabbix_agentd.conf #note hostname if plan to use active checks
Hostname=Zabbix server
[root@z347 ~]# grep "^Include" /etc/zabbix/zabbix_agentd.conf #make sure 'zabbix_agentd.d' direcotry is enabled
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@z347 ~]# grep -v "^$\|^#" /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf #output active content of MySQL metric query. note the HOME dir
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
[root@z347 ~]# ls -la /var/lib/zabbix/.my.cnf #necessary permissions and owner
-rw-------. 1 zabbix zabbix 47 May 8 02:18 /var/lib/zabbix/.my.cnf
[root@z347 ~]# cat /var/lib/zabbix/.my.cnf #direct content
[client]
user=zabbix
password=TaL2gPU5U9FcCU2u
[root@z347 ~]# sudo -H -u zabbix bash -c 'zabbix_agentd -t mysql.status[Uptime]' #test key from 'zabbix' user. in this way we ensure zabbix agent can reach the credentials to access DB
mysql.status[Uptime] [t|3477]
[root@z347 ~]# systemctl restart zabbix-agent #restart agent
Comment