Is there a way to monitor the status of SSH tunnel?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I work as a system administrator in a Datacentre and as part of my daily routine work, I mostly need to establish a SSH tunnel to access certain critical services to work on. But sometimes the tunnel dies due to network drop. I would like to check whether is there a way to have some SSH tunnel monitor program to check the live status of the tunnel.



For example:



  • Green indication when the connection is active and red indication when the tunnel is not active and to which server the tunnel has got established etc..






share|improve this question















  • 2




    The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
    – Jasen
    Jul 29 at 4:34







  • 2




    everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
    – slm♦
    Jul 29 at 4:36







  • 2




    Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
    – slm♦
    Jul 29 at 4:39






  • 1




    Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
    – slm♦
    Jul 29 at 7:29










  • It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
    – Patrick Mevzek
    Jul 30 at 13:22
















up vote
0
down vote

favorite












I work as a system administrator in a Datacentre and as part of my daily routine work, I mostly need to establish a SSH tunnel to access certain critical services to work on. But sometimes the tunnel dies due to network drop. I would like to check whether is there a way to have some SSH tunnel monitor program to check the live status of the tunnel.



For example:



  • Green indication when the connection is active and red indication when the tunnel is not active and to which server the tunnel has got established etc..






share|improve this question















  • 2




    The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
    – Jasen
    Jul 29 at 4:34







  • 2




    everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
    – slm♦
    Jul 29 at 4:36







  • 2




    Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
    – slm♦
    Jul 29 at 4:39






  • 1




    Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
    – slm♦
    Jul 29 at 7:29










  • It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
    – Patrick Mevzek
    Jul 30 at 13:22












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I work as a system administrator in a Datacentre and as part of my daily routine work, I mostly need to establish a SSH tunnel to access certain critical services to work on. But sometimes the tunnel dies due to network drop. I would like to check whether is there a way to have some SSH tunnel monitor program to check the live status of the tunnel.



For example:



  • Green indication when the connection is active and red indication when the tunnel is not active and to which server the tunnel has got established etc..






share|improve this question











I work as a system administrator in a Datacentre and as part of my daily routine work, I mostly need to establish a SSH tunnel to access certain critical services to work on. But sometimes the tunnel dies due to network drop. I would like to check whether is there a way to have some SSH tunnel monitor program to check the live status of the tunnel.



For example:



  • Green indication when the connection is active and red indication when the tunnel is not active and to which server the tunnel has got established etc..








share|improve this question










share|improve this question




share|improve this question









asked Jul 29 at 4:24









Gokulnath Kumar

558




558







  • 2




    The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
    – Jasen
    Jul 29 at 4:34







  • 2




    everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
    – slm♦
    Jul 29 at 4:36







  • 2




    Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
    – slm♦
    Jul 29 at 4:39






  • 1




    Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
    – slm♦
    Jul 29 at 7:29










  • It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
    – Patrick Mevzek
    Jul 30 at 13:22












  • 2




    The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
    – Jasen
    Jul 29 at 4:34







  • 2




    everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
    – slm♦
    Jul 29 at 4:36







  • 2




    Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
    – slm♦
    Jul 29 at 4:39






  • 1




    Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
    – slm♦
    Jul 29 at 7:29










  • It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
    – Patrick Mevzek
    Jul 30 at 13:22







2




2




The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
– Jasen
Jul 29 at 4:34





The only reliable way I've found is to test it periodically,tcping would be one way to do such tests.. have you tried autossh?
– Jasen
Jul 29 at 4:34





2




2




everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
– slm♦
Jul 29 at 4:36





everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh & harding.motd.ca/autossh. Using autossh is exactly what I do as well.
– slm♦
Jul 29 at 4:36





2




2




Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
– slm♦
Jul 29 at 4:39




Shows how to make it into a systemd - gist.github.com/thomasfr/9707568.
– slm♦
Jul 29 at 4:39




1




1




Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
– slm♦
Jul 29 at 7:29




Another approach is shown here using lsof - superuser.com/questions/248389/list-open-ssh-tunnels.
– slm♦
Jul 29 at 7:29












It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
– Patrick Mevzek
Jul 30 at 13:22




It depends how the tunnel is started but if one ssh connection is used only for that, if the tunnel closes then it means ssh is stopped. So you just need to check if ssh is running or not.
– Patrick Mevzek
Jul 30 at 13:22















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459125%2fis-there-a-way-to-monitor-the-status-of-ssh-tunnel%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459125%2fis-there-a-way-to-monitor-the-status-of-ssh-tunnel%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?