Jump to content

Recommended Posts

Posted
I'm trying to create a plugin for nagios to get the consumables status for our Konica K5440dl printers.

 

I tried a snmpwalk on one and it only goes so far so I was hoping to try and copy the HP 2600 one which uses wget to download the supplies status webpage to a temporary file and then extracts the details from that.

 

Ben

 

Can you post the one you use for the HP 2600 please?

Posted

A bit off topic, but i didnt see the point making a new thread for this question what with all the linux scripting goin on here!

I want to copy a set of folders to another folder, but log what files are processed at the same time to a text file:

 

so i got something like this, but my file ends up empty :(

 

cp -R -v /Source /Destination > /Destination/Log.file

 

Do i need to use cat and pipe it in there somehow?

Cheers in advance peeps :)

Posted

so i got something like this, but my file ends up empty :(

 

cp -R -v /Source /Destination > /Destination/Log.file

 

Works for me..

 

$ cat Destination/log

`Source/file2' -> `Destination/Source/file2'

`Source/file1' -> `Destination/Source/file1'

$

Posted

cp -Rv ./baz/ ./bar/ > foo

 

seems to work here

 

tom@flying-squirrel:/tmp/foo$ cat foo

`./baz/' -> `./bar/baz'

`./baz/flibb' -> `./bar/baz/flibb'

`./baz/quux' -> `./bar/baz/quux'

  • Thanks 1
Posted
cp -Rv ./baz/ ./bar/ > foo

 

seems to work here

 

tom@flying-squirrel:/tmp/foo$ cat foo

`./baz/' -> `./bar/baz'

`./baz/flibb' -> `./bar/baz/flibb'

`./baz/quux' -> `./bar/baz/quux'

 

Cheers :) Worked a charm, I wasnt far off I guess!

Posted
...what exactly did you do differently? I used your exact command to test.

 

lol... i have no idea now ive just looked at them both again :doh: its working now anyway!

Posted
I'll look it up when I'm back at work next week.

 

Ben

 

Just a nudge in case this had slipped your mind.

 

Im installing nagios just now and all our printers are those HPs pretty much..

  • 2 weeks later...
Posted

OK this seems to be working.. But how now do I implement it into nagios??

 

root@nagios:/usr/local/nagios/libexec# php check_hp2600.php -H 10.0.5.101 -c 10 -w 15
TONER OK C:32 M:99 Y:32 K:22

Posted

Got it sorted!

 

I had to add this to commands.cfg

 

# 'check_hp2600' command definition
define command{
	command_name	check_hp2600
	command_line	php /usr/local/nagios/libexec/check_hp2600.php -H $HOSTADDRESS$ -c 10 -w 15
	}

 

And then in printers.cfg i made a new group called 2600-printers which calls the previous command

 

define service{
use			generic-service		; Inherit values from a template
hostgroup_name		2600-printers		; The name of the host the service is associated with
service_description	Printer Status		; The service description
#	check_command		check_hpjd!-C public	; The command used to monitor the service
check_command		check_hp2600	; The command used to monitor the service
normal_check_interval	10	; Check the service every 10 minutes under normal conditions
retry_check_interval	1	; Re-check the service every minute until its final/hard state is determined
}

 

And then just specified all the printers in host declarations

 

define host{
use		generic-printer		; Inherit default values from a template
host_name	10.0.5.101		; The name we're giving to this printer
alias		10.0.5.101	; A longer name associated with the printer
address		10.0.5.101		; IP address of the printer
hostgroups	2600-printers 	; Host groups this printer is associated with
notifications_enabled	0		; disable emails for this check	
}

 

I hope this helps someone else :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...