Sunday, July 24, 2016

MikroTik Send Email When CPU Goes On 100%



/system script
add comment="Send Email When CPU  Goes 100%(www.itlearnweb.com)" name=cpu owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":global sub1 ([/system identity get name])\r\
    \n:global sub2 ([/system clock get time])\r\
    \n:global sub3 ([/system clock get date])\r\
    \n:global sub4 \"CPU LOAD 100%\"\r\
    \n:global adminrece #YOUR@gmail.com\r\
    \n:global gmailid #YOUR@gmail.com\r\
    \n:global user #USER\r\
    \n:global gmailpwd #YOUR PWD\r\
    \n:global gmailip 74.125.136.108\r\
    \n/tool e-mail \r\
    \nset address=\$gmailip from=\$gmailid password=\$gmailpwd port=25 start-tls=yes user=\$user\r\
    \n/tool e-mail send to=\$adminrece subject=\"\$sub4 \$sub3 \$sub2 \$sub1\" body=\"Please Check something is wrong ##CPU 100%## \"\r\
    \n/"
/system scheduler
add comment="Send Email When CPU  Goes 100%(www.itlearnweb.com)" interval=5s name=cpu on-event=\
    ":if ([ /system resource get cpu-load]>100) do={ /system script run [find name=cpu]; }\r\
    \n/" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
/system note set note="Server Configuration By <HAMZA KHALIL> (www.itlearnweb.com)" show-at-login=yes



3 comments: