Monitoring Ubuntu Service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Monitoring Ubuntu Service

Post by ahoward12 »

Hey Gents, kind of having trouble figuring out how to monitor a service that doesn't exist as a service on an u=Ubuntu machine... So I may just be lacking some Linux knowledge.

Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial

I am trying to monitor a Linux Ubuntu box for a service: rapidrecovery-agent.

The service doesn't exist when I run: service --status-all

Code: Select all

 [ + ]  acpid
 [ + ]  apache-htcacheclean
 [ + ]  apache2
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  atd
 [ + ]  binfmt-support
 [ - ]  bootmisc.sh
 [ - ]  checkfs.sh
 [ - ]  checkroot-bootclean.sh
 [ - ]  checkroot.sh
 [ + ]  clamav-freshclam
 [ + ]  console-setup
 [ + ]  cron
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ + ]  dbus
 [ + ]  grub-common
 [ - ]  hostname.sh
 [ - ]  hwclock.sh
 [ + ]  irqbalance
 [ + ]  iscsid
 [ - ]  keyboard-setup.dpkg-bak
 [ - ]  killprocs
 [ + ]  kmod
 [ - ]  lvm2
 [ + ]  lvm2-lvmetad
 [ + ]  lvm2-lvmpolld
 [ + ]  lxcfs
 [ + ]  mdadm
 [ - ]  mdadm-waitidle
 [ - ]  mountall-bootclean.sh
 [ - ]  mountall.sh
 [ - ]  mountdevsubfs.sh
 [ - ]  mountkernfs.sh
 [ - ]  mountnfs-bootclean.sh
 [ - ]  mountnfs.sh
 [ + ]  mysql
 [ + ]  networking
 [ + ]  ondemand
 [ + ]  open-iscsi
 [ + ]  open-vm-tools
 [ - ]  plymouth
 [ - ]  plymouth-log
 [ + ]  procps
 [ + ]  rc.local
 [ + ]  redis-server
 [ + ]  resolvconf
 [ - ]  rsync
 [ + ]  rsyslog
 [ + ]  sav-protect
 [ - ]  sav-rms
 [ - ]  sav-update
 [ - ]  screen-cleanup
 [ - ]  sendsigs
 [ + ]  ssh
 [ + ]  sysstat
 [ - ]  thermald
 [ + ]  udev
 [ + ]  ufw
 [ - ]  umountfs
 [ - ]  umountnfs.sh
 [ - ]  umountroot
 [ + ]  unattended-upgrades
 [ + ]  urandom
 [ - ]  uuidd
 [ + ]  webmin
 [ - ]  x11-common
 [ + ]  xinetd
I am obviously lacking some Linux knowledge but here is the service:

Code: Select all

root@nextcloud:/usr/bin# service rapidrecovery-agent status
● rapidrecovery-agent.service - Provides Rapid Recovery Agent service
   Loaded: loaded (/etc/systemd/system/rapidrecovery-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-10 23:31:04 EST; 2 weeks 3 days ago
 Main PID: 1446 (agent_wrapper)
    Tasks: 38
   Memory: 69.4M
      CPU: 5h 3min 21.420s
   CGroup: /system.slice/rapidrecovery-agent.service
           ├─ 1401 /bin/sh /opt/apprecovery/scripts/agent_wrapper watchdog
           ├─ 1446 /bin/sh /opt/apprecovery/scripts/agent_wrapper watchdog
           ├─ 1490 /bin/sh /usr/bin/agent /debug
           ├─ 1524 /opt/apprecovery/mono/bin/mono /opt/apprecovery/agent/Agent.Service.Mono.exe /debug
           └─11323 sleep 1
I have found it running as a process but I am not sure how to monitor it through Nagios. Since it doesn't exist as a service as I would normally see it, only a process. Any idea how I might be able to monitor this to make sure the service is running?


Nagios XI 5.5.8
CentOS 6.8
VMware 6.5
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring Ubuntu Service

Post by lmiltchev »

I have found it running as a process but I am not sure how to monitor it through Nagios. Since it doesn't exist as a service as I would normally see it, only a process. Any idea how I might be able to monitor this to make sure the service is running?
Do you have an agent installed on the Ubuntu machine? Are you monitoring it as of now?

If you haven't installed an agent yet, I would recommend trying NCPA.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Ubuntu Service

Post by ahoward12 »

I have the NSClient ++ so I am monitoring CPU, Memory, Disk usage etc, but I am not sure how to use an argument in the Nagios configuration. It is not a classic init.d service.

I have a command that works perfect on Windows for a monitoring a service:

Code: Select all

[nagios@NAGIOS.cafaroco.com ~]$ /usr/local/nagios/libexec/check_nt -H 10.10.99.42 -s "" -p 12489 -v SERVICESTATE -l RapidRecoveryAgent -d SHOWALL 
RapidRecoveryAgent: Started
I have tried a shot in the dark by just replacing this with my linux process and IP and such however it is not finding the service. The wizard is not really any help again, because it is not a typical service.

Code: Select all

/usr/local/nagios/libexec/check_nt -H 172.25.10.21 -s "" -p 5666 -v SERVICESTATE -l rapidrecovery-agent.service -d SHOWALL
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring Ubuntu Service

Post by scottwilkerson »

I'm not familiar with NSClient++ on Linux, can you look at how you are executing the commands for CPU, Memory, Disk usage?

I believe it uses check_nrpe vs. check_nt
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Ubuntu Service

Post by ahoward12 »

Ahh, apologies, I keep mixing up my Windows and Linux environments. You're correct, I am using NRPE. Here is what I currently monitor and how:

[nagios@NAGIOS.cafaroco.com ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.25.10.21 -c check_cpu_stats -a '-w 70 -c 85'

[nagios@NAGIOS.cafaroco.com ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.25.10.21 -c check_disk -a '-w 10% -c 5% -p /'

[nagios@NAGIOS.cafaroco.com ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.25.10.21 -c check_mem -a '-w 5 -c 1'

I will be out of the office until Feb 8th. I appreciate the ongoing help with this. Just be aware I won't be able to respong to anything likely until the 8th.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring Ubuntu Service

Post by scottwilkerson »

First you would need a plugin that can perform this, I have attached one that can do it, this would get installed on the remote machine in /usr/local/nagios/libexec
check_init_service.zip
Then on the remote machine you would add the following line to your NRPE config

Code: Select all

command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
restart NRPE

Then add the following line to your /etc/sudoers file

Code: Select all

# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service
Finally setup a check so it can check the service like this

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 172.25.10.21 -t 30 -c check_init_service -a 'rapidrecovery-agent'
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Ubuntu Service

Post by ahoward12 »

Sorry about getting back so late. This will work perfect Scott thank you.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring Ubuntu Service

Post by scottwilkerson »

ahoward12 wrote:Sorry about getting back so late. This will work perfect Scott thank you.
Great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked