Server/System Health Status Report Using Batch Programing in HTML Format


Server/System Health Status Report with Basic Information Using Batch Programing in HTML Format



Topic:  Generating the basic Servers/System health information using batch programing in html format for knowing the availability of the server/system



This script can generate the below information

  • Host Information: System, CPU, Processorcer Speed, Host Name, OS Version, Kernel Version, CPU Make, No of Cores,
  • Boot Information : Host Name, Uptime in No of Days, Last Reboot, 
  • Network Information : IP Address, Subnet mask, DNS, MAC Address, Gateway, Packets Received and Packets Sent.
  • Disk Information : Device Name, File System, mount point, Total Disk Size, Availabe Space, Used Space.

This script is generated using WMIC, POWERSHELL and simple HTML coding.






This script generates in HTML format and also can send a email reports with a small email client software sendEmail which can be downloaded with below link.


Sample Report: 







* Most important is please install Powershell 2.0 or latest before running this script

Please download using the below link:

For sending the email automatically, please download this email client




To send email, please follow this:

General Usage:



Synopsis:  sendemail -f ADDRESS [options]

  Required:
    -f ADDRESS                from (sender) email address
    * At least one recipient required via -t, -cc, or -bcc
    * Message body required via -m, STDIN, or -o message-file=FILE

  Common:
    -t ADDRESS [ADDR ...]     to email address(es)
    -u SUBJECT                message subject
    -m MESSAGE                message body
    -s SERVER[:PORT]          smtp mail relay, default is localhost:25

  Optional:
    -a   FILE [FILE ...]      file attachment(s)
    -cc  ADDRESS [ADDR ...]   cc  email address(es)
    -bcc ADDRESS [ADDR ...]   bcc email address(es)
    -xu  USERNAME             username for SMTP authentication
    -xp  PASSWORD             password for SMTP authentication

  Paranormal:
    -b BINDADDR[:PORT]        local host bind address
    -l LOGFILE                log to the specified file
    -v                        verbosity, use multiple times for greater effect
    -q                        be quiet (i.e. no STDOUT output)
    -o NAME=VALUE             advanced options, for details try: --help misc
        -o message-content-type=<auto|text|html>
        -o message-file=FILE         -o message-format=raw
        -o message-header=HEADER     -o message-charset=CHARSET
        -o reply-to=ADDRESS          -o timeout=SECONDS
        -o username=USERNAME         -o password=PASSWORD
        -o tls=<auto|yes|no>         -o fqdn=FQDN


  Help:
    --help                    the helpful overview you're reading now
    --help addressing         explain addressing and related options
    --Help message            explain the message body input and related options
    --help networking         explain -s, -b, etc
    --help output             explain logging and other output options
    --help misc               explain -o options, TLS, SMTP auth, and more


Example :


\scripts\sendEmail.exe -f fromemailid.com -o message-file=\scripts\messagefile.txt -u subject message -t toemailid@test.com  -a \scripts\hname.html -s smtp.gmail.com:587 -xu senderemailid -xp password 


Modifications if required in the script

If you want to remove or add  a mounted drive you can modify at this place














If you remove the above code section second drive information will be removed in the reports. and if you want to add/remove disk drive information  just copy the above code from the script below it and instead of DeviceID='D' please give your own drive Device ID which you want to desire in the scripts.






Thanks 

Chandra Prakash Kadarla
Sr. System Administrator

Always ready to accept suggestions and enhancements.

Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Upgrade PV Drivers on Windows Instances

How to configure Incremental backups for MSSQL Database