I want to monitor a ruby program using nagios3.3.1 . I have nagios installed on Centos5.7 and the the ruby program is in windows server 2012 r2 64 bit.
I just tried it by opening a port 4546 using ruby program and monitor that port using check_tcp plugin.
Below is my service definition.
define service {
use local-service
host_name winserver-2012
service_description monitor ruby
check_command check_tcp!4546
}
But the result is "CRITICAL-Socket timeout after 10 seconds"..
What should I do for monitoring a ruby program? Is it possible to monitor a port which is just opened.?
It doesn't have anything to do with ruby, check_tcp doesn't care who is listening on the port, as long as there is actually something that's listening. Try telnet winserver-2012 4546 to check if the port is reachable. If it isn't, it's most likely your windows firewall is blocking incoming connections, or your ruby program binds to the port but doesn't listen on it. Try netstat -an | findstr "4546" on the windows machine to see if your ruby program actually listens for connections.
Related
I'm new to networks and I'm wondering why this TCP Server-Client implementation in C
only works on one computer? (1)
I mean I have to open one terminal for the server program and another one for the client program. But why this doesn't work between computers? Starting the server program on one computer and the client program on another computer.
How we need to modify the code to work between computers? (2)
And what are great resources to start on the whole topic? (3)
It will work on other computers.
Just ensure you do the followings:
Two computer be on a network and see each other with PING
Change 127.0.0.1 in client program with the IP of the server machine
Check listening ports with netstat of server machine and Make sure the port 8080 is in Listening mode
Make sure there is no firewall in server machine, you can use telnet in client machine to make sure port on the server is accessible.
Before test your C program, make sure the communication is OK between servers by third party application. For example, make an echo server in linux by ncat -l 2000 -k -c 'xargs -n1 echo' on port 2000.
It highly recommended change Port from 8080 to another one (for example 8192). 8080 is used with some third party applications.
The host used by the client is hardcoded:
servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
You can change the host into the code to reach another computer, or you can read it from command line to have a more flexible use.
How can I check whether port 1433 is open for Sql Server or not? I have set in bound and out bound rules, checked in SQL config manager but not sure whether it is working.
If TELNET is installed, you could use TELNET 1433 to verify port connectivity. Otherwise, the PowerShell command below can do the job using a .NET TcpClient:
$server="yourserver"; $port=1433; echo ((new-object Net.Sockets.TcpClient).Connect($server,$port)) "$server is listening on TCP port $port";
Newer versions of PowerShell include a Test-NetConnection cmdlet (alias tnc) to facilitate testing ICMP and port connectivity. Example invocations from a Windows command prompt:
powershell -Command "Test-NetConnection -ComputerName 'yourserver' -Port 1433"
powershell -Command "tnc -ComputerName 'yourserver' -Port 1433"
powershell -Command "tnc 'yourserver' -Port 1433"
If the server is using TCP/IP, then the simple way is to just telnet to the SQL Server port and see if it connects. By default, that's port 1433, so this should work:
telnet servername 1433
That will probably be appropriate in most cases.
If it's using a different port, or dynamic ports (common with a named instance), then you'll need to determine which port it's currently listening on. Check SQL Server configuration manager to see if it's a specific port, or dynamic ports. If it's using dynamic ports, then as long as you don't have multiple instances on the server, netstat -abnis probably the simplest way to find what it's using. Otherwise, dig through the Windows event log or the SQL Server error log for a message indicating which port is in use by the instance.
If SQL Server is using Named Pipes, then I believe if you're able to access shares on the machine, you have adequate network connectivity. This article says you can go further and try connecting to the IPC$ share:
net use \\servername\IPC$
That's written for SQL Server 2000, but I don't imagine this aspect has changed much, if at all.
You probaly want it open, since You are asking. The single most time-saving image I have found for this is here:
This is an inferred answer to the question, somewhat meta, but in my opinion the one that counts.
You could install Netstat or alternatively use the command prompt
netstat -abn
to see the ports in use.
You could also use this method from rackspace to remotely connect to your server.
I am trying to connect from a NoMachine client on a Windows 7 machine to an OpenSUSE machine. I can only connect via NX however I keep running into Error 138:Connection Timed out. I can connect via SSH on my Command prompt however Seem to be unable to connect via here. Does anyone know a solution - been doing this since morning with no light in sight!
Routers supporting UPnP or NAT-PMP are configured automatically to pass connections to NoMachine and all required information is displayed at initial screen (Welcome to NoMachine).
Routers not supporting UPnP or NAT-PMP and Firewalls have to be configured manually to pass traffic to port 4000 (NX protocol), 22 (SSH protocol on Linux/MacOSX) or (4022) (SSH protocol on Windows).
So, check the configuration first.
I have a similar issue setting up my ftp server.
There are a couple of possibilities why the connection was not established, but in my case, and perhaps yours, you must allow the service you're trying to execute in your firewall settings.
In my case I allowed the ftp port and some other specific port for tcp communication.
This (and the proper service, router, etc setup) allowed the communication to be established.
I'm trying to run a TELNET command from my Mac OSX to an Oracle DB that is based on a Windows 7 (Virtual machine using Parallels on same Mac) but I get this error:
Connection closed by foreign host
I've already checked the Listener for Oracle and it is activated and listening to 127.0.0.1 on port 1251 and to the VM ipAddress 10.211.55.4 on port 1251
I can successfully run a:
ping 10.211.55.4
I have verified that the port is LISTENING using
netstat -a
And i have checked via services (in Windows) to see if the port is RUNNING... and it is.
Any ideas?
Thanks!
PS: This is my first post so if anything is out of place please let me know...
I have checked various threads and none answer
Thanks for the help!
The problem was not the port. It was rather that for some odd reason (replicable... but odd) Oracle DB installed two instances on my Windows VM and the connections got crossed.
The way I solved this was by removing ALL listeners to BOTH DB's and then creating a new Listener to a single instance.
I am using the libmysql C API, the mysql_real_connect call only works if I use the real IP address of the host - other than localhost. If I use localhost as host I get the
following error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (0)
The authentication should be ok, since the used user has all privileges from localhost and any host also.
By the way it is an XAMPP installation on Windows 7.
I had the same problem and the solution is to uninstall and disable IPv6 support, because if I had IPv6 support enabled then ping localhost command returns ::1: instead 127.0.0.1 as i have written in etc\hosts file, and sample mysql connect program written in C using libmysql do not connect when as host parameter to mysql_real_connect() i supplied "localhost". Now, after disabling IPv6 works both options ("localhost" or "127.0.0.1").
P.S.: I have tried this "solution" only in Windows XP SP3 Pro Czech. In Windows 7 and Linux I don't try this.
Either your DNS is broken (Does ping localhost work as expected?)
or the way "localhost" is specially treated is the problem.
The value of host may be either a host name or an IP address. If host
is NULL or the string "localhost", a connection to the local host is
assumed. For Windows, the client connects using a shared-memory
connection, if the server has shared-memory connections enabled.
Otherwise, TCP/IP is used.
see http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
check if in your /etc/hosts file it's defined something like that: 127.0.0.1 localhost
check how mysql is binding its port:
root#dam2k:~# netstat -natp | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2215/mysqld