Guy's,
On my homepage website I want to display the current status of our server. The idea I have is to ping (or send my ip address) to our server every 5 mins and the result I get back should result (and display on my homepage) in a success or failure of the server.
Can someone please help me with the coding [PERL] for this or just start me off?
Many Thanks in advance.
Regards
Ravi
7 1962 miller 1,089
Recognized Expert Top Contributor
Greetings Ravi,
This seems like a strange goal. You want to display the network status of a server on a webpage located on the server? It seems apparant to me that if you can reach the webpage then you already know the server is up.
Anyway, putting aside my possible misunderstandin g of your goal, it sounds like all you need is a perl daemon and a database.
The daemon/script simply pings some external location and updates the result to a database. The webpage then pulls the data from the database to display the status for whatever time period you wish to report. The only module that is really required for this is cpan Net::Ping
Otherwise, all you need is use of the sleep function and know how to update a database.
- Miller
The task given to me is from work, they require a 'status' for the two servers they look after. This status of the servers will be displayed on the Content Management System, so that clients can see the update to date status of the servers.
Miller I'm a trainee Perl developer and you have so far truely helped me many times. Many many thanks mate.
Cheers
Ravi
miller 1,089
Recognized Expert Top Contributor
Ok. Well given that, what I described to you should work.
- Miller
Guy's,
If I was using a CSV file as apposed to a database how would that work? Do I just constantly update the CSV file or create a new one each time.
Many Thanks
Merged Thread: How to create a CSV file once I have pinged the server?
Hi Guy's,
Firstly I'm going to ping (Net::Ping) two servers, then I want to create a CSV file to store the server status.
How can I go about generating a csv file [in PERL] and then using that CSV to update our website homepage with the Current Server Status.
Many Thanks in advance.
miller 1,089
Recognized Expert Top Contributor
I would be tempted to append to one CSV file, but setup an automatic log rotating by naming the file according to the current year and month. Something like this would work: -
# Giant Loop
-
for (;;) {
-
# Code for Server Checking Here.
-
-
-
-
# Output Data
-
if ($csv->combine(time, $status)) {
-
my $outfile = OUTDIR . OUTPREFIX . strftime("%Y%m",localtime) . '.csv';
-
open (OUT, ">> $outfile") or die "Can't open $outfile: $!";
-
print OUT $csv->string, "\n";
-
close OUT;
-
} else {
-
die "combine() failed on argument: ", $csv->error_input, "\n";
-
}
-
-
sleep SLEEP_TIME;
-
}
-
-
1;
-
-
__END__
-
And to find the current file for parsing, the following code would work: -
use constant OUT_DIR => '/this/is/your/datadir/';
-
-
my $file = (sort glob(OUT_DIR . "*"))[-1];
-
If you update every 5 minutes, then you can expect the monthly log file size to reach 8640 times the size of the line for each status. So probably a max size of 200k conservatively.
- Miller
miller 1,089
Recognized Expert Top Contributor
Hi Guy's,
Firstly I'm going to ping (Net::Ping) two servers, then I want to create a CSV file to store the server status.
How can I go about generating a csv file [in PERL] and then using that CSV to update our website homepage with the Current Server Status.
Many Thanks in advance.
I've already answered this question in the other thread. I will now merge those threads.
- Miller
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sleiman |
last post by:
Hello newsgroup readers
I am looking for a php implementation for xmlrpc ping server. Do you
have any idea where I can find one?
Using mod_pubsub I can have a very nice blogchatter style of xmlrpc
ping server, but it is in perl and my client's system admin has moved
away from perl.
What my client wants: a real-time listing of blogs most recently
|
by: David Lozzi |
last post by:
I need to determine from ASP if the database server is up and running, and
if it isn't ping another database server. I posted this before about a
different client, and I was told to request a file from the IIS server, and
if I cannot retrieve it, the server is not there. I cannot use this method
due to one database box being Solaris and the other UNIX, so I need to ping.
Thanks!
David Lozzi
|
by: gallaczmit |
last post by:
Will this code give me a true view of a computer's status? All I am
looking for is to see if the computer is reachable or not.
My end goal is to get a list of IP addresses from a MS SQL Server, see
if the IP is reachable(if yes I will assume the pc is operational),
update the database with the result and generate a web page displaying
the results.
I am using port 135 because I have an all windows network and this
port should be open...
|
by: Ed |
last post by:
I've attached some VB.NET code I've hacked together (some taken from
MS examples & newsgroup postings) that will perform a ping or
IcmpSendEcho using the icmp.dll (see this for more info:
http://support.microsoft.com/default.aspx?scid=kb;en-us;170591 ).
The problem I have is in order to perform a discovery/ping of an
entire subnet (192.168.1.* for instance) I have to do a FOR loop to
itterate through all of the addresses. That it seems...
|
by: Neel |
last post by:
I am trying to "ping" a remote host in my C++/Redhat Linux code to
check whether that host is connected or not.
if (0 == system("ping -w 2 192.168.0.2))
But, in both cases (connected/disconnected), system call returns 0. Can
someone please show what I am doing wrong? How to check the actual
result of the ping status using C++ on Redhat linux ?
Thanks in advance.
| |
by: Krish |
last post by:
All,
I have an offline application that works online for some data
syncronization. For data syncronization I access a webservice. I want
to show whether my application is online or not by checking whether
the application is able to access the webservice.
If the webservice is accessible, the application is online. otherwise
it is offline
What is the best way to ping a url in C# ?
|
by: =?Utf-8?B?QWxleCBLLg==?= |
last post by:
Hi all
I need a simple program that allows me to check if an IP address is
pingable. I am not going to send/receive anything to the remote host, just
check if it is visible.
Something like this:
private bool CheckIPAddress(string address)
{
if (Ping(address))
|
by: patelxxx |
last post by:
PERL Code to Ping a server:
#!c:/Perl/bin/perl.exe
use Net::Ping;
use strict;
use warnings;
my $host = 192.168.0.1; # Real value removed by MODERATOR
|
by: imughal |
last post by:
I got the perl script which does following task.
This solution reads in a line from a text file that is passed in as input parameter 1 to a Perl script. This script will then ping the machine using TCP pings to the remote hosts echo port and will return up/down and the ping response time. A second optional attribute may be passed in that will set the default timeout for the ping response.
Text file format:
127.0.0.0 localhost...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |