Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
guckyh
byguckyh, August 7, 2012
let's simple check for ssh-port 22
this is the part of code used - then it looks if there is at least ONE line
netstat -an | grep LISTEN | grep 22
result:
*.22 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN
*.11221 *.* 0 0 49152 0 LISTEN
*.11222 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN
(you get any line containing "22" not only where the PORT is 22!!
this is the part of code used - then it looks if there is at least ONE line
netstat -an | grep LISTEN | grep 22
result:
*.22 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN
*.11221 *.* 0 0 49152 0 LISTEN
*.11222 *.* 0 0 49152 0 LISTEN
*.22 *.* 0 0 49152 0 LISTEN
(you get any line containing "22" not only where the PORT is 22!!