exclude some mounted partition on snmpd.conf

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Moderators, Developers

Post Reply
Author
Message
c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

exclude some mounted partition on snmpd.conf

#1 Post by c3226026 » Mon Mar 07, 2011 2:40 am

Hi,

Sorry for this request but I have'nt see any answer about it.
It's possible to exclude some mounted patitions or some FS directly on snmpd.conf file (for exemple /proc /devive ....) or harddisk ? The idea is to don't see it on cacti graph option for the device.

Thanks in advanced for your answer

noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: exclude some mounted partition on snmpd.conf

#2 Post by noname » Mon Mar 07, 2011 4:57 am

Simply not to create graph for unwanted partition?

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: exclude some mounted partition on snmpd.conf

#3 Post by c3226026 » Mon Mar 07, 2011 7:44 am

noname wrote:Simply not to create graph for unwanted partition?
Yes but I wanted to do something than "select all" for more quickly done new add devices to make some particulary profile, but it's perhaps not possible by snmpd.conf.

In fact I wanted to excluded "automaticaly" some particulary mounted FS because I have many devices to include on cacti.
Last edited by c3226026 on Mon Mar 07, 2011 7:46 am, edited 1 time in total.

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: exclude some mounted partition on snmpd.conf

#4 Post by c3226026 » Mon Mar 07, 2011 7:46 am

sorry double post. thanks to delete it

noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: exclude some mounted partition on snmpd.conf

#5 Post by noname » Tue Mar 08, 2011 5:13 am

c3226026 wrote:In fact I wanted to excluded "automaticaly" some particulary mounted FS because I have many devices to include on cacti.
Well, then, let's add graphs by using cli script ('cli/add_graphs.php').

Now I added a remote server that has partitions like this:
partitions-1.png
partitions-1.png (11.68 KiB) Viewed 2358 times
So I want to make graphs only for physical volumes (like as /dev/dsk/*).

To determine how filtering, use '--list-snmp-values' option.
(target server's id is 3)
% php add_graphs.php --list-snmp-values --host-id=3 --snmp-field=dskDevice
Known values for dskDevice for host 3: (name)
/dev/dsk/c0t0d0s0
/dev/dsk/c0t0d0s3
/dev/dsk/c0t0d0s4
/dev/dsk/c0t0d0s5
/dev/dsk/c0t0d0s7
/devices
fd
proc
swap
If you want to filter by 'Mount Point', use 'dskPath' instead of 'dskDevice'.

Next, I made a script as follows:

Code: Select all

#!/bin/sh

host=3          # target server's id
field=dskDevice
filter='^/dev/dsk/'

cli=/var/www/cacti/cli/add_graphs.php

gtmpl=3         # [Graph Template] ucd/net - Available Disk Space
query=2         # [Data Query] ucd/net - Get Monitored Partitions
type=6          # [Associated Graph Templates] Available/Used Disk Space

for value in `php $cli --list-snmp-values --host-id=$host --snmp-field=$field | grep $filter`
do
        echo php $cli                   \
        --graph-type=ds                 \
        --graph-template-id=$gtmpl      \
        --host-id=$host                 \
        --snmp-query-id=$query          \
        --snmp-query-type-id=$type      \
        --snmp-field=$field             \
        --snmp-value=$value
done
For debugging, I put 'echo' before php.
% ./test_add_graphs.sh
php /var/www/cacti/cli/add_graphs.php --graph-type=ds --graph-template-id=3 --host-id=3 --snmp-query-id=2 --snmp-query-type-id=6 --snmp-field=dskDevice --snmp-value=/dev/dsk/c0t0d0s0
php /var/www/cacti/cli/add_graphs.php --graph-type=ds --graph-template-id=3 --host-id=3 --snmp-query-id=2 --snmp-query-type-id=6 --snmp-field=dskDevice --snmp-value=/dev/dsk/c0t0d0s3
php /var/www/cacti/cli/add_graphs.php --graph-type=ds --graph-template-id=3 --host-id=3 --snmp-query-id=2 --snmp-query-type-id=6 --snmp-field=dskDevice --snmp-value=/dev/dsk/c0t0d0s4
php /var/www/cacti/cli/add_graphs.php --graph-type=ds --graph-template-id=3 --host-id=3 --snmp-query-id=2 --snmp-query-type-id=6 --snmp-field=dskDevice --snmp-value=/dev/dsk/c0t0d0s5
php /var/www/cacti/cli/add_graphs.php --graph-type=ds --graph-template-id=3 --host-id=3 --snmp-query-id=2 --snmp-query-type-id=6 --snmp-field=dskDevice --snmp-value=/dev/dsk/c0t0d0s7
Then, I executed this script actually. (removed 'echo')
% ./test_add_graphs.sh
Graph Added - graph-id: (36) - data-source-ids: (44, 44)
Graph Added - graph-id: (37) - data-source-ids: (45, 45)
Graph Added - graph-id: (38) - data-source-ids: (46, 46)
Graph Added - graph-id: (39) - data-source-ids: (47, 47)
Graph Added - graph-id: (40) - data-source-ids: (48, 48)
And result:
partitions-2.png
partitions-2.png (15.35 KiB) Viewed 2358 times
If you have many devices, place the script in loop to change $host.

How about such the way?

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: exclude some mounted partition on snmpd.conf

#6 Post by gandalf » Sat Mar 19, 2011 6:51 am

Anybody considered AUTOM8 for this? The rules are hopefully flexible enough ...
R.

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: exclude some mounted partition on snmpd.conf

#7 Post by c3226026 » Tue Mar 22, 2011 12:21 am

Hi,

Thanks for your help, I will try it :wink:

[Edit] Gandalf, I have not really understood how it worked to do that, but I'm working [/Edit]

noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: exclude some mounted partition on snmpd.conf

#8 Post by noname » Wed Mar 23, 2011 8:58 pm

gandalf wrote:Anybody considered AUTOM8 for this? The rules are hopefully flexible enough ...
R.
Ah, sorry, I forgot about this plugin.
Autom8 is capable of everything that I wanted to do at the above.

In Graph Rules, I duplicated default 'Disk Space' rule and modified.
autom8_graph_rules-1.png
autom8_graph_rules-1.png (22.07 KiB) Viewed 2284 times
In preview, wanted partitions are selected correctly (as you see, I've not created any graphs/datasources yet for target host).
Great.
autom8_graph_rules-2.png
autom8_graph_rules-2.png (48.07 KiB) Viewed 2284 times
NOTE: 'host.description' + 'is not unknown' means 'all host' (from Autom8 manual)

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: exclude some mounted partition on snmpd.conf

#9 Post by c3226026 » Thu Mar 24, 2011 9:48 am

Thanks very much noname :wink: and thanks gandalf for this plugin

Post Reply