Haha not in that way
tom@white-elephant:/tmp$ zcat plex.pl.gz
my $colour = "Polka Dot";
my $level = 0;
if (m/<td width="197" height="30">(\w+) Toner Cartridge<\/td>/)
$colour = $1;}
if (m/<font size="2">(\d+)%<\/font><\/td>/)
$level = $1;}
print "$colour: $level\n";
plexer (17th October 2008)
That works for me.
Now to do the rest of the check
Ok here's a working script, many thanks to Tom for sorting this out for me.
Looks like you've got it working well Ben - thanks for reposting the perl we worked on via email.. hope it helps someone else
Now go get "Learning Perl" (O'Reilly) it's good, it is.
Yeah the only thing I've commented out is trying to get it to return a value as well as printing the output to stdout as it does now.
nagios takes the single line of text from stdout as a return but I'd seen some perl plugins that also returned the value as well.
Such as exit $state;
Allthough it may not be needed in my case as it works as we have it now.
Just need to do add in some error checking like you mentioned becuase if I run it against a non k5440 printer for instance I presume it will baulk.
Would have thought so - though you might adapt it to detect the type of printer and find the correct URL automatically
I'll look it up when I'm back at work next week.
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
Do i need to use cat and pipe it in there somehow?Code:cp -R -v /Source /Destination > /Destination/Log.file
Cheers in advance peeps
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'
ind1ekid (30th October 2009)
There are currently 1 users browsing this thread. (0 members and 1 guests)