- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how generate an event when only an interface beco...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2006 03:24 AM
07-12-2006 03:24 AM
to avoide receiving a lot of email alert due interface reset.
how to make the event generated only when an interface is down for exemple at least for 3 minutes?
many Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2006 05:14 AM
07-12-2006 05:14 AM
Re: how generate an event when only an interface become down after N minutes ?
if interface down then
check if lock file exists
if lock file does not exists
create lock file
send email alert
if lock file exists
do nothing
fi
fi
if interface up then
remove lock file
send email notification
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2006 11:01 PM
07-12-2006 11:01 PM
Re: how generate an event when only an interface become down after N minutes ?
So as soon as your interface goes down.
Another thread starts and counts the time (3 minutes in your example).
Upon this thread's closure-the parent will generate an email...
Hope it helps.
P.S.
How do you monitor the router's interface - just curious.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2006 11:11 PM
07-12-2006 11:11 PM
Re: how generate an event when only an interface become down after N minutes ?
I have made a script tha combine the two suggestions
lockfile and sleep fonction
it work now :-)
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 02:02 AM
07-13-2006 02:02 AM
SolutionPlease see also:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 12:23 AM
07-18-2006 12:23 AM
Re: how generate an event when only an interface become down after N minutes ?
the first one is executed when for exemple an interface goes down and the seconde when it become up:
=================================================
when interface goes down this script is executed
================================================
#!/opt/OV/bin/Perl/bin/perl
my $arg = $ARGV[0];
my @indexe = (2, 3, 9, 10, 11, 25);
if($arg == $indexe[0])
{
system("touch lockfile");
sleep 10;
$file = 'lockfile';
if(-e $file)
{
#if file existe send mail to toto
system "/opt/OV/bin/sendmail 'inteface is Down' toto@";
exec "rm lockfile";
}
}
==============================================
when interface become up this script is executed
===============================================
#!/opt/OV/bin/Perl/bin/perl
my $arg = $ARGV[0];
my @indexe = (2, 3, 9, 10, 11, 25);
if($arg == $indexe[0])
{
$file = 'lockfile';
if(-e $file)
{
exec "rm lockfile";
}
else{
system("/opt/OV/bin/sendmail 'interface is up' toto@");
}
}
===============================
when i execute the script at the unix command line the lockfile is created . but when i shutdown the interface evenif the lockfile is not created i receive "interface is down "email notification.
many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 12:58 AM
07-18-2006 12:58 AM
Re: how generate an event when only an interface become down after N minutes ?
--------------------------------------------------------------------------------
i have created thoses two scripts
the first one is executed when for exemple an interface goes down and the seconde when it become up:
=================================================
when interface goes down this script is executed
================================================
#!/opt/OV/bin/Perl/bin/perl
my $arg = $ARGV[0];
my @indexe = (2, 3, 9, 10, 11, 25);
Hm,
assigning points to all responds will be nice...
From your code it looks like if the argument to the script is "2"; then create the file ; then check if the file exists (of course it will exist -you created it); then send e-mail.
if($arg == $index[0])
{
system("touch lockfile");
sleep 10;
$file = 'lockfile';
if(-e $file)
{
#if file existe send mail to toto
system "/opt/OV/bin/sendmail 'inteface is Down' toto@";
exec "rm lockfile";
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 01:04 AM
07-18-2006 01:04 AM
Re: how generate an event when only an interface become down after N minutes ?
2. try to increase the sleep time from 10 to 30 (for test purposes).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 02:09 AM
07-18-2006 02:09 AM
Re: how generate an event when only an interface become down after N minutes ?
how to specify the path for the created lockfile ?
or
without specifying the path where the lockfile is created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 02:27 AM
07-18-2006 02:27 AM
Re: how generate an event when only an interface become down after N minutes ?
Specifying lockfile with path is very simple:
$lockfile="/tmp/lockfile";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 03:18 AM
07-18-2006 03:18 AM
Re: how generate an event when only an interface become down after N minutes ?
..
$lockfile="/opt/OV/bin/lockfile";
system "touch $lockfile";
sleep 30;
if(-e $file)
..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 04:30 AM
07-18-2006 04:30 AM
Re: how generate an event when only an interface become down after N minutes ?
if ( -e $lockfile) {
"some expression";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2006 06:17 AM
07-26-2006 06:17 AM
Re: how generate an event when only an interface become down after N minutes ?
but the problem remain:
the first script create the file but the seconde doesn't delete the created file:
i'm sure that the first script is executed first but the second script wait until the first script terminate.
evenif the the time between the two stats (Down &UP) is enough lower than 160second.
logup*(see the script) containe always this error:
rm: /opt/OV/bin/lockfile non-existent
-------
_______________________________________
Script_DOWN
_______________________________________
.
.
if($arg == $indexe[0])
{
$lockfile="/opt/OV/bin/lockfile";
system "touch $lockfile";
sleep 150;
if(-e $lockfile)
{
system "/opt/OV/bin/sendmail 'Interface Down' toto@st.com";
exec "rm $lockfile > /opt/OV/bin/lockdown 2>&1";
}else
}
.
.
_________________________________________
Script_UP
_______________________________________
#!/opt/OV/bin/Perl/bin/perl
#!/bin/sh
.
.
if($arg == $indexe[0])
{
$lockfile="/opt/OV/bin/lockfile";
if(-e $lockfile){
exec "rm $lockfile > /opt/OV/bin/lockup 2>&1";
}
else{
system "/opt/OV/bin/sendmail 'Interface Down' toto@st.com";
}
}
else
{}
.
.