HP Color LaserJet 2600N - Toner percent / Left|Printed pages
Moderators: Developers, Moderators
okay
so please see attached corrected version...
problem was that nagios want to store the temp file, but user nagios is not allowed to write to root (/)...
now you have to define temp directory inside of php script...
your nagios config is correct...
so please see attached corrected version...
problem was that nagios want to store the temp file, but user nagios is not allowed to write to root (/)...
now you have to define temp directory inside of php script...
your nagios config is correct...
- Attachments
-
- check_nagios_v2.php.txt
- (2.23 KiB) Downloaded 406 times
yeah i think so.
i get this from prompt:
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
sh: line 1: --output-document=/tmp/status_10.1.3.6.htm: No such file or directory
sh: line 2: http://10.1.3.6/SSI/supply_status_info.htm: No such file or directory
i get this from prompt:
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
sh: line 1: --output-document=/tmp/status_10.1.3.6.htm: No such file or directory
sh: line 2: http://10.1.3.6/SSI/supply_status_info.htm: No such file or directory
it's there:
[root@intranet libexec]# head check_hp2600n.php
#!/usr/bin/php -q
<?php
// You have to change these values with your configured language inside of webpanel (http://your.ip.address/):
$string_catridge_black = "Black Print Cartridge";
$string_catridge_magenta = "Magenta Print Cartridge";
$string_catridge_cyan = "Cyan Print Cartridge";
$string_catridge_yellow = "Yellow Print Cartridge";
$string_left_pages = "Estimated Pages Remaining";
[root@intranet libexec]# head check_hp2600n.php
#!/usr/bin/php -q
<?php
// You have to change these values with your configured language inside of webpanel (http://your.ip.address/):
$string_catridge_black = "Black Print Cartridge";
$string_catridge_magenta = "Magenta Print Cartridge";
$string_catridge_cyan = "Cyan Print Cartridge";
$string_catridge_yellow = "Yellow Print Cartridge";
$string_left_pages = "Estimated Pages Remaining";
okay. i get someplace now.
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
sh: line 1: /tmp/status_10.1.3.6.htm: Permission denied
TONER OK B:53 M:40 C:40 Y:40
it seemed when i copied i used nano editor. i normally use vim, but vim i use syntax highlighting and autotab. when i paste code, it doesn't paste well, so nano tends to do better. nano seems though to paste newline char incorrectly so it puts it on a newline and the whitespace gets misinterpreted.
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.6 40 20
sh: line 1: /tmp/status_10.1.3.6.htm: Permission denied
TONER OK B:53 M:40 C:40 Y:40
it seemed when i copied i used nano editor. i normally use vim, but vim i use syntax highlighting and autotab. when i paste code, it doesn't paste well, so nano tends to do better. nano seems though to paste newline char incorrectly so it puts it on a newline and the whitespace gets misinterpreted.
nagios is reporting everything properly now it seems.
though for permission it is possible that when running it from console i am logged in as root so root created the file. if webserver runs script, it is then owned by apache.
though running it as root shouldn't give me error.
i will keep it as is for now, and now work on cacti portion.
thanks again for all your help.
though for permission it is possible that when running it from console i am logged in as root so root created the file. if webserver runs script, it is then owned by apache.
though running it as root shouldn't give me error.
i will keep it as is for now, and now work on cacti portion.
thanks again for all your help.
I had some free time yesterday to attempt to do it, but I failed. I forgot to add the host, but even after that, I got stuck. Your instructions were fine to follow but some parts I got stuck. Feel free to use German in your help notes if you wish (it will help me learn the language more, and maybe easier for you to explain it to me where I am stuck).
I could not figure out how to define the graphs and colours and what to poll.
The screen grabs helped a lot by the way, thank you for the time and effort you are putting in this to assist me on this!
I could not figure out how to define the graphs and colours and what to poll.
The screen grabs helped a lot by the way, thank you for the time and effort you are putting in this to assist me on this!
Another thing about permission. I forgot script is run by nagios.
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.11 40 20
sh: line 1: /tmp/status_10.1.3.11.htm: Permission denied
TONER WARNING B:30 M:52 C:52 Y:52
[root@intranet libexec]# ls -l /tmp/status_10.1.3.11.htm
-rw-r--r-- 1 nagios nagios 25942 Nov 13 12:19 /tmp/status_10.1.3.11.htm
Therefore I believe apache is attempting to do something hence the error with permission. Will this permission problem be problematic?
Even if I delete the file, run it as root, I still get the same error. Root owns the file, by default it is 644 permission so I don't see why it won't work then as well.
[root@intranet libexec]# ./check_hp2600n.php 10.1.3.11 40 20
sh: line 1: /tmp/status_10.1.3.11.htm: Permission denied
TONER WARNING B:30 M:52 C:52 Y:52
[root@intranet libexec]# ls -l /tmp/status_10.1.3.11.htm
-rw-r--r-- 1 nagios nagios 25942 Nov 13 12:19 /tmp/status_10.1.3.11.htm
Therefore I believe apache is attempting to do something hence the error with permission. Will this permission problem be problematic?
Even if I delete the file, run it as root, I still get the same error. Root owns the file, by default it is 644 permission so I don't see why it won't work then as well.
code modified, it works not bad now.
- Attachments
-
- HP2600.php.txt
- Updated code so nagios works with it
- (3.93 KiB) Downloaded 523 times
Who is online
Users browsing this forum: No registered users and 0 guests