how to monitor Xerox Phaser 7400DN printer with icinga

With this useful plugin you can monitor easily your network printer.Download and move it to directory with the other plugins.In my case the directory is /usr/lib/nagios/plugins/.Make sure the snmp is configured on the printer side.Now, lets’ test the plugin root@icinga:/usr/lib/nagios/plugins# ./check_snmp_printer -H 192.168.0.75 -x "MODEL"
"Xerox Phaser 7400DN;PS4.2.0,Net25.72.10.07,Eng0.11.2,OS6.26", Serial # XXXXXXXXX

Icinga-Printer
Now, we have to define host, check_command and services for our new object.
root@icinga:/usr/local/icinga/etc# vim objects/Default_collector/hosts.cfg
define host {
host_name Printer
address 192.168.0.75
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
notification_options d,n
check_command check-host-alive
check_period 24x7
notification_period 24x7
contact_groups +admins
}

root@icinga:/usr/local/icinga/etc# vim objects/global/checkcommands.cfg

define command{
command_name check_consumables
command_line $USER1$/check_snmp_printer -H $ARG1$ -C public -x $ARG2$ -w 30 -c 15
}

define command{
command_name check_paper
command_line $USER1$/check_snmp_printer -H $ARG1$ -C public -x $ARG2$
}

root@icinga:/usr/local/icinga/etc# vim objects/Default_collector/services.cfg


define service{
use generic-service
host_name Printer
service_description Tray1 Paper Status
check_command check_paper!$HOSTADDRESS$!"TRAY 1"
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Tray2 Paper Status
check_command check_paper!$HOSTADDRESS$!"TRAY 2"
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Black Toner Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Black Toner”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Cyan Toner Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Cyan Toner”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Magenta Toner Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Magenta Toner”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Yellow Toner Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Yellow Toner”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Fuser Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Fuser”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Waste Status
check_command check_consumables!$HOSTADDRESS$!”CONSUM Waste”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Cyan Imaging
check_command check_consumables!$HOSTADDRESS$!”CONSUM Cyan Imaging”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Magenta Imaging
check_command check_consumables!$HOSTADDRESS$!”CONSUM Magenta Imaging”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Yellow Imaging
check_command check_consumables!$HOSTADDRESS$!”CONSUM Yellow Imaging”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}
define service{
use generic-service
host_name Printer
service_description Black Imaging
check_command check_consumables!$HOSTADDRESS$!”CONSUM Black Imaging”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

define service{
use generic-service
host_name Printer
service_description Transfer Belt
check_command check_consumables!$HOSTADDRESS$!”CONSUM Transfer Belt”
check_period 24×7
notification_period 24×7
max_check_attempts 1
check_interval 1
retry_interval 1
notification_interval 1
event_handler_enabled 0
contact_groups +admins
}

root@icinga:/usr/lib/nagios/plugins# service icinga reload
Running configuration check...OK
Reloading icinga configuration...done

nagios plugins compile error

make[1]: Entering directory `/var/www/nagios-plugins-1.4.16/plugins'
gcc -DLOCALEDIR=\"/usr/local/icinga/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include -DNP_VERSION='"1.4.16"' -g -O2 -MT check_http.o -MD -MP -MF .deps/check_http.Tpo -c -o check_http.o check_http.c
check_http.c: In function 'process_arguments':
check_http.c:312:9: error: 'ssl_version' undeclared (first use in this function)
check_http.c:312:9: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [check_http.o] Error 1
make[1]: Leaving directory `/var/www/nagios-plugins-1.4.16/plugins'
make: *** [install-recursive] Error 1

To solve this make sure you have libssl-dev package installed.

apt-get install libssl-dev

./configure \
--prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin \
--with-nagios-user=icinga --with-nagios-group=icinga

make && make install

Migrate to raid0 in MacOS X

raid0
I decide to migrate my workstation to raid0, to get better performance.I used Carbon Copy Cloner software, to backup my current installation on another hdd.After that boot with installation disk ( in my case I boot installation over the network) and create stripped array ( it has to consist of two hard drives).I restored my installation over the raid0 array with firewire cable and carbon copy cloner, it works perfectly!!!

I run benchmark utility and here are the results.

Hard disk speed before raid array

before-raid-array

The new raid0 array
stripped array

Now, the disk speed is improved

betterspeedwithraid0

My workstation
my-workstation

Cloning Mac OS X system to new hard drive using FireWire cable

firewire

First connect your Source and Target Mac’s with Firewire cable.
Power on the Target Mac and hold on T key to boot in FireWire target disk mode.
On the Source machine will appear the new hard drive, erase it from the Disk Utility tool.Now run the Carbon Copy Cloner tool
and select your source and destination drives, and clone :)) . Download the Carbon Copy Cloner from here.

carbon3

carbon2

carbon1

static routes in MacOS X howto

Sometimes we need to add permanently static routes, we can do that in this way

cd /Library/StartupItems

vi AddRoutes


#!/bin/sh

# Set static routing tables

. /etc/rc.common

StartService ()
{
sleep 10
ConsoleMessage "Adding Static Routing Table"

sudo /sbin/route add -net 192.168.101.0 -netmask 255.255.255.0 -gateway 192.168.101.1
sudo /sbin/route add -net 192.168.102.0 -netmask 255.255.255.0 -gateway 192.168.102.1
}

StopService ()
{
return 0
}

StopService ()
{
return 0
}

RestartService ()
{
return 0
}

RunService "$1"

vi StartupParameters.plist

{
Description = "Add static routing tables";
Provides = ("AddRoutes");
Requires = ("Network");
OrderPreference = "None";
}

chmod 755 AddRoutes
chmod 755 StartupParameters.plist