How to use nagios's check_udp for Monitoring ntpd? - nagios

I want monitor my ntpd services and ntpd service is used udp protocol。nagios have a method that is named check_udp,As follows:
[root#localhost]# ./check_udp -H 127.0.0.1 -p 123
With UDP checks, a send/expect string must be specified.
I want to know how to use check_udp...

I suggest saving yourself some effort and use one of the many NTP nagios plugins like the one below from the official nagios plugins package.
http://nagiosplugins.org/man/check_ntp_peer

Related

Use ssh to access couchdb on remote server from mobile device

I have an instance of couchdb running on my local port 5984.
My ultimate goal is to run couchdb on a server within a closed network, and be able to send requests to this server from mobile devices within the network.
This post seems to provide a solution, provided I can open a terminal and make an ssh tunnel:
ssh -f -L localhost:15984:127.0.0.1:5984 user#remote_host -N
But I obviously won't be able to access the command line on mobile devices to make the tunnel. How does one go about accessing applications from mobile devices within closed networks? (I can't just deploy it to some web server as I don't have access to the internet)
You CAN run command line on Android, for example with this terminal emulator you can copy a statically linked ssh binary to /data/data/jackpal.androidterm/app_HOME then cd $HOME and ./ssh to execute it
and there are graphical ssh clients, some of which might have the functionality
also termux should have an ssh client available, you probably need to "apt install ssh" when in the app to get it.
You can create a SSH tunnel if the client supports port forwarding. Those I know are :
The paid version of JuiceSSH : Setting up a New Port Forward Profile
Connectbot : Long press in the hosts list and choose "Edit port forwards". The parameters are straightforwardly adapted from the -L option.
You can write a client via sudo apt-cache search libssh; it supports tunneling AKA forwarding.
#include <libssh/libssh.h>
http://api.libssh.org/master/libssh_tutor_forwarding.html

Nagios monitored servers inventory

has anyone from you pulled server hardware data from Nagios to build an inventory? Basically I am trying to create an inventory of an existing servers and hardware components monitored with nagios (i.e. hostname, CPU, MEM, HDD and etc.) There are other ways to do it, but maybe there is a plugin or a way to pull it directly from nagios?
Thanks
You could run this on the command line against your configuration files:
grep "host_name" /usr/local/nagios/etc/objects/hosts.cfg >>output.log
That will output a list of all parameters associated with the host_name line within your configuration.
There is a new mk_inventory plugin for nagios which will pull HW info from the machine

How does Check_MK work with Nagios?

Hi I have just installed a clean copy of Nagios and Check_MK. But I don't understand how they work together. Nagios uses nrpe to connect to clients and performs checks. This means that some Nagios plugins have to sit on the client and return results from when they are called. But how does Check_MK tie into Nagios. Does it use check_mk_agent to replace all the Nagios plugins to perform its checks? Also does the Nagios configurations all have to be fully configured with all the clients already in place to be checked and then ported to Check_MK interface (wato) or can the clients be added to Check_MK without being present in the Nagios configurations. This is where my confusion lies and I cant find a concrete answer to this question anywhere. Please help.
Check_MK uses Nagios core for theses tasks:
Manage Check results
Triggering of alarms
Manage planned downtimes
Test host availability
Detect network failures
As you can see at the bottom of this page: http://mathias-kettner.com/checkmk_monitoring_system.html
Check_MK needs both: client side monitoring agent and server side monitoring system.
The server side monitoring system calls the agent of the host and passes the check results to the monitoring core (usually Nagios but there is also an new core just for Check_MK).
What makes Check_MK different from other passive Checks (like NRPE) is that the results for all checks is send to the monitoring system in one package. If you run the agent on a host in a shell it will return something like this:
➜ ~ check_mk_agent
<<<df>>>
/dev/mapper/MyStorage-rootvol ext4 15350768 13206900 1341052 91% /
dev devtmpfs 4022348 0 4022348 0% /dev
plus many more lines ....
So the server side part of Check_MK splits these packages into single checks so that the Nagios core can handle them.
So Check_MK wont replace your existing checks, it doesn't care about them. It will just add more.
You don't necessary need WATO to configure Check_MK. WATO is just an interface for the configuration. Configuration can also be done with plain text files. You should start with WATO and take a look at the configuration it has generated.

Bluez BLE Connection Linux

I'm very new to Linux and Bluetooth development, and I'm unsure of the difference between sudo hcitool lecc <bdaddr> and sudo gatttool -b <dbaddr> -I? I don't require any of the GATT services; I just want a connection between the two devices.
I'm looking at vaguely following this widely referred to tutorial, and am looking at adapting the cmd_lecc method in Bluez /tools/hcitool.c, but I am unable to connect to my BLE device using hcitool lecc.
When I connect using gatttool, I am able to connect successfully, however using hcitool lecc returns the error 'Could not create connection: Connection timed out', and no connection is made to the BLE device. However, running sudo hcitool con to show active connections shows that there is one: 'Unknown handle 0 state 2 lm SLAVE'. If it's failing to make the connection, why is it then registering the connection as active in hcitool?
My question therefore is threefold:
What is the difference between the two commands?
Would gatttool be suitable for my purpose, or should I work out what's not working with hcitool (following something like this?
Why does sudo hcitool lecc <bdaddr> partially connect, even when it times out?
Many thanks.
hcitool lecc <bdaddr> creates a connection and returns a handle, while gatttool -b <bdaddr> -I only opens an interactive terminal with an interface bound to the address but not yet connected. To connect using the gatttool command you must then enter connect, which will most likely also fail.
I would suggest looking at how hcitool connects for writing your own code as all of gatttool simply is a wrapper around the same process that hcitool uses, but its wrapper is not available unless you copy its code.
lastly, the handle 0 that hcitool is reporting is an invalid handle left from trying to connect, because as far as I've seen all valid handles are greater than 0.

Websphere EJB3.0 Timer Avoid Persistence

Websphere 7.0, EJB3.0
Is there a way to avoid default EJB timer persistence. Looks like timers survive server crashes and restarts.
Thanks!
Non persistent EJB timers added in Java EE 6 (WebSphere 8 and up).
If you need non persistent timers in WebSphere 7 you should probably need to use AlarmManager
The preferable way with EJB-3.0 is to clear all timers on server shutdown/startup to avoid timers persisted due to failure.
You can place code in appropriate methods - onApplicationEnd or onApplicationStart by implementing ApplicationListener interface, alternatively you can refer here, but former is better.
Else, can run the command to explicitly cancel timers as mentioned in documentation.
cancelEJBTimers
This command cancels and removes from persistent storage EJB timers based on the specified filter criteria.
The syntax for this command is: cancelEJBTimers server filter [options] filter: -all | -timer | -app [-mod [-bean ]]
-all
-timer timer id
-app application name
-mod module name
-bean bean name
options: -host host name
-port portnumber
-conntype connector type
-user userid
-password password
-quiet
-logfile filename
-replacelog
-trace
-help
In EJB-3.1, with TimerConfig you can configure it with setPersistent(isPersistent).

Resources