Bulk modify bandwidth warning, critical values

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
darnorth
Posts: 10
Joined: Fri Sep 29, 2017 3:29 pm

Bulk modify bandwidth warning, critical values

Post by darnorth »

We have Nagios XI Enterprise 5.4.12 and I need to modify $ARG2$ and $ARG3$ across 1100 services (all bandwidth checks via snmp).

The services are pretty much identical... check command is check_xi_service_mrtgtraf, Command view is $USER1$/check_rrdtraf -f /var/lib/mrtg/$ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$. The only thing that's different is $ARG1$ which contains the IP_portnumber.rrd

For example, one of these services is currently set to:

$ARG1$ 192.168.94.105_10101.rrd
$ARG2$ 5.00,5.00
$ARG3$ 8.00,8.00
$ARG4$ M

I want to change $ARG2$ to 500.0,500.0 and $ARG3$ to 800.0,800.0. I navigate to Bulk Modifications Tool -> Change Command and Arguments and modify:

Check command: <leave blank>
$ARG1$ <leave blank>
$ARG2$ 500.0,500.0
$ARG3$ 800.0,800.0
$ARG4$ <leave blank>

Select the 1 service to modify (as a test) then Save.

The problem is, both $ARG1$ and $ARG4$ get blanked out upon save.

Original command:check_xi_service_mrtgtraf!192.168.94.105_10101.rrd!5.00,5.00!8.00,8.00!M
Command when bulk modify used: check_xi_service_mrtgtraf!!500.0,500.0!800.0,800.0!

How do we only change $ARG2$ and $ARG3$ while preserving $ARG1$ and $ARG4$?

Thanks!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Bulk modify bandwidth warning, critical values

Post by npolovenko »

@darnorth, Yes, the bulk modifications tool overrides the whole command. Aside from modifying those ARG manually you could write a script that would: 1) copy services .cfg files from /usr/local/nagios/etc/services/ to /usr/local/nagios/etc/import/ 2) Modify the args with some kind of replacing command(like `sed`) and then apply the new configuration. Here's an example of the script:

Code: Select all

mkdir /backup
cp /usr/local/nagios/etc/services/* /backup
cp /usr/local/nagios/etc/services/* /usr/local/nagios/etc/import/
find /usr/local/nagios/etc/import/ -type f -exec sed -i "s/string to replace/new string/g" {} +
cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh
However, you need to be very familiar with sed command as if it could potentially mess up the other configs if you don't use it correctly. Please backup XI before you start.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
darnorth
Posts: 10
Joined: Fri Sep 29, 2017 3:29 pm

Re: Bulk modify bandwidth warning, critical values

Post by darnorth »

Hi @npolovenko,

That worked great. Here's what I ended up using to change the values:

mkdir /backup
cp /usr/local/nagios/etc/services/* /backup
cp /usr/local/nagios/etc/services/* /usr/local/nagios/etc/import/
find /usr/local/nagios/etc/import/ -type f -exec sed -i "s/5.00,5.00\!8.00,8.00/500.0,500.0\!800.0,800.0/g" {} +
cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh

Thanks.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Bulk modify bandwidth warning, critical values

Post by npolovenko »

@darnorth, That's great! I will go ahead and lock this thread for you.
Thanks for using our support forum.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked