Looking for nc to Solaris 10 - solaris

Can you tell me if is there any site that I can find nc for Solaris 10 ?
Or if I can use another tool to send Syslog messages from Solaris to another server...

You might just compile nc from source or download a package from a freeware repository, e.g. https://www.opencsw.org/package/netcat/ or http://solaris10pkgsrc.unixdev.net/ but why do you want to use nc in that case?
Solaris 10 syslog should already be able to send syslog messages to a remote server, have a look to: https://unix.stackexchange.com/questions/97988/how-do-i-send-all-information-in-var-adm-message-file-to-a-remote-system

Related

Zabbix-agent on HAProxy discover load-balanced host doesn't show up on Zabbix Server

I have been following this tutorial for a moment but I don't know why it isn't working:
https://github.com/anapsix/zabbix-haproxy/blob/master/README.md
To make a long story short:
I have a Zabbix server on Amazon EC2 and I want to monitor a HAproxy server which is inside my network. The HAProxy Server has a Zabbix Agent working on it.
The tutorial explain how to setup a script for the zabbix-agent to explore what's behind it (what's the haproxy is load-balancing) and send it back to the Zabbix Server.
However everything is working fine but nothing shows up on the Zabbix server, no host are discovered despite the zabbix agent and server are communicating.
1 - I did place the userparameter_haproxy.conf into /etc/zabbix/zabbix_agentd.d/ and
set it in the zabbix_agend.conf file.
2 - I did place the haproxy_discovery.sh into /usr/local/bin/ and gave it the +x rights
3 - I did import haproxy_zbx_template.xml
4 - Configure HAProxy control socket: I assume there is my mistake.
5- The scripts are working because I get result when I execute this commands:
zabbix_agentd -t haproxy.list.discovery[FRONTEND]
zabbix_agentd -t haproxy.list.discovery[BACKEND]
zabbix_agentd -t haproxy.list.discovery[SERVERS]
6 - I added the host with HAproxy on it to the right template
7 - I can wait forever nothing is showing up, no new hosts.
I think the step 4 is where I am doing wrong. In the tutorial they say:
Configure HAProxy to listen on /var/run/haproxy/info.sock or set
custom socket path in checks (set {$HAPROXY_SOCK} template macro to
your custom socket path) or update userparameter_haproxy.conf and
haproxy_discovery.sh with your socket path
I did make the haproxy.cfg file listen to the file /var/lib/haproxy/stats
and set a custom socket path in the template macro.
Additionnal info:
Version of Zabbix: 3.4
Zabbix Server: RHEL 7.4
Zabbix Agent: Centos 7.2
No errors when I restart zabbix-agent
No errors in haproxy.log
UPDATE: I did add Zabbix to the root group.
Now, in Zabbix server logs I can see this message:
changed: Value "which: no nc in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
2" of type "string" is not suitable for value type "Numeric (unsigned)"
And I'm lost again.
UPDATE: I was missing netcat, I installed it on the zabbix server and client.
UPDATE: It's working
According to your update, I guess netcat (nc) is not installed on your system.
Install it and try again

Find out which mail server is installed on Ubuntu

I have access to a couple of Ubuntu servers and I am trying to configure the PHP mail() command for each of these servers. However, for one of these servers, the From: header is overwritten by www-data#. I have no access to the SPF record of that hostname, so I want to configure the mail server so it doesn't overwrite the From: header.
So my question is, how do I find out which mail server is used so I can correctly configure that mail server? (Postfix, SSMTP, ...)
Thanks in advance!
To get a list of packages installed locally do this in your terminal:
dpkg --get-selections | grep -v deinstall
To save that list to a text file called packages on your desktop do this in your terminal:
dpkg --get-selections | grep -v deinstall > ~/Desktop/packages
Then search for Mailserver. I'll do my bet for Postfix, which seems to be the most used.
Credit goes here
$ dpkg -l | grep mail
rc libc-client2007e 8:2007f~dfsg-4 amd64 c-client library for mail protocols - library files
ii libmail-sendmail-perl 0.79.16-1 all Send email from a perl script
ii libmailtools-perl 2.13-1 all Manipulate email in perl programs
ii libmailutils4:amd64 1:2.99.99-1ubuntu2 amd64 GNU Mail abstraction library
ii mailutils 1:2.99.99-1ubuntu2 amd64 GNU mailutils utilities for handling mail
ii mailutils-common 1:2.99.99-1ubuntu2 all Common files for GNU mailutils
ii mime-support 3.59ubuntu1 all MIME files 'mime.types' & 'mailcap', and support programs
ii postfix 3.1.0-3ubuntu0.3 amd64 High-performance mail transport agent
Finding which server is listening on port 25 may help (expecially if you have multiple MTA installed but only one which one is running).
(sudo) netstat -tanp | grep ':25'
As Following suggested, you need to be root (sudo).
You will get the PID of the process, for example :
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 98249/master
Here I found the PID (98249 in my case), and you can get more information with ps or lsof
ps 98249
lsof -p 98249

Netcat: using nc -l port_number instead of nc -l -p port_number

This question is following this one: Sockets working in openSUSE do not work in Debian?
When working with sockets on my Debian system, I have to use nc -l -p port_number to simulate the server I want to talk with. If I'm using nc -l port_number, it will fail when using the socket connect function and strerror(errno) will say "Connection refused".
Netcat without -p option is working great on other Linux distributions, what should I change on my configuration?
Do not adjust your set. There are multiple implementations of netcat out there; not all of them behave the same.
In particular, the "traditional" version of netcat, which is probably what you have installed on your Debian system, will end up doing something totally unexpected if you omit the -p ("port") flag: it will end up treating the last argument as a hostname, pass it to inet_aton(), which will convert it to a nonsensical IP address (e.g, 1234 will become 0.0.4.210), and will then proceed to ignore that IP address and listen on a socket with an automatically assigned (probably random) port number.
This behavior is obviously silly, so some other implementations of netcat will assume you meant -p. The one you're using doesn't, though, so pass the -p option.
I agree with duskwuff that it is better to just use the -p option everywhere, but to answer your question:
The one thing you have to do is install a netcat that supports the syntax you want. I know the netcat-openbsd package supports it. I know the netcat-traditional package does not. There's also a netcat6 package, which also doesn't. You can then explicitly request the OpenBSD version of netcat like so:
nc.openbsd -l 4242
Optionally you may use the alternatives system to set this version of netcat to run when you issue the nc command:
update-alternatives --set nc /bin/nc.openbsd
This will be done automatically for you if this is the only netcat you've installed.
Finally, you may, again optionally, remove the netcat you don't like (netcat-traditional or netcat6).

how to start jboss for my local network

First question is: it seems like magic that one I run ./run.sh, I can turn off the computer, turn it back on again and still it knows about //localhost:8080/jmx-console/. I looked in the start up programs and I don't see any hint of it. How does it remember?
Never mind, the real question is I want the host to be my local LAN and not just localhost. I found I could do shutdown.sh and that would indeed shutdown the server such that //localhost:8080/jmx-console/ would no longer work. That is good, now the next step is to confine it to my LAN. I know I can use ./run.sh -b 0.0.0.0 but that opens it to the world. My computer is at 192.168.1.100 so I tried ./run.sh -b 192.168.1.0 which I would take to mean take addresses in the range 192.168.1.XXX. The server "started" but I can't get it to answer any calls and I couldn't get shutdown.sh to do anything.
I started ./run.sh again and it hooked up to the localhost. I don't know if it still has a memory of my ./run.sh -b 192.168.1.0 or not. If so, I'd like to get rid of it. In any case I'd like to know what the correct command should be.
Thanks,
Ilan
Which version of jboss?
I use -b 127.0.0.1 on jboss 4

How to invoke a perl script on the remote unix server from my local system

I have a perl script that should execute on the log files in the remote server from my local desktop. Could some one suggest me best approach.
I used Net::SFTP but there is a problem with installing SFTP package from CPAN. Is there any good package available in Perl to do this functionality?
Can you tell me whether the following steps are fine?
Open SFTP connection with remote server
execute the perl at remote location from the established connection..
Any sample code for this?
If you mean that the Perl script is on the remote unix server and you want to invoke the Perl script from your local machine, then you can ssh into the remote unix server and then once you are connected, call your perl script using perl yourscript.pl.
If you mean that the Perl script is on your local machine and you are dealing with log files on the remote server, then it would be more efficient to have the Perl script located on the remote server that stores the logs, and invoke it in the way described in the above paragraph.
I'm not clear exactly what you are trying to achieve but if you just want to execute a Perl script on a remote server you may want to look at software specifically built for remote server management.
Tak is one such piece of software but it's quite new and a bit lacking in documentation.
Rex is a more mature, it would seem, piece of software for remote server management.
Both of these should allow you to run commands locally that perform actions remotely on your servers. I wouldn't have thought you'd need to do anything with SFTP and would think you could do it all with those or hand-rolling something with commands over SSH.
Instead of Net::SFTP, try using Net::SFTP::Foreign or, if you want to run commands on the remote host via SSH, Net::SSH2 or Net::OpenSSH .