Unable to see second host in Nagios server - nagios

Followed same set of instructions on another host (Xubuntu 16.04) but it seems that is not visible in Nagios Server.
Here is a quick snapshot of nagios server hosts.cfg and services.cfg file.
[root#agent2 etc]# cat hosts.cfg
## Default Linux Host Template ##
define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}
## Default
define host{
use linux-box ; Inherit default values from a template
host_name jim-Ubuntu1504 ; The name we're giving to this server
alias Ubuntu 16.04 ; A longer name for the server
address 192.168.1.2 ; IP address of Remote Linux host
}
## Default
define host{
use linux-box ; Inherit default values from a template
host_name jim-VirtualBox ; The name we're giving to this server
alias Xubuntu 16.04 ; A longer name for the server
address 192.168.1.11 ; IP address of Remote Linux host
[root#agent2 etc]#
[root#agent2 etc]# cat services.cfg
define service{
use generic-service
host_name jim-Ubuntu1504
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description SSH Monitoring
check_command check_nrpe!check_ssh
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description FTP Monitoring
check_command check_nrpe!check_ftp
}
define service{
use generic-service
host_name jim-VirtualBox
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name jim-VirtualBox
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name jim-VirtualBox
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name jim-VirtualBox
service_description SSH Monitoring
check_command check_nrpe!check_ssh
}
define service{
use generic-service
host_name jim-VirtualBox
service_description FTP Monitoring
check_command check_nrpe!check_ftp
}
[root#agent2 etc]#
Not sure what is happening because of which Xubuntu(jim-Virtualbox) is not be able to be seen in Nagios server.
Any help would be very much appreciated.
P.S: NRPE is running on agent.
root#jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15# netstat -nap|grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 11019/nrpe
tcp6 0 0 :::5666 :::* LISTEN 11019/nrpe
unix 2 [ ] DGRAM 46618 11019/nrpe
root#jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15#
root#jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15#

Related

Windows 10 Host cannot access SQL Server on Oracle Virtual Box

I have created a VM with virtual box that runs windows 10, and installed SQL Server.
Using Consume Adapter Service in Visual Studio for BizTalk 2020
Configured: SQLBinding AS: mssql://DESKTOP-T2G7B3A/MSSQL15.MSSQLSERVER/AFBizTalkTest?InboundId=ID
Click Connect:
Failure 26 - Error Locating Server/Instance Specified
Items tried or checked:
Ran PortQry on Virtual Box:
Starting portqry.exe -n 10.0.2.15 -e 1433 -p TCP ...
Querying target system called:
10.0.2.15
Attempting to resolve IP address to a name...
IP address resolved to DESKTOP-T2G7B3A
querying...
TCP port 1433 (ms-sql-s service): LISTENING
portqry.exe -n 10.0.2.15 -e 1433 -p TCP exits with return code 0x00000000.
1A. Ran PortQry On Host
Starting portqry.exe -n 10.0.2.15 -e 1433 -p TCP ...
Querying target system called:
10.0.2.15
Attempting to resolve IP address to a name...
Failed to resolve IP address to name
querying...
TCP port 1433 (ms-sql-s service): FILTERED
portqry.exe -n 10.0.2.15 -e 1433 -p TCP exits with return code 0x00000002.
1B. Verified the IP address on Virtual Box is 10.0.2.15. Failed to ping on Host, Successful ping on Virtual Box.
TCP/IP Enabled in SQL Server instance.
Changed Server name to ip address - Error Locating Server/Instance Specified
Verified SQL Server Browser is running.
Verified Server Name from Error Log.

helm postgres connection - unable to connect

I have uploaded some code on github: https://github.com/darkcloudi/helm-camunda-postgres
Running the following commands deploys the two charts (Note the set is required to allow the postgres db to be deployed, i've disabled it by default, as camunda comes with its own DB, i'm trying to configure it to use postgres):
helm install dev ./camunda-install --set tags.postgres=true
You will see that its all looking good:
NAME READY STATUS RESTARTS AGE
pod/dev-camunda-67f487dcd-wjdfr 1/1 Running 0 36m
pod/dev-camunda-test-connection 0/1 Completed 0 45h
pod/postgres-86c565898d-h5tf2 1/1 Running 0 36m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/dev-camunda NodePort 10.106.239.96 <none> 8080:30000/TCP 36m
service/dev-postgres NodePort 10.108.235.106 <none> 5432:30001/TCP 36m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 4d19h
If I either use the 10.108.x.x ip or the minikube ip 192.168.64.2 I get the same error below, I can connect to tomcat using http://camunda.minikube.local/ or http://192.168.64.2:30000/ so was wondering where I might be going wrong when attempting to connect to postgres.
kubectl exec -it postgres-86c565898d-h5tf2 -- psql -h 10.108.235.106 -U admin --password -p 30001 camunda
Password:
psql: error: could not connect to server: could not connect to server: Connection timed out
Is the server running on host "10.108.235.106" and accepting
TCP/IP connections on port 30
kubectl describe svc dev-postgres
Name: dev-postgres
Namespace: default
Labels: app.kubernetes.io/managed-by=Helm
name=dev-postgres
Annotations: meta.helm.sh/release-name: dev
meta.helm.sh/release-namespace: default
Selector: app=dev-postgres,name=dev-postgres
Type: NodePort
IP: 10.108.235.106
Port: postgres-http 5432/TCP
TargetPort: 5432/TCP
NodePort: postgres-http 30001/TCP
Endpoints: <none>
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
https://github.com/darkcloudi/helm-camunda-postgres/blob/master/camunda-install/charts/postgres/templates/postgres.yaml
Since you are accessing it from within the cluster you should use the ClusterIP 10.108.235.106 and port 5432.
If you wan to access it from outside the cluster then you can use Node IP 192.168.64.2 and NodePort 30001
Port 30001 is listening on the node VM and container is listening on port 5432.So you can not access it via port 30001 from within the cluster.
Edit:
The Endpoints is empty on the service. This is because the label selector on the service is selecting pods with labels app=dev-postgres,name=dev-postgres but the pods don't have that label.

Unable to access local development server of Google Cloud SDK for Python from Vagrant

I am running local development server in a Vagrant box and trying to open it in Chrome(host machine). But it fails to open in the host machine. Using the curl on localhost:7000 in the guest machine returns the HTML content. This is my Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision :shell, path: "setup_dev_env.sh"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 7080, host: 7080, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 7000, host: 7000, host_ip: "127.0.0.1"
config.vm.synced_folder "SOME_PATH", "/home/vagrant/code"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "4096"
end
end
Command to run the server(guest machine):
python /home/vagrant/code/google-cloud-sdk/platform/google_appengine/dev_appserver.py PATH_TO_app.yaml --port=7080 --admin_port=7000 --datastore_path=~/BLAH.db
You need to add the following when running your command (https://cloud.google.com/appengine/docs/standard/python3/tools/local-devserver-command)
--host=...
The host address to use for the server. You may need to set this to be able to access the development server from another computer on
your network. An address of 0.0.0.0 allows both localhost access and
IP or hostname access. Default is localhost.
In your case as running in vagrant, you need to make sure its bound to 0.0.0.0
python /home/vagrant/code/google-cloud-sdk/platform/google_appengine/dev_appserver.py \
PATH_TO_app.yaml \
--host=0.0.0.0 --port=7080 --admin_port=7000 --datastore_path=~/BLAH.db

postgres database not available over network

So I have changed the postgresql.conf file to this:
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
Then I changed the pg_hba.conf to host all all 127.0.0.1/32 and host all all 2601:643:8402:f900:1045:d5ae:1d3b:19d1
But I when I enter show listen_addresses; It still only lists local host. What do I need to fix in order to access my databases over a local network?
After changing those files you need to restart the database.

VirtualBox: How to access virtual host on VM from host?

How to access from the host the Apache virtual domain created on virtual machine.
Settings of the VM on VirtualBox:
VM ubuntu/precise32 on VirtualBox created with vagrantfile from How to setup a LAMP development environment in Vagrant by Sanchit Jain Rasiya
installed Apache/2.2.22
installed Lynx browser
Virtual Host /etc/apache2/sites-available/example.com
ServerAdmin webmaster#example.com
ServerName example.com
DocumentRoot /home/vagrant/www/example.com
AllowOverride All
Order allow,deny
Allow from all
ErrorLog "/home/vagrant/www/example.com/logs/example.com-error.log"
CustomLog "/home/vagrant/www/example.com/logs/example.com-access.log" combined
From the browser on the host machine I can access VM's localhost as http://192.168.205.10/index.html
How can I access VM's example.com?
On the host's /etc/hosts I have added line for example.com
127.0.0.1 localhost
127.0.0.2 tmp.loc
127.0.0.3 temp.loc
192.168.205.10 example.com
When I try http://example.com/mj.html I get the 404 Not Found page from Apache/2.2.22 (Ubuntu) Server at example.com Port 80
On the virtual machine I can access page with the Lynx
lynx http://example.com/mj.html
This is noted in the /home/vagrant/www/example.com/logs/example.com-access.log file as
127.0.0.1 - - [03/Apr/2016:15:53:49 +0000] "GET /mj.html HTTP/1.0" 200 344 "-" "Lynx/2.8.8dev.9 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.14"
But when I try to access example.com from the host there are no logs neither in access.log nor /home/vagrant/www/example.com/logs/example.com-error.log
There are no logs in the host's Server files /opt/lampp/logs/access_log and /opt/lampp/logs/error_log
On Ubuntu /etc/hosts:
127.0.0.1 localhost
127.0.2.2 example.com
On Windows (VBox) C:\Windows\System32\drivers\etc\hosts:
10.0.2.2 localhost
10.0.2.2 example.com
Then just reboot your VBox Windows and type in browser (on Windows):
http://example.com/
I have the same issue, I've been trying to access my drupal project from my virtualbox vm but it is not working. One of the solutions I found on the Internet is using the outer keyword in your hosts file in the VM.
The following works fine for me:
In your host machine (let's say a ubuntu) type: ifconfig, and get the
inet address of wlan0 (example: 192.168.1.15)
Add this address to the host file in your virtualobox machine and use the outer keyword
[192.168.1.15 outer]
Now you can access your localhost from your virtualbox browser by typing the address of your wlan0 (ex: 192.168.1.15).
If you need to access a specific port on your host add the port number to
the address example 192.168.1.15:8001

Resources