Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Batch monitor whether the server service is normal

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The abnormal stop of service will be encountered in the work. In view of these problems, a monitoring of service status is done.

For example, time synchronization service NTP, abnormal stop, no alarm system is a very dangerous situation.

This paper adopts:

Shell script + Custom Monitoring zabbix to realize SMS alarm

The script is as follows:

#! / bin/bash# Confirm OS Versionunset OS_VERSIONuname-r | grep el5 > / dev/null & & OS_VERSION=el5uname-r | grep el6 > / dev/null & & OS_VERSION=el6uname-r | grep el7 > / dev/null & & OS_VERSION=el7# Begin check if ["$OS_VERSION" = "el5"-o "$OS_VERSION" = "el6"]; then pidof ntpd & > / dev/null if [$?-ne 0] Then ntpd_service_status=false # # can define a variable as a parameter and customize it to echo "ntpd_service_status $ntpd_service_status" echo "DOWN" echo "Check [ntp service status] in the monitoring item. FAILED "else ntpd_service_status=true # echo" UP "fielif [" $OS_VERSION "=" el7 "]; then pidof chronyd & > / dev/null if [$?-ne 0]; then ntpd_service_status=false echo" DOWN "echo" Check [chrony service status]. FAILED "else ntpd_service_status=true echo" UP "fifi

Zabbix script parameter transfer storage path

* * installed by yum * *

/ usr/lib/zabbix/alertscripts/

Writing a simple script for passing parameters

#! / bin/bashaddressee=$1theme=$2content=$3 echo "$addressee" > > / tmp/test.txt to verify whether zabbix is calling a script, write an echo living experiment environment that is not available from Ali Dayu of the company.

Zabbix alarm medium setting

Configuration action

Configure user-alarm medium

Configure to the host and trigger the alarm manually.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report