Hi team,
Â
Is there a way to monitor a Linux service running under /etc/init.d ?
I have many services running on my PBX and I need to monitor them on my Centreon:
Â
Â
Thank you
Â
Regards
Hi team,
Â
Is there a way to monitor a Linux service running under /etc/init.d ?
I have many services running on my PBX and I need to monitor them on my Centreon:
Â
Â
Thank you
Â
Regards
Hi team,
Â
Is there a way to monitor a Linux service running under /etc/init.d ?
I have many services running on my PBX and I need to monitor them on my Centreon:
Â
Â
Thank you
Â
Regards
Â
Hi,Â
Â
The closest would be to use the process check:
/usr/lib/centreon/plugins//centreon_linux_snmp.pl --plugin=os::linux::snmp::plugin --mode=processcount --hostname=172.16.4.125 --snmp-version='2c' --snmp-community='public' Â --process-name='mediamanager' --process-path='' --process-args='''' --regexp-name --regexp-path --regexp-args --warning='' --critical='1:1' --cpu --memory
Â
You have to identify which process(es) are launched through /etc/init.d/ and then use it in the --process-name option
Sorry, I’m new on Centreon and I don’t understand how to use this code.
Â
Do I need to use GUI interface or SSH ? do you have a link to a ready example ?
Â
Does this code allow me to receive the same command result ?
Â
#Media Manager is running if OK and #Media manager is stopped if CRITICAL
Â
Thank you
Here is my actual config:
Â
I linked this command to my service:
Â
Â
The problem is: the output message is not good:
Â
Â
My service is running fine...
Â
This script is to count the number of ruuning process
Hello,
You can't monitor service SysV /etc/init.d/ but you could monitor status of Systemd service but not in SNMP... and maybe because you use an old Distro you don't have Systemd to try to monitor status.
Linux SNMP Plugins provide : https://github.com/centreon/centreon-plugins/blob/7569cde979ecf5626df458bac15698105129367d/os/linux/snmp/plugin.pm#L33
Linux NRPE3 plugins provide : https://github.com/centreon/centreon-plugins/blob/7569cde979ecf5626df458bac15698105129367d/os/linux/local/plugin.pm#L33
With SNMP, you just add an Host like indicated on the documentation : https://docs.centreon.com/fr/docs/getting-started/monitor-linux-server-with-snmp/
But first you do add service template OS-Linux-SNMP-Process-Generic-Name-custom to your template OS-Linux-SNMP-custom, to be able to monitor the number of process who is named like your process.
After you could configure your service like indicated here (Just for the possibility and the menu) https://docs.centreon.com/fr/docs/monitoring/basic-objects/services/ and https://docs.centreon.com/fr/docs/monitoring/basic-objects/services-templates/ you just have to configure the service to custom it to your process name.
By this way you don't need to create a command, to create a service template and attach it, and create a Host template to attach the service template too and finally create your Host to deploy your Host template.
Otherwise you do create your command to check specifically the status of a SysV service, you could use Nagios Script on Nagios Exchange like here https://exchange.nagios.org/directory/Plugins/Network-and-Systems-Management/Unix-2FLinux-Check-Service-Status/details for exemple, but you do install NRPE agent on your Host and maybe adapt script usage to Centreon. It's not a standard way.
i’m running the latest Centreon release 22.04
Hi, I wrotten a shell script that return the state of my needed services.
Â
But I don’t know how to implement my script with Centreon NRPE plugin.
Â
An idea ?
Â
here is my script:
Â
###########################
#!/bin/bash                                                                                                             Â
                                                                                                                   Â
X="VoiceMail Pro is running"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
Y="VoiceMail Pro is stopped"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
                                                                                                                     Â
command=$(/etc/init.d/vmpro status | tee > /usr/lib/centreon/plugins/avaya_vmpro_out.txt)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
head -1 /usr/lib/centreon/plugins/avaya_vmpro_out.txt > /usr/lib/centreon/plugins/avaya_vmpro_out_2.txt
content=$(cat /usr/lib/centreon/plugins/avaya_vmpro_out_2.txt)
if  "$X" == "$content" ]; then
       echo "OK, Voicemail Pro service is running"
               elif "$Y" == "$content" ]; then
                               echo "CRITICAL , Voicemail Pro service is stopped !!"
                           else
                              echo "UNKNOWN, etat du service inconnu, peut etre demarrage ou arret en cours"
fi
Â
Thank you
I found a solution to implement my script with note on Centreon.
thanksÂ
I found a solution to implement my script with note on Centreon.
thanksÂ
Â
I am interested in finding out more, what was your solution?Â
I used the check_centreon_nrpe3 to call the script from /usr/lib/Centreon/plugins (the script that I wrote is mentioned on my previous reply.
you need to chmod the script and txt files to 777 to give centreon user the read and write right.
after that you need to create command check template and service host.
Â
for more details, let me know, I can share config screenshots.
Â
I tested the plugin NRPE3 with systemd status check:
Â
Â
systemctl don’t return the same result like /etc/init.d
Â
I don’t know which argument I need to put on the service custom macro...
Hello,
Logically you don't have to add settings on macros about the threshold Critical and Warning Status.
Help about the mode indicate :
Check systemd services status.
Command used: 'systemctl -a --no-pager --no-legend' and 'systemctl list-unit-files --no-pager --no-legend'
=over 8
=item B<--filter-name>
Filter service name (can be a regexp).
=item B<--exclude-name>
Exclude service name (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total-running', 'total-dead', 'total-exited',
'total-failed'.
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{display}, %{active}, %{sub}, %{load}, %{boot}
=item B<--critical-status>
Set critical threshold for status (Default: '%{active} =~ /failed/i').
Can used special variables like: %{display}, %{active}, %{sub}, %{load}, %{boot}
Your service is in failed state (third lines of the result for systemctl status onexportal.service) it could be in CRITICAL state on Centreon.
Could you post the execution of the command ?
Regards
Command could be :
/usr/lib64/nagios/plugins/check_centreon_nrpe3 \
   -H x.x.x.x \
   -p 5666 -t 5 -u \
   -c check_centreon_plugins \
   -a 'os::linux::local::plugin' 'systemd-sc-status' ' --statefile-dir=/var/log/nrpe/centplugins' ‘--filter-name=onexportal.service’
You execute this command on your poller maybe your central server with the Linux local account centreon-engine
Yes I found after some tests.
thank youÂ
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.