Jump to content

Поредно питане за скрипт


Recommended Posts

Поредният изровен скрипт, но нещо не мога да схвана как работи.Идеята му е да ми праща известия за появата на нов мак.

Има ли как да се модифицира, така че да съобщава за конкретен мак?

:if ($leaseBound =1) do={
    # Variables
    :local Time [/system clock get time];
    :local Date [/system clock get date];
    :local Comment [/ip dhcp-server lease get value-name=comment number=[/ip dhcp-server lease find address=$leaseActIP]]
    :local DeviceName [/system identity get name];

    # START Send Telegram Module
    :local MessageText "\F0\9F\9F\A2 $DeviceName: New DHCP client %0D%0A Name: $"lease-hostname" %0D%0A Comment: [$Comment] %0D%0A Interface: $leaseServerName %0D%0A IP: $leaseActIP %0D%0A MAC: $leaseActMAC";
    :local SendTelegramMessage [:parse [/system script  get MyTGBotSendMessage source]]; 
    $SendTelegramMessage MessageText=$MessageText;
    #END Send Telegram Module

    # START Send Email Module
    :local SendTo "notify@mhelp.pro";
    :local Subject "\F0\9F\9F\A2 INFO: $DeviceName [$Date $Time] New DHCP client";
    :local MessageText "Name: $"lease-hostname", Comment: $Comment, Interface: $leaseServerName IP: $leaseActIP MAC: $leaseActMAC";
    :local FileName "";
    :local SendEmail [:parse [/system script get SendEmailFunction source]];
    $SendEmail SendTo=$SendTo TextMail=$MessageText Subject=$Subject FileName=$FileName;
    # END Send Email Module
Link to comment
Share on other sites

Това е скрипт за dhcp сървъра. Трябват ти и две допълнителни функции - за пощата и за телеграма.

И да, с един if ( $leaseActMAC = ... ще бъде за конкретен мак.

Link to comment
Share on other sites

За пощата ... аха.Телеграма не ми трябва.

[:parse [/system script get SendEmailFunction source]]; тук тябва да съм настроил изпращане по мейл, така ли?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.