how to script an alert program in Windows
Results 1 to 9 of 9

Thread: how to script an alert program in Windows

  1. #1
    Member
    Join Date
    Feb 2002
    Posts
    34

    how to script an alert program in Windows

    Hi,
    I am a newly assigned Network Admin of my company. My company's servers usually break down, so my boss asked me to handle the alerting function. That means when one of the server is down, the persons in charge will be notified accordingly by SMS. I am testing the ISA Server. The ISA Server allows us to locate the file that can be run when the alert is on. Thus, I'd like to know which programming languages I can use to build the batch (or any) file that can send SMS to the assigned persons when the alert is on. I heard from my friends that I should do a bit Windows programming, is it a good tool?
    Thanks for your help in advance
    ILCF

  2. #2
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    You could script it in VBscript using WMI to ping and look at down boxes. These links may help:

    http://www.activexperts.com/asmssrvr/

    but I think the above costs money. The code in the ASP script at the site below may help as well:

    http://www.15seconds.com/issue/010327.htm

    Good luck, let us know if it helps or not.

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    i believe your asking for an action that isa can take when a server is down. its been awhile since ive had isa here.

    notify.bat
    -------------------------
    net send <computer> ServerName is down

    if im not understanding you correctly and you need to check if a server is up you can schedule a bat to run every so often from another computer that no ones working on:

    notify.bat
    ---------------------------
    @echo off
    echo net send <ComputerName> server is down &gt;0.bat
    ping -n 1 &lt;server&gt; |find /c "Reply" &gt;isthere.bat
    call isthere.bat
    del isthere.bat
    del 0.bat

    you can incorporate this into a loop with 'sleep.exe' which comes with the resource kit and just let it run.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

  5. #5
    Banned
    Join Date
    Jun 2003
    Posts
    1,302
    I would personally say perl would be the language for you to pick up. (I am partial to perl though.)

    It will also help you with your admining.

    To set up a script that goes off when the server goes down, you need to know what happens to get your server to go down. Once you know that, you shouldn't need a script, because you should start working on fixing what is taking your server down.

    If you tell me what the file is that takes your server down, I will write a little script that will run in the background, and let you know if your server is acting stupid/has gone down.

  6. #6
    Banned
    Join Date
    Apr 2003
    Posts
    1,146
    An excellent reference to keep handy for this kind of thing is Microsoft Windows 2000 Scripting Guide, available from Microsoft Press. You might want an assistant to carry it around for you. I think there is a new edition out for Win2k3. Not much difference, really. It is a well-written book with ready-to use example scripts in the text and CD.

    The companion CD untilities make it so simple to create the kinds of scripts and alerts you want to use that you can probably get most of the work done in a couple days. You can use VBScript, WMI, batch and/or java natively, without adding run-time packages or agents to your systems.

    I run a number of babysitter scripts that watch for specific services (badly done third-party services that fail on a random basis) on specific machines. Works great.

    One way to avoid having to write everything from scratch is to download BigBrother (free monitoring system, Google: BigBrother). The drawback is that it requires agents on all the system you want to monitor, and getting it to quit flooding your SMTP queues is a bit of a task.

    There are commercial agent-less tools, but they cost $$.

  7. #7
    Member
    Join Date
    Feb 2002
    Posts
    34
    Thanks a lot for your help. I find them really useful in carrying on my work. My concern was to create a program that can trigger an alert when one of the server is down (I mean the network connection). And the action of the alert is to send SMS. I hope I can implement those code you recommended

    But now I really face a difficult problem. Below is my company's server network (the ISA server, I'm thinking, should be placed before the switch)
    ........
    |
    |
    |
    ISA Server
    |
    |
    Switch
    |
    |
    |
    -----------------------------------------------------------------
    | | | |
    | | | | .........
    | | | |
    server server server server


    All the IP addresses of the servers are public addresses (and belong to class C, default subnet mask). Thus my ISA Server needs to have 2 network adapters in order to connect to the switch and to the external devices (in this case, the router). Thus, if the 2 IP addresses on the ISA Server computer belong to the same subnet (in my case, this is a class C, default subnet 255.255.255.0), I don't know if the ISA Server can work well with the functions of a firewall, monitoring, alerting... And I am not sure if my colleagues can do the remote control to the servers through the ISA server computer.
    In this case, the ISA Server works like a router. But a router has its ip addresses which belong to different subnets. Because usually I know that the 2 IP addresses of the 2 sides of a device should be in different subnets.
    So, do you have any comments
    Please help. I'm really stressful to come up with the final design so that the real implementation can be done as soon as possible
    ILCF

  8. #8
    Banned
    Join Date
    Apr 2003
    Posts
    1,146
    You are going down the right road. Much depends on if you are using ISA 2004 or an earlier version. ISA 2004 will simplify a lot of the detailed routing. If you have the firewall/proxy inline between your network switch and the router, you just need to make sure that your ISA is configured to route the traffic from the one side to the other side. You will need an IP assigned from the router (ISP or other provider?) for the upside port(s), and your own private or public IP for the downside port(s)

    You may want to set your servers to private IPs and put a private IP on the internal port of the ISA server. ISA 2004 allows you to publish Web, DNS and other servers from inside your network, so you don't _have_ to put public IPs on those systems.

    If you have any idea of how much traffic you are going to have flow through the firewall/proxy, that will have an impact on how you size the system you place in the ISA spot. You might want to put more than two NICs on the system. Say, four dual-port gig NICs. Team one set of ports to one IP, and the other set of ports to the other IP. This enhances throughput. Then you need to look at HD size and speed (caching), memory and processor(s). Put an MRTG (Google: MRTG) monitor together and set it up to look at the uplink port on your switch. If the graph is maxed all the time, you'll be adding to the bottleneck with and underpowered ISA box.

    Hope this helps.

  9. #9
    Member
    Join Date
    Feb 2002
    Posts
    34
    Thanks rapier57, I learn a lot from your comments
    However, the problem is the IP address of the servers are all public IP addresses. I can't change them to private IP addresses (because that will change the whole server system, while I'm just a newly assigned and unexperienced Admin)
    So I guess I will demand the IP address for the upside port of the ISA Server computer from the ISP (in this case, it is SingTel), and the downside port IP address would be a public one
    ILCF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •