Page 1 of 2

mod-gearman nothing happening

Posted: Thu Jul 20, 2017 11:56 am
by jkinning
I followed this guide - https://assets.nagios.com/downloads/nag ... ios_XI.pdf and can see the queue information when I run gearman_top2 on my Nagios XI server. What I don't understand is does this get used only when needed? I can't see to get any hosts or service checks to funnel through mod-gearman as this queue appears to be idle? It seemed pretty straight forward but apparently I am missing something or not understanding this process.

I also have read this KB article - https://support.nagios.com/kb/article.php?id=484

Re: mod-gearman nothing happening

Posted: Thu Jul 20, 2017 12:58 pm
by cdienger
Do you have a lot of service or host checks to funnel through? Do checks seem to working? After installing gearman the /usr/local/nagios/etc/nagios.cfg you should see a line like:

Code: Select all

broker_module=/usr/lib64/mod_gearman2/mod_gearman2.o config=/etc/mod_gearman2/module.conf eventhandler=no
This along with successful checks would be positive signs that all is working.

Re: mod-gearman nothing happening

Posted: Thu Jul 20, 2017 1:04 pm
by jkinning
I searched that config and found this.

# NDOUtils module
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

Should I change it or should of it happened when I ran the ModGearmanInstall.sh --type=server

Re: mod-gearman nothing happening

Posted: Thu Jul 20, 2017 4:13 pm
by tgriep
The script should of added the broker module to the nagios.cfg file but you can add it to the bottom of it manually.

Code: Select all

broker_module=/usr/lib64/mod_gearman2/mod_gearman2.o config=/etc/mod_gearman2/module.conf eventhandler=no
Then restart nagios by running the following as root so nagios will start to use that module.

Code: Select all

service nagios restart
Try that and post if you have anymore questions.

Re: mod-gearman nothing happening

Posted: Thu Jul 20, 2017 4:13 pm
by cdienger
It should be set when you run the script with the code:

Code: Select all

if [ "$install_type" == "server" ]; then
        info " "
    /etc/init.d/gearmand start
        sed -i 's/\(^broker_module=.*mod_gearman.*\)/#\1/' $nagios_cfg
        echo -e "\n\nbroker_module=$lib_dir/mod_gearman2/mod_gearman2.o config=/etc/mod_gearman2/module.conf eventhandler=no" >> $nagios_cfg
        /etc/init.d/nagios restart
Was the script run when you were logged in as root?

Re: mod-gearman nothing happening

Posted: Fri Jul 21, 2017 8:23 am
by jkinning
Yes I was root.

Code: Select all

[root@nagiosl1t tmp]# wget http://assets.nagios.com/downloads/nagiosxi/scripts/ModGearmanInstall.sh
--2017-07-20 10:42:45--  http://assets.nagios.com/downloads/nagiosxi/scripts/ModGearmanInstall.sh
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/nagiosxi/scripts/ModGearmanInstall.sh [following]
--2017-07-20 10:42:45--  https://assets.nagios.com/downloads/nagiosxi/scripts/ModGearmanInstall.sh
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11979 (12K) [application/x-sh]
Saving to: “ModGearmanInstall.sh”

100%[=====================================================================================================================================================================>] 11,979      --.-K/s   in 0s

2017-07-20 10:42:45 (92.9 MB/s) - “ModGearmanInstall.sh” saved [11979/11979]

You have new mail in /var/spool/mail/root
[root@nagiosl1t tmp]# chmod +x ModGearmanInstall.sh
[root@nagiosl1t tmp]# ./ModGearmanInstall.sh --type=server


*******************************************************************************

Nagios Enterprises
Mod Gearman Installer Script

License:
    Nagios Open Software License

Support:
    XI Support Mailing List    <[email protected]> (customers only)
    Community Forums           <http://support.nagios.com/forum/>

*******************************************************************************

Notices:
   * Only run this script on a machine with no previous gearman installations
   * Only run this script in server mode if the machine runs Nagios Core 4
   * This script comes with absolutely no warranty, use it at your own risk

*******************************************************************************




*******************************************************************************

    Downloading necessary packages...
--2017-07-20 10:47:14--  http://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-0.33-2.rhel6.x86_64.rpm
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-0.33-2.rhel6.x86_64.rpm [following]
--2017-07-20 10:47:14--  https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-0.33-2.rhel6.x86_64.rpm
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 276495 (270K) [application/x-rpm]
Saving to: “gearmand-0.33-2.rhel6.x86_64.rpm”

100%[=====================================================================================================================================================================>] 276,495     1.47M/s   in 0.2s

2017-07-20 10:47:14 (1.47 MB/s) - “gearmand-0.33-2.rhel6.x86_64.rpm” saved [276495/276495]

--2017-07-20 10:47:14--  http://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-devel-0.33-2.rhel6.x86_64.rpm
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-devel-0.33-2.rhel6.x86_64.rpm [following]
--2017-07-20 10:47:14--  https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-devel-0.33-2.rhel6.x86_64.rpm
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 201934 (197K) [application/x-rpm]
Saving to: “gearmand-devel-0.33-2.rhel6.x86_64.rpm”

100%[=====================================================================================================================================================================>] 201,934     --.-K/s   in 0.1s

2017-07-20 10:47:15 (1.37 MB/s) - “gearmand-devel-0.33-2.rhel6.x86_64.rpm” saved [201934/201934]

--2017-07-20 10:47:15--  http://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/mod_gearman2-2.1.1-1.rhel6.x86_64.rpm
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/mod_gearman2-2.1.1-1.rhel6.x86_64.rpm [following]
--2017-07-20 10:47:15--  https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/mod_gearman2-2.1.1-1.rhel6.x86_64.rpm
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 298743 (292K) [application/x-rpm]
Saving to: “mod_gearman2-2.1.1-1.rhel6.x86_64.rpm”

100%[=====================================================================================================================================================================>] 298,743     1.35M/s   in 0.2s

2017-07-20 10:47:15 (1.35 MB/s) - “mod_gearman2-2.1.1-1.rhel6.x86_64.rpm” saved [298743/298743]

--2017-07-20 10:47:15--  http://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-server-0.33-2.rhel6.x86_64.rpm
Resolving assets.nagios.com... 72.14.181.71, 2600:3c00::f03c:91ff:fedf:b821
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-server-0.33-2.rhel6.x86_64.rpm [following]
--2017-07-20 10:47:15--  https://assets.nagios.com/downloads/mod_gearman/v2.1.1/rhel6/x86_64/gearmand-server-0.33-2.rhel6.x86_64.rpm
Connecting to assets.nagios.com|72.14.181.71|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 122448 (120K) [application/x-rpm]
Saving to: “gearmand-server-0.33-2.rhel6.x86_64.rpm”

100%[=====================================================================================================================================================================>] 122,448     --.-K/s   in 0.1s

2017-07-20 10:47:16 (1.12 MB/s) - “gearmand-server-0.33-2.rhel6.x86_64.rpm” saved [122448/122448]



*******************************************************************************

    Installing the packages...


*******************************************************************************


Starting gearmand:                                         [  OK  ]
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Starting mod_gearman2_worker...OK


*******************************************************************************

    Here is some potentially helpful information:

       ModGearman configuration directory:    /etc/mod_gearman2/
       Log files:                             /var/log/mod_gearman2/
       ModGearman Worker:                     /etc/init.d/mod-gearman2-worker
       gearmand Server:                       /etc/init.d/gearmand

    If you want to view the queue statuses, you'll run:

       gearman_top2


*******************************************************************************

    You may need the following iptables rules, as well:
       iptables -I INPUT -p tcp --dport 4730 -j ACCEPT
       iptables -I INPUT -p udp --dport 4730 -j ACCEPT

[root@nagiosl1t tmp]# gearman_top2

Re: mod-gearman nothing happening

Posted: Fri Jul 21, 2017 12:50 pm
by ssax
Please run this command on your XI server and attach the resulting /tmp/xigearman.zip file.

Code: Select all

zip -r /tmp/xigearman.zip /etc/mod_gearman2 /var/log/mod_gearman2
Please run this command on your worker and attach the resulting /tmp/workergearman.zip file.

Code: Select all

zip -r /tmp/workergearman.zip /etc/mod_gearman2 /var/log/mod_gearman2
Also, please send the output of this command on the XI server:

Code: Select all

iptables -L
Thank you

Re: mod-gearman nothing happening

Posted: Fri Jul 21, 2017 1:36 pm
by jkinning

Code: Select all

[root@nagiosl1t etc]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
I am running mod-gearman on my XI server. Maybe I am not understanding the workers but isn't it possible to run mod-gearman on the XI server and not need an additional worker machine or do I need a worker machine? I am not starting to get confused.

Overall objective is to try and take some load of my main Nagios XI server to see if I can prevent out of bound messages I am getting from NSClient++ machines.

Re: mod-gearman nothing happening

Posted: Fri Jul 21, 2017 2:03 pm
by ssax
By default it will install the worker and the job server on the XI server.

To offload the processing you will need to spin up another server and only install the worker and the plugins on it and configure it.

Please attach your nagios.cfg and the output of:

Code: Select all

gearman_top2

Re: mod-gearman nothing happening

Posted: Fri Jul 21, 2017 2:14 pm
by jkinning
See attached.