Systemtap for production server - linux-kernel

I want to use systemtap for extracting details of my linux production server from remote access. I have some of the doubts regarding this:
Whether is it necessary to have same kernel in both the linux production server and linux development server.If not then how to add the support for that?
What are the minimum requirements to be present in the production server? Whether is it necessary to compile the kernel of the production server with the debuginfo ?
How to enable users in some particular group to run the stap scripts?

The kernel running on the production server and linux development server do not need to be identical. The SystemTap Beginners Guide describes doing cross-compile where instrumentation for one kernel version is built on a machine currently running different kernel version. This is described in:
http://sourceware.org/systemtap/SystemTap_Beginners_Guide/cross-compiling.html
The production server just needs the systemtap-runtime package. The production server does not need the kernel-devel or kernel-debuginfo installed when using the cross compile method.
There are stapusr and stapdev groups that allow people to run scripts. stapusr allows one to run existing script in /lib/modules/uname -r/systemtap directory (probably what is wanted in the case of running cross-compiled systemtap scripts). stapdev allow one to compile a script.
The stapusr and stapdev groups are described in:
http://sourceware.org/systemtap/SystemTap_Beginners_Guide/using-usage.html

Another capability in systemtap >1.4 is remote execution:
development_host% stap --remote=user#deployment_host -e 'probe begin { exit() } '
where cross-compilation, module transfer, trace data transfer are all automagically done via an ssh transport, as long as the deployment_host has corresponding systemtap-runtime bits installed.

Related

How to use Perf in Clion remote mode?

Question
I want to use Perf when Clion connects to a remote server. I want to know how to set it up? Perf has been installed in the remote server (Ubuntu). But the configuration path of Perf can only detect the local paht (windows), not set to the server path.
I saw that Clion said that Profiling in remote mode has been used since the 2021.2 EAP version, but didnot say how to set the path to the remote server path.
Version
local: windows 10; remote server: Ubuntu20.04
Clion 2022.2.4
I look forward to your answers, thank you very much!
The SSH configuration, toolchain, and cmake have all been set up successfully. I can already develop remotely. The source code is stored in the local, mapped to the server and updated in real time.

Install a NTP Client in an yocto-base embedded Linux distribution

I'm developing a yocto-base Linux distribution by the zeus yocto release.
I need to install a NTP client into the distribution and I don't want to install the NTP server inside the image.
In zeus yocto release I have found the following recipe:
meta-openembedded/meta-networking/recipes-support /ntp/ntp_4.2.8p15.bb
that is relative to Network Time Protocol (NTP).
The recipe contains following info about itself:
SUMMARY = "Network Time Protocol daemon and utilities"
DESCRIPTION = "The Network Time Protocol (NTP) is used to
synchronize the time of a computer client or server to
another server or reference time source, such as a radio
or satellite receiver or modem."
Previous information don't explain if the recipe can be use to install, in the distribution, a NTP Server, a NTP Client or both.
What I need is a NTP client application that is able to connect to an external NTP server.
The following instruction:
IMAGE_INSTALL += "ntp"
is not suitable because adds to the Linux distribution the NTP Server which is called ntpd.
What's the package that I have to add to the image to include a client NTP? Is it included in the previous recipe or I have to find a different recipe?
Thanks
Ok I have found and test the answer of the post: ntp recipe didn't install ntpdate files.
The answer of that question is perfect to solve my problem.
By the instruction:
IMAGE_INSTALL += "ntpdate"
in the distribution, are installed only ntpdate and the service ntpdate.service without installing ntpd and its service.
Obviously to avoid the installation of the ntpd program (NTP Server) I must remove the instruction:
IMAGE_INSTALL += "ntp"
from the distribution.
A useful teaching
Very useful the comment that I have found in the post: ntp recipe didn't install ntpdate files:
Explanation: Take a look at the recipe, and at the PACKAGES variable:
PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
It means that the ntp recipe contains the packages: ntp (default ${PN}), ntpdate, sntp, ntp-tickadj, ntp-utils.
From this comment I have learnt that in general a recipe can define (an so it contains) many packages and every package contains many programs, configuration files, and so on.
The assignment IMAGE_INSTALL += ... depends on what must be installed.
In my case I have excluded the default package ntp and I have included the package ntpdate.

CentOS 6.4 Minimal + how to configure jenkins jobs via xml?

I need to create a Build Server in CentOS 6.4 Minimal I sucessfully installed:
Java compiler (OpenJDK 1.7.0)
Git or Mercurial
Maven
Jenkins
Now I need to to the following:
At given intervals (eg daily at midnight) is the latest revision in the version control system (tip, HEAD, ...) compiled with Maven. In addition, Java Docs and packages (jar, war) need to be created.
Then Jenkins with all tests conducted and reported.
Make sure there is a report of previous builds
Ensure that the Java Docs and packages can be downloaded (jars, wars, ...) of the latest build
I can't use a GUI on CentOS Minimal so I need to configure the job in xml files? Could please someone show me the way... I'm not a linux server guru.
It's a bit impractical to configure Jenkins via XML by hand, because Jenkins' configuration is spread over multiple files, and the format of the configuration files changes between releases.
Given that Jenkins is a web application, you should be able to visit port 8080 (Jenkins' default port, assuming you didn't change it) on the server where you installed Jenkins (e.g. http://mycentosserver.example.com:8080), and configure it via the web interface.
If you're unable to access the web interface because of a firewall or similar, but you are able to SSH to the server (presumably you can, given that you were able to install stuff on it), you could set up an SSH tunnel to forward a port on your local machine to port 8080 on the server. For example, from your local machine, run the following command. You will then be able to access Jenkins on your local machine at http://localhost:28080 . If you're on Windows, you can use Putty to do the same thing.
ssh -L 28080:127.0.0.1:8080 mycentosserver.example.com
If you can't access the web app directly, and you can't SSH tunnel, I'd recommend setting up Jenkins on a server where you can access the web app, configuring it, and copying the XML config files from /var/lib/jenkins on that server across to your Centos server.

Websphere MQ Client installation

I am working on a project where MQ client (Support PAC 7) is installed on one 64-bit Linux machine and it sends messages to server.
On client machine we are using 64-bit linux JDK 1.6.25
java -version
java version "1.6.0_25"
I have following environment variable set up
MQSERVER='my_channel/tcp/SRVD10995(1414)'
MQ_INSTALL_ROOT=/var/mqm/
MQ_JAVA_DATA_PATH=/var/mqm/
MQ_JAVA_INSTALL_PATH=/opt/mqm/java/
MQ_JAVA_LIB_PATH=/opt/mqm/java/lib64
LD_LIBRARY_PATH=/opt/mqm/java/lib64
CLASSPATH= /opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:/opt/mqm/samp/jms/samples:/opt/mqm/samp/wmqjava/samples
but when I run following command
dspmqver -p 6
For native libraries I am seeing following message:
Name: IBM WebSphere MQ
Version: 7.0.1.6
CMVC Level: k701-106-110721 mqjbnd=CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. [3=mqjbnd]::no mqjbnd in java.library.path
Build Type: Production
I am also getting same error message when I execute JMS code to connect to server. I do not have libmqjbnd.so is not in the /opt/mqm/java/lib64 folder, and not even in 32 bit folder.
I have couple of questions :
1) How do I fix this problem for client installation?
2) Does the library file (.so) need to be there in that directory ?
I will be thankful if anyone provides me answer to above questions, I have already invested many hours in this but no joy.
There's a Technote on this specific question here. Let us know if the solution presented there does not resolve your problem.
Update: I noticed a mismatch between your CLASSPATH which is pointing to the 32-bit libs and the other variables pointing to the 64-bit libs. WMQ provides scripts that set the variables for you as described in the Infocenter:
On a UNIX system, you can use the script setjmsenv (if you are using a 32-bit
JVM) or setjmsenv64 (if you are using a 64-bit JVM) to set the environment
variables. On AIX, these scripts are in the /usr/mqm/java/bin directory and,
on HP-UX, Linux, and Solaris, they are in the /opt/mqm/java/bin directory.
Many people source the scripts in their .profile. Have you tried running these? Remember that simply running the script...
/opt/mqm/java/bin/setjmsenv64
...does not result in the env vars being set in the current shell. The script must be sourced using the dot syntax as follows:
. /opt/mqm/java/bin/setjmsenv64
What results do you get after sourcing the appropriate setjmsenv or setjmsenv64 script?
Whether you need the libraries depends how you want to send messages to the server. WebSphere MQ allows you to choose between bindings mode and client mode. Bindings mode uses the libraries with some IPC while client mode is purely Java and TCP based.
If your programming language is Java then i would choose client mode.
This message occurs also when you forget to set properties for host, port, ...
This is in case of standalone MQ client.
MQEnvironment.hostname = "mqm.onZos.myCompany.com";
MQEnvironment.port = 1234;
MQEnvironment.channel = "SYSTEM.MYCH.NAME";

How do I remotely get a checksum for a file on a Windows machine?

I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs.
For UNIXy servers (and Windows servers with Cygwin), I can just log in over SSH and run md5sum foo.jar. Ideally, I'd like to avoid installing extra software on the remote servers (there may be thousands), so is there a good way to do this on vanilla Windows servers?
You could try the Sysinternals PSExec tool. You would need a checksum utility available on the remote machine. Unfortunately since they became part of Microsoft they don't make any source code available.
Alternatively, you could install the Cygwin SSH daemon on the remote machines and use ssh but that's a bit more involved.
Microsoft has a free checksum tool you could run with PSExec above.

Resources