Get the App
SLTechnology News&Howtos  ›  Servers  › 

Zabbix add monitoring items, trigger alarm, etc.

Shulou Source: shulou.com Published: 2022-06-02 18:57:45 10月02日 Update

1. Add a monitoring item

Finally, choose to add and it is done.

two。 Add graphic display

3. Set trigger

4. Call the police

Script alarm-add alarm media first

Add an action (in what circumstances trigger the alarm)

Server: {HOST.NAME} occurrence: {TRIGGER.NAME} Fault alarm Host: {HOST.NAME} alarm address: {HOST.IP} Monitoring Project: {ITEM.NAME} Monitoring value: {ITEM.LASTVALUE} alarm level: {TRIGGER.SEVERITY} current status: {TRIGGER.STATUS} alarm Information: {TRIGGER.NAME} alarm time: {EVENT.DATE} {EVENT.TIME} event ID: {EVENT.ID}

Add a medium to the sender to send to the external network (here I just called a script)

Cat / etc/zabbix/zabbix_server.conf | grep alertscripts # Open the configuration file to find the location of the alarm script

Cd / usr/lib/zabbix/alertscripts # cd inside

Vim cs.sh # create an alarm script. The name of the script should be the same as that defined earlier.

#! / bin/bash/usr/bin/echo "send to: $1" > > / tmp/cs.txt/usr/bin/echo "summary: $2" > > / tmp/cs.txt/usr/bin/echo "" > > / tmp/cs.txtfor I in $3 Do/usr/bin/echo $I > > / tmp/cs.txtdone/usr/bin/echo "#" > > / tmp/cs.txt

Once you have created the script, remember to give it permission to run, and restart zabbix-server.

5. View alarm

I used a running score software to pull the cpu usage to 100%, which triggered the trigger and triggered the alarm.

Vim / tmp/cs.txt # View the alarm content generated by the script

Now that the alarm content can be generated with a script, it is easy to generate an alarm message in api that uses this script to call other alarm software.

PS: there is a small BUG in the action here. If you want to add a user, it cannot be sent without Super Admin privileges.

Tags: Scripts alarms triggers monitoring information content actions media permissions software generation consistency ease host event location usage sender just name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Xiaomi Shulou Tech Info Linux