Monitor some of network services


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Monitor some of network services
# 1  
Old 11-08-2016
Monitor some of network services

Hi

I want to write a script for netflow service
because my service doesnt send any packet to netflow walker (server).
Although the service is started but it does not send any packet to server until i restart the service
I want to write a script in order to restart the service when no packets have been sent to the server.
# 2  
Old 11-08-2016
What operating system are you using?

What shell are you using?

Can you manually restart the service? If so, what command(s) do you use to restart the service? What do you want the script to do that can't be done by putting the command(s) you use to restart the service in a file and executing that file?
# 3  
Old 11-09-2016
my operating system is Fedora linux and interpreter is bash
yes of course i manually restart the service when it does not send packet.
i want to write a script that detect this service does not send packet and then restart automatically.
# 4  
Old 11-09-2016
I repeat:
Quote:
...what command(s) do you use to restart the service? What do you want the script to do that can't be done by putting the command(s) you use to restart the service in a file and executing that file?
And, how do you determine that "the service" does not send a packet?
# 5  
Old 11-09-2016
by tcpdump ,
tcpdump is a tool for capture network traffic packet . i run this command on my system
for example :
tcpdump -i eth0 -p udp and port 9996 -nn

and then i see no any packet send to the server on this port and so restart the service and then every thing is going to OK Smilie Smilie
# 6  
Old 11-15-2016
it Solved

I write this script and it does work

Code:
#!/bin/bash
while  true
do

tcpdump -i ETH1  port 9996  >  /home/log_netflow &
pid=$!
sleep 5
kill $pid
count=`cat /home/log_netflow | wc -l `
echo $count

if  [ $count  -gt 2 ] ;  then

echo " system is working "   >>  /home/service_status

else

echo "system is down "   >>  /home/service_status
/etc/init.d/netflowd  restart
fi

done



Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 11-15-2016 at 07:33 AM.. Reason: Changed [B] to CODE tags.
# 7  
Old 11-15-2016
Looks good!
Only one little efficiency tip
Code:
count=`wc -l < /home/log_netflow`

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. IP Networking

I would like to monitor network traffic for a computer on my network

My son does homework on a school laptop. I was thinking about setting up a gateway on my home network, so that I can monitor web traffic and know if he is doing his homework without standing over his shoulder. Ideally I would like to use the Raspberry Pi Model b that I already have. However, I... (15 Replies)
Discussion started by: gandolf989
15 Replies

2. Shell Programming and Scripting

Monitor the services by script

I developed for monitoring the network connections among the branch servers as I given below as script.But I don't know how to monitor the services through network script whether the services is running or not. eg : I want to check the postgres service for all the branch servers through network... (0 Replies)
Discussion started by: kannansoft1985
0 Replies

3. AIX

How to monitor websphere services down?

if websphere services is down, any unix command or scripts can send alert? (1 Reply)
Discussion started by: rainbow_bean
1 Replies

4. IP Networking

Oracle network services

i have installd oracle 10 on Solaris 10 now i want to access this database from remote machine. -bash-3.00$ tnsping 192.168.92.49 TNS Ping Utility for Solaris: Version 10.2.0.2.0 - Production on 17-DEC-2010 21:06:51 Copyright (c) 1997, 2005, Oracle. All rights reserved. Used... (0 Replies)
Discussion started by: akhaliq22
0 Replies

5. Programming

Help in developing a Network Appliation to monitor pc in a network

I am developing a Network Appliation to monitor computers in a network. Specs are App monitors the current web page viewed in each system App also can shutdown the computer in the network App can show all process run by each computer in the network I am now confused how to start my... (2 Replies)
Discussion started by: valaparambil88
2 Replies

6. HP-UX

how can I get network services

Hi Is there a cmd in hpux 11 to get the network services the network services must display "Listen" like command netstat -an |grep Listen and display the process that is running on a port in HP-Unix at the same time my request can not use lsof -i command,not to install any extral... (2 Replies)
Discussion started by: alert0919
2 Replies

7. UNIX for Dummies Questions & Answers

Search for network services

OK I am a complete newbie to Unix. We have a Sunfire V890 running SUNOS Release 5.9. The Operating Environment is Solaris 9. I have been tasked with determining whether or not specific network and solaris services are enabled or disabled. If the services are enabled I need to disable them. I'm... (12 Replies)
Discussion started by: coachgt1
12 Replies

8. IP Networking

stopping and starting network services

Solaris v5.6 how do you stop and start the network services? (4 Replies)
Discussion started by: Westy564
4 Replies

9. UNIX for Advanced & Expert Users

Long Delay if any with network services

While installing a firewall, I was pinging the interface from SCO 5.0.6 Openserver box, while no response, I hit "DEL" to cancel, but no cancel. Then all of a sudden I get BOO-KOO traffic lights on HUB and Switch.... Then a kernel trap error. System froze... Proceeded with a cold boot. Now I have... (8 Replies)
Discussion started by: nashvillek5
8 Replies
Login or Register to Ask a Question