Fortisnmp monitoring -help

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Fortisnmp monitoring -help

Post by batchen »

hello i hope im in the correct forum.
so i have installd Nagios Core 4.1.1
on CentOS release 6.7 VM .

my issue is this :
monitoring Bandwidth Usage by : in the file /usr/local/nagios/etc/objects/switch.cfg

"
# Monitor bandwidth via MRTG logs

define service{
use generic-service ; Inherit values from a template
host_name firewalls
service_description Port 9 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/172.10.170.99_2.log!AVG!1000000,1000000!5000000,5000000!10
}
"

origenly the check_local_mrtgtraf log file was to : /www/

and i get a yellow warning : MRTG data has expired (221 minutes old)
my cron jobs : (after trying endless other forums ..)

*/5 * * * * LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg >/dev/null 2>&1
*/5 * * * * LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log


my mrtg.log :
2016-01-19 12:35:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 12:40:02 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 12:45:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 12:50:02 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 12:55:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 13:00:02 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 13:05:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 13:10:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 13:15:02 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'
2016-01-19 13:20:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg'

last time 2016--01-19 13:20:01 -- Started mrtg with config '/etc/httpd/conf/mrtg.cfg was 4 hours ago, maybe it relatd.

please help!

Regards, :D
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Fortisnmp monitoring -help

Post by tgriep »

Is there any errors in the /var/log/cron log file?
Can you login to the server and run the following commands and post the output?

Code: Select all

LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l
LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg
LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg
Be sure to check out our Knowledgebase for helpful articles and solutions!
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: Fortisnmp monitoring -help

Post by batchen »

Thanks for the fast replay!

my cron log shows :
Jan 20 09:35:01 localhost CROND[11936]: (root) CMD (/usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log)
Jan 20 09:40:01 localhost CROND[11975]: (root) CMD (LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg >/dev/null 2>&1)
Jan 20 09:40:01 localhost CROND[11976]: (root) CMD (/usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg \342\200\223logging /var/log/mrtg.log)
Jan 20 09:40:01 localhost CROND[11977]: (root) CMD (/usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log)
Jan 20 09:40:01 localhost CROND[11978]: (root) CMD (LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
Jan 20 09:40:01 localhost CROND[11980]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jan 20 09:45:01 localhost CROND[12019]: (root) CMD (LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
Jan 20 09:45:01 localhost CROND[12020]: (root) CMD (/usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg \342\200\223logging /var/log/mrtg.log)
Jan 20 09:45:01 localhost CROND[12021]: (root) CMD (LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg >/dev/null 2>&1)
Jan 20 09:45:01 localhost CROND[12022]: (root) CMD (/usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log)

and all the commend you add didnt gave any output :
root@localhost: ~#LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg
root@localhost: ~#LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l
root@localhost: ~#LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg
root@localhost: ~#LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Fortisnmp monitoring -help

Post by rkennedy »

Can you verify the time on your machine and post the result?

Code: Select all

grep 'date.timezone' /etc/php.ini
date
Former Nagios Employee
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: Fortisnmp monitoring -help

Post by batchen »

yes -

root@localhost: ~#grep 'date.timezone' /etc/php.ini
; http://www.php.net/manual/en/datetime.c ... e.timezone
;date.timezone =
root@localhost: ~#date
Thu Jan 21 13:22:43 EST 2016


i even set it now to Asia\Jerusalem and still :

root@localhost: ~#grep 'date.timezone' /etc/php.ini
; http://www.php.net/manual/en/datetime.c ... e.timezone
date.timezone = Asia/Jerusalem


and restarting http + nagios,
but still : MRTG data has expired.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Fortisnmp monitoring -help

Post by tgriep »

Are the file in this folder getting updated?

Code: Select all

/var/www/mrtg/
You said that the folder was in /www/ did you edit the config files to point to the new folder?

Can you login as root to the server and run the following and post the output here?

Code: Select all

ls -l /var
ls -l /var/www
ls -l /var/www/mrtg
Be sure to check out our Knowledgebase for helpful articles and solutions!
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: Fortisnmp monitoring -help

Post by batchen »

im sorry the file wanst www i didnt write the whole path for some reason..
the original file he was taking the settings from was : /var/lib/mrtg/

and there was no log file there only the : mrtg.ok
so as i checked i saw all the logs are in /var/www/mrtg/

so i redirected it to there and from red alarm it became yellow - working but not updated.
the error that was before when i get the red alarm was : "cant find log file"

as to your requst :

Code: Select all

root@localhost: mrtg#ls -l /var
total 76
drwxr-xr-x.  2 root root 4096 Jan 18 10:25 account
drwxr-xr-x. 14 root root 4096 Jan 18 11:44 cache
drwxr-xr-x.  2 root root 4096 Jan 19 03:20 crash
drwxr-xr-x.  2 root root 4096 Nov 22  2013 cvs
drwxr-xr-x.  3 root root 4096 Jan 18 10:25 db
drwxr-xr-x.  3 root root 4096 Jan 18 10:25 empty
drwxr-xr-x.  2 root root 4096 Sep 23  2011 games
drwxr-xr-x. 31 root root 4096 Jan 21 14:06 lib
drwxr-xr-x.  2 root root 4096 Sep 23  2011 local
drwxrwxr-x.  6 root lock 4096 Jan 27 04:02 lock
drwxr-xr-x. 11 root root 4096 Jan 27 04:02 log
lrwxrwxrwx.  1 root root   10 Jan 18 10:22 mail -> spool/mail
drwxr-xr-x.  2 root root 4096 Sep 23  2011 nis
drwxr-xr-x.  2 root root 4096 Sep 23  2011 opt
drwxr-xr-x.  2 root root 4096 Sep 23  2011 preserve
drwxr-xr-x. 23 root root 4096 Jan 27 04:02 run
drwxr-xr-x. 13 root root 4096 Jan 20 16:32 spool
drwxrwxrwt.  2 root root 4096 Jan 21 13:48 tmp
drwxr-xr-x.  7 root root 4096 Jan 19 03:33 www
drwxr-xr-x.  3 root root 4096 Jan 18 10:24 yp

Code: Select all

root@localhost: mrtg#ls -l /var/www
total 20
drwxr-xr-x. 2 root   root   4096 Dec 15 10:51 cgi-bin
drwxr-xr-x. 3 root   root   4096 Jan 18 11:44 error
drwxr-xr-x. 3 root   root   4096 Jan 19 14:32 html
drwxr-xr-x. 3 root   root   4096 Jan 18 11:45 icons
drwxr-xr-x. 2 nagios nagios 4096 Jan 19 11:36 mrtg

Code: Select all

root@localhost: mrtg#ls -l /var/www/mrtg
total 288
-rw-r--r--. 1 nagios nagios  1511 Jan 19 11:36 172.10.170.99_26-day.png
-rw-r--r--. 1 nagios nagios  6376 Jan 19 11:36 172.10.170.99_26.html
-rw-r--r--. 1 nagios nagios 48217 Jan 19 11:36 172.10.170.99_26.log
-rw-r--r--. 1 nagios nagios  1367 Jan 19 11:35 172.10.170.99_26-month.png
-rw-r--r--. 1 nagios nagios 48213 Jan 19 11:35 172.10.170.99_26.old
-rw-r--r--. 1 nagios nagios  1455 Jan 19 11:35 172.10.170.99_26-week.png
-rw-r--r--. 1 nagios nagios  1742 Jan 19 04:30 172.10.170.99_26-year.png
-rw-r--r--. 1 nagios nagios  1511 Jan 19 11:36 172.10.170.99_2-day.png
-rw-r--r--. 1 nagios nagios  6414 Jan 19 11:36 172.10.170.99_2.html
-rw-r--r--. 1 nagios nagios 48237 Jan 19 11:36 172.10.170.99_2.log
-rw-r--r--. 1 nagios nagios  1367 Jan 19 11:35 172.10.170.99_2-month.png
-rw-r--r--. 1 nagios nagios 48217 Jan 19 11:35 172.10.170.99_2.old
-rw-r--r--. 1 nagios nagios  1455 Jan 19 11:35 172.10.170.99_2-week.png
-rw-r--r--. 1 nagios nagios  1742 Jan 19 04:30 172.10.170.99_2-year.png
-rw-r--r--. 1 nagios nagios   350 Nov 12  2012 favicon.ico
-rw-r--r--. 1 nagios nagios  2772 Jan 19 15:36 index.html
-rw-r--r--. 1 nagios nagios   343 Nov 12  2012 mrtg-l.gif
-rw-r--r--. 1 nagios nagios   538 Nov 12  2012 mrtg-l.png
-rw-r--r--. 1 nagios nagios  1144 Nov 12  2012 mrtg-m.gif
-rw-r--r--. 1 nagios nagios   414 Nov 12  2012 mrtg-m.png
-rw-r--r--. 1 nagios nagios  1779 Nov 12  2012 mrtg-r.gif
-rw-r--r--. 1 nagios nagios  1759 Nov 12  2012 mrtg-r.png
-rw-r--r--. 1 nagios nagios  4696 Nov 12  2012 mrtg-ti.gif
-rw-r--r--. 1 nagios nagios  4293 Nov 12  2012 mrtg-ti.png

thank you!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Fortisnmp monitoring -help

Post by tmcdonald »

What do you have defined for the check_local_mrtgtraf command? What's the status of the getenforce command? SELinux might be preventing MRTG from reading things.
Former Nagios employee
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: Fortisnmp monitoring -help

Post by batchen »

Hi,

this is from command.cfg :

Code: Select all

# 'check_local_mrtgtraf' command definition
define command{
        command_name    check_local_mrtgtraf
        command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
        }
switch.cfg :

Code: Select all

define service{
        use                     generic-service ; Inherit values from a template
        host_name               Fortigate100D
        service_description     Port 9 Bandwidth Usage
        check_command           check_local_mrtgtraf!/var/www/mrtg/172.10.170.99_2.log!AVG!1000000,1000000!5000000,5000000!10
        }
where do i find getenforce ? i dont see it in command.cfg..

SELinux is disabled :
/etc/selinux/config :

Code: Select all

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
setenforce 0
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Fortisnmp monitoring -help

Post by tgriep »

Can you post the following files so we can review them?

Code: Select all

/etc/mrtg/mymrtg.cfg
/etc/mrtg/mrtg.cfg
/etc/mrtg/mymrtg.cfg
/etc/httpd/conf/mrtg.cfg
I would like to see if one of the config files are setup to the correct path you are storing the files.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked