2. /opt/omd/versions/1.20/skel/local/share/check_mk/notifications
total 8
drwxr-xr-x. 2 root root 4096 Aug 20 2014 ./
drwxr-xr-x. 10 root root 4096 Oct 1 2014 ../
$cat /opt/omd/sites/e2eslave1/local/share/check_mk/notifications/omnibus_trap
#!/bin/sh
#Send Omnibus / AutoClarify Trap (Bridge Queue, Priority)
#Send different commands if the Source of the notification is from a Service
Check or a Host Check
if [ "$NOTIFY_WHAT" == "SERVICE" ]; then
#Passing the arguments into a seperate variable, then passing to command
as an Array (otherwise some variables weren't escaping properly)
ARGS1=(-v 2c -c public 62.239.184.46 '' NAGIOS-NOTIFY-MIB::nSvcEvent
nSvcHostname s "$NOTIFY_HOSTNAME" nSvcHostStateID i $NOTIFY_HOSTSTATEID nSvcDesc
s "$NOTIFY_SERVICEDESC" nSvcStateID i $NOTIFY_SERVICESTATEID nSvcAttempt i
$NOTIFY_SERVICEATTEMPT nSvcDurationSec i $NOTIFY_SERVICEDURATIONSEC
nSvcGroupName s "$NOTIFY_SERVICEGROUPNAME" nSvcLastCheck i
$NOTIFY_LASTSERVICECHECK nSvcLastChange i $NOTIFY_LASTSERVICESTATECHANGE
nSvcOutput s "$NOTIFY_SERVICEOUTPUT" nSvcHostAlias s "AUTOCLARIFY:
$NOTIFY_PARAMETER_1:$NOTIFY_PARAMETER_2")
ARGS2=(-v 2c -c public 62.239.187.23 '' NAGIOS-NOTIFY-MIB::nSvcEvent
nSvcHostname s "$NOTIFY_HOSTNAME" nSvcHostStateID i $NOTIFY_HOSTSTATEID nSvcDesc
s "$NOTIFY_SERVICEDESC" nSvcStateID i $NOTIFY_SERVICESTATEID nSvcAttempt i
$NOTIFY_SERVICEATTEMPT nSvcDurationSec i $NOTIFY_SERVICEDURATIONSEC
nSvcGroupName s "$NOTIFY_SERVICEGROUPNAME" nSvcLastCheck i
$NOTIFY_LASTSERVICECHECK nSvcLastChange i $NOTIFY_LASTSERVICESTATECHANGE
nSvcOutput s "$NOTIFY_SERVICEOUTPUT" nSvcHostAlias s "AUTOCLARIFY:
$NOTIFY_PARAMETER_1:$NOTIFY_PARAMETER_2")
/usr/bin/snmptrap "${ARGS1[@]}"
/usr/bin/snmptrap "${ARGS2[@]}"
elif [ "$NOTIFY_WHAT" == "HOST" ]; then
if [ "$NOTIFY_HOSTSTATETYPE" == "HARD" ]; then
HOSTSTATETYPE=0
else
HOSTSTATETYPE=1
fi
#Passing the arguments into a seperate variable, then passing to command
as an Array (otherwise some variables weren't escaping properly)
ARGS1=(-v 2c -c public 62.239.184.46 '' NAGIOS-NOTIFY-MIB::nHostEvent
nHostname s "$NOTIFY_HOSTNAME" nHostStateID i $NOTIFY_HOSTSTATEID nHostStateType
i $HOSTSTATETYPE nHostAttempt i $NOTIFY_HOSTATTEMPT nHostDurationSec i
$NOTIFY_HOSTDURATIONSEC nHostGroupName s "$NOTIFY_HOSTGROUPNAME" nHostLastCheck
i $NOTIFY_LASTHOSTCHECK nHostLastChange i $NOTIFY_LASTHOSTSTATECHANGE
nHostOutput s "$NOTIFY_HOSTOUTPUT" nHostAlias s "AUTOCLARIFY:
$NOTIFY_PARAMETER_1:$NOTIFY_PARAMETER_2")
ARGS2=(-v 2c -c public 62.239.187.23 '' NAGIOS-NOTIFY-MIB::nHostEvent
nHostname s "$NOTIFY_HOSTNAME" nHostStateID i $NOTIFY_HOSTSTATEID nHostStateType
i $HOSTSTATETYPE nHostAttempt i $NOTIFY_HOSTATTEMPT nHostDurationSec i
$NOTIFY_HOSTDURATIONSEC nHostGroupName s "$NOTIFY_HOSTGROUPNAME" nHostLastCheck
i $NOTIFY_LASTHOSTCHECK nHostLastChange i $NOTIFY_LASTHOSTSTATECHANGE
nHostOutput s "$NOTIFY_HOSTOUTPUT" nHostAlias s "AUTOCLARIFY:
$NOTIFY_PARAMETER_1:$NOTIFY_PARAMETER_2")
/usr/bin/snmptrap "${ARGS1[@]}"
/usr/bin/snmptrap "${ARGS2[@]}"
echo "${ARGS1[@]}" >> /tmp/logout
else
echo "ERROR: Invalid Check Type Passed" >> /tmp/logout
********************************************************************************
3. ********************************************************************************
**************
1ambchops
F[k70Ux!
blt11127001 10.54.148.54 E2ESlave1 b6&D9vq!
root password: F[k70Ux!
******************************
10.54.148.55
$cp -r ruby rubybackup
******************************
root password: muD9$5!G
there might be an unpacked version of Ruby in /tmp
as root run gem list
wget https://rubygems.org/gems/net-ssh
For Current net-ssh releases require Ruby 2.0 or later,So anyhow we have to
install Ruby 2.0
*****************************
10.54.148.55
su - e2eslave1
/usr/local/lib/ruby/gems/2.1.0
/usr/lib/ruby/gems/2.1.0/gems/chef-11.12.8/spec/unit/knife/client_create_spec.rb
/usr/bin/ruby
[root@blt11127001 usr]# cd uname -a
bash: cd: uname: No such file or directory
[root@blt11127001 usr]# uname -a
Linux blt11127001 2.6.39-400.24.1.el6uek.x86_64 #1 SMP Wed May 15 11:46:52 PDT
2013 x86_64 x86_64 x86_64 GNU/Linux
[root@blt11127001 usr]#
[root@blt11127001 usr]#
[root@blt11127001 usr]#
[root@blt11127001 usr]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
[root@blt11127001 usr]#
[root@blt11127001 usr]#
[root@blt11127001 usr]#
[root@blt11127001 gems]# gem install chef-helpers
ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: Could not find a valid gem 'chef-helpers' (>= 0) in any repository
4. [root@blt11127001 gems]#
This may be automatically included in the Chef build in the future, but at the
moment is still a manual step.
Due to the new way we monitor Windows Services, we connect via SSH and use a
small Netcat EXE to connect to the Check_MK Service locally. Unfortunately using
the standard SSH Commands using this method seems to return a "chunked"
response, where half the output of the agent doesn't get sent over correctly.
The solution to this was to wrap up the Datasoruce call into a Ruby script,
which waits until the entire response is recieved before passing it on. The
script has also been extended to query any kind of OS by passing the IP + OS
into the script.
It should be placed in the OMD Sites Home Directory, and test that the Site User
can call it correctly.
It is available on SVN in the Chef Repo (under Misc)
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/checkman/.svn
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/checks/.svn
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/pnp-templates/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_checkman/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_checks/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_pnptemplates/.svn
Example to wget:
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/checkman/.svn
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/checks/.svn
/var/chef/backup/opt/omd/sites/e2eslave1/local/share/check_mk/pnp-templates/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_checkman/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_checks/.svn
/var/chef/cache/cookbooks/Nagios-OMD/files/default/Base/extra_pnptemplates/.svn