stighy
stighy

Reputation: 7170

Best approach to create a simple asp.net server monitor (using ping)?

I would like to monitor if a server is up or down, and i think, pinging it is the best way to solve my problem. How can i 'schedule' an asp.net recurrent call to a function TestServer that ping to a list of servers (taken from a database) ? Maybe, is it best to split my software in two part ?

  1. The ASP.NET views that load data from database (server, status (up down))

  2. A.. command line .net application that each ..1 minutes run pings ?

Thanks

Upvotes: 1

Views: 1105

Answers (2)

testep02
testep02

Reputation: 43

Why not use Nagios to monitor your server? You can find it here: http://www.nagios.com/. This software was written to monitor any type of server, software on a server, network connections, databases, routers, etc. Once installed, it has a full suite of plug-ins out-of-the-box. If the default plug-ins aren't powerful enough for you, you can also write your own.

Nagios has the ability to monitor environments on either Linux or Windows. Plug-ins can be written in any language as long as they conform to the requirements. We have this tool running at my company and have it monitoring every system we have. It provides a nice dashboard where you can assign systems to particular users so each team can monitor their own systems. This is the way I would go, honestly.

EDIT: Since it sounds like Nagios is out of the question, your best bet would be to write a console app that pulls a list of servers and pings them. Instead of using a database for this, create a config file that contains the list of servers. To run the app, use the Windows scheduler to schedule this app to be run at X minute intervals and then either write the results to a log file, or do something else with them. Instead of having the app running full-time in the background with a timer, the scheduler would be your best bet.

Upvotes: 1

EkoostikMartin
EkoostikMartin

Reputation: 6911

I would probably create a single console app to do the work (query database, run ping tests, record results), and use Windows Task Scheduler to execute this program at specific time intervals.

http://windows.microsoft.com/en-us/windows7/Schedule-a-task

Inside your console app, use the HttpWebRequest class to do your pings - http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

Upvotes: 0

Related Questions