LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2002, 10:58 PM   #1
gboutwel
Member
 
Registered: May 2001
Location: Norton, KS
Distribution: Mandrake, Xandros, and Debian 3.0 (Woody) as a proxy
Posts: 103

Rep: Reputation: 15
PPP Stats, Connected time


I've got a console-mode FW machine. How can I determine how-long this machine's ppp interface has been connected?

 
Old 07-19-2002, 06:44 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
A simple script which compares the current time and the time stamp of when it connected should work. When ppp connects it should send some kind of message to syslog. You can get the last connection line from the log file. And then compare it with the current time to figure out how long you've been online.
You could also add a simple command which places the timestamp in a file when you connect. Maybe something like:
date > /var/run/pppconnected
 
Old 07-19-2002, 11:35 AM   #3
gboutwel
Member
 
Registered: May 2001
Location: Norton, KS
Distribution: Mandrake, Xandros, and Debian 3.0 (Woody) as a proxy
Posts: 103

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Mik
A simple script which compares the current time and the time stamp of when it connected should work. When ppp connects it should send some kind of message to syslog. You can get the last connection line from the log file. And then compare it with the current time to figure out how long you've been online.
You could also add a simple command which places the timestamp in a file when you connect. Maybe something like:
date > /var/run/pppconnected
Mik thanks. I had thought of that I just figured there was something easier or better that was already done. How does PPP know how long it's been connected? If I loose connection, or the peer drops on me it reports how long I was connected in syslog. How does it know? If it knows isn't there some way that I could get it to tell me that. I can get it to tell me stats like how many packets it's sent/recieved.

Again, thanks.
 
Old 07-22-2002, 03:12 AM   #4
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
I suppose it probably keeps an internal timer of how long it has been connected. I've never used ppp so I wouldn't know if it's possible to get that information. I'd say maybe check the manpages for something like that.

But it shouldn't be to hard to write a simple script. You can easily extract the timestamp from the log file by doing something like:

timestamp=`grep "pppd: Connect" /var/log/messages | tail -n 1 | cut -b 1-15`

Might need to modify that a bit since I don't know what messages get put into the log file.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with too many 'ppp' interfaces started at boot time utumno Linux - Networking 1 06-12-2005 04:11 AM
Connected to Internet w/wvdial but ppp fails to 'negotiate' Guvvy Linux - Newbie 11 02-09-2005 10:14 AM
Limit connected items connected to my router andersh3 Linux - Newbie 1 03-16-2004 11:10 AM
Alcatel ADSL Mandrake 9.2, Gnome - Connected ONE time, and never once since! GRRR! Ygarl Linux - Networking 9 03-13-2004 07:00 PM
who is connected via ppp to linux server itayemi Linux - Networking 0 09-05-2003 05:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration