ESXi 5.x template - no perl SDK, pure snmp

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Author
Message
macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

ESXi 5.x template - no perl SDK, pure snmp

#1 Post by macan » Tue Mar 11, 2014 10:15 am

Hi,
I prepared template for ESXi. It works with 5.0, 5.1 and 5.5. You can graph:
  • vhosts - number of hosts, running, installed vm client tools
    Logged in Users and number of processes
    Real Memory - on 5.1 and higher
    Processor load for every CPU core (strange works on 5.0, better on 5.1, fine on 5.5)
    HW - state of Logical volumes, FANs, … (does not make sense graphs hw with state unknown (only running(2), warninkg(3)) and make threshold)
    Disk usage
    Interface statistics
You need enable snmp (yes, ESXi include snmp), read readme.txt
Attachments
cacti_esxi_template.tar.gz
version 0.2
(102.15 KiB) Downloaded 6854 times
esxi_ps.png
Screenshot - processes
esxi_ps.png (14.96 KiB) Viewed 32351 times
esxi_vhosts.png
Screenshot - vhosts
esxi_vhosts.png (23.15 KiB) Viewed 32351 times
esxi_memory.png
Screenshot - Real memory
esxi_memory.png (18.69 KiB) Viewed 32351 times
esxi_cpu.png
Screenshot - CPU
esxi_cpu.png (20.98 KiB) Viewed 32351 times
Last edited by macan on Thu Apr 24, 2014 3:59 am, edited 1 time in total.

bogd
Posts: 1
Joined: Wed Mar 19, 2014 11:39 am

Re: ESXi 5.x template - no perl SDK, pure snmp

#2 Post by bogd » Wed Mar 19, 2014 11:47 am

This is great -thank you!!

One small problem, though - the PHP script getting the VM info (ss_esxi_vhosts.php) is hardcoded for SNMPv3. Could someone help me get this to work with SNMPv3?

The script calls cacti_snmp_walk, and changing that to use SNMPv3 seems possible. However, I do not know enough about the inner workings of Cacti to send all required information to the script - it will need a username, password, priv_pass, etc.

Thank you!

[ Edit: there seems to be something wrong with the script (or with my ESXi server). Even after enabling SNMPv2 on the host, there is no vmwVirtMachines OID (enterprises.vmware.2) - and since the script uses it to get all info related to VMs, there's nothing there.

[[email protected] scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 7
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.1 = STRING: "vmhba0"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.2 = STRING: "vmhba1"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.3 = STRING: "vmhba2"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.4 = STRING: "vmhba32"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.5 = STRING: "vmhba33"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.6 = STRING: "vmhba34"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.7 = STRING: "vmhba35"

[[email protected] scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2 = No Such Object available on this agent at this OID

]

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#3 Post by macan » Wed Mar 26, 2014 2:30 am

bogd wrote:This is great -thank you!!

One small problem, though - the PHP script getting the VM info (ss_esxi_vhosts.php) is hardcoded for SNMPv3. Could someone help me get this to work with SNMPv3?

The script calls cacti_snmp_walk, and changing that to use SNMPv3 seems possible. However, I do not know enough about the inner workings of Cacti to send all required information to the script - it will need a username, password, priv_pass, etc.

Thank you!

[ Edit: there seems to be something wrong with the script (or with my ESXi server). Even after enabling SNMPv2 on the host, there is no vmwVirtMachines OID (enterprises.vmware.2) - and since the script uses it to get all info related to VMs, there's nothing there.

[[email protected] scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 7
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.1 = STRING: "vmhba0"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.2 = STRING: "vmhba1"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.3 = STRING: "vmhba2"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.4 = STRING: "vmhba32"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.5 = STRING: "vmhba33"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.6 = STRING: "vmhba34"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.7 = STRING: "vmhba35"

[[email protected] scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2 = No Such Object available on this agent at this OID

]
SNMP v3 isn't hardcoded. I used "universal" script for all version of snmp. It will be used version, which is selected in cacti. I think, that ESXi use 1/2c only. You cannot use v3.

I haven't problem with your snmp example. I tested it on 5.1 and 5.5:
[email protected] ~ # snmpwalk -v2c -c xxx u.v.w.x .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"

[email protected] ~ # snmpwalk -v2c -c xxx u.v.w.x .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2.1.1.2.5 = STRING: "Cust1 SQL and AD"
SNMPv2-SMI::enterprises.6876.2.1.1.2.6 = STRING: "Cust1 Terminal"
SNMPv2-SMI::enterprises.6876.2.1.1.2.7 = STRING: "Cust2 SQL"
SNMPv2-SMI::enterprises.6876.2.1.1.2.8 = STRING: "Cust2 Terminal"
SNMPv2-SMI::enterprises.6876.2.1.1.2.10 = STRING: "Cust3 BSD"
Last edited by macan on Thu Mar 27, 2014 4:53 am, edited 1 time in total.

alkocelj
Posts: 5
Joined: Wed Mar 26, 2014 7:59 am

Re: ESXi 5.x template - no perl SDK, pure snmp

#4 Post by alkocelj » Wed Mar 26, 2014 8:03 am

Could you please export this template that this would work on Cacti version 8.7g?
Thx

Alex

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#5 Post by macan » Wed Mar 26, 2014 8:14 am

alkocelj wrote:Could you please export this template that this would work on Cacti version 8.7g?
Thx

Alex
You can try change template version hash. Howto is here http://docs.cacti.net/howto:determine_c ... te_version.

Please let me know, if it works. Thank you :-)

alkocelj
Posts: 5
Joined: Wed Mar 26, 2014 7:59 am

Re: ESXi 5.x template - no perl SDK, pure snmp

#6 Post by alkocelj » Mon Apr 07, 2014 6:28 pm

I have tried and did not work. Maybe I am doing something wrong but I cannot import it.

biohazard
Posts: 1
Joined: Tue Apr 15, 2014 6:15 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

#7 Post by biohazard » Tue Apr 15, 2014 6:24 pm

The vhosts graph looks great except the running hosts measurement always shows 0. I have 5 virtual machines running, 3 with tools 2 without.

Running ESXi 5.0
graph_image.png
graph_image.png (24.92 KiB) Viewed 31963 times

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#8 Post by macan » Thu Apr 17, 2014 2:50 am

alkocelj wrote:I have tried and did not work. Maybe I am doing something wrong but I cannot import it.
Try attached template. I reimported template only, It isn't tested on 0.8.7. If it fails, update your cacti instalation.
Attachments
cacti_host_template_esxi_5_x.xml
Template version 0.8.7g
(194.64 KiB) Downloaded 2027 times

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#9 Post by macan » Thu Apr 24, 2014 3:54 am

biohazard wrote:The vhosts graph looks great except the running hosts measurement always shows 0. I have 5 virtual machines running, 3 with tools 2 without.

Running ESXi 5.0
graph_image.png
You are right. ESXI 5.0 uses different status. I fixed it, please download version 0.2 and overwrite file ss_esxi_vhosts.php in cacti_instalation/scripts/.

ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

#10 Post by ksdjfh » Sun May 11, 2014 1:52 pm

Thanks for the templates. Much appreciated.

I'm having having trouble getting data on ESXi 5.5 U1 though

I seem to ge graphing logged in users and processes just fine.

For real memory, I had to increase the timeout on the host in order to get the used memory value.

The vhosts graph is reporting 0 for everything. I changed the log level to debug in cacti and there doesn't seem to be any errors. The values returned are all zero.

For the CPU, is there any way to get the % reported by the vmware client? I don't need to know the details of every core in my host, just want to see the % that is reported by vmware.

Do you take requests for more fun stats? :) I'm not good enough at making my own or figuring out how to read MIB files

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#11 Post by macan » Wed May 14, 2014 5:35 am

ksdjfh wrote: I'm having having trouble getting data on ESXi 5.5 U1 though
The vhosts graph is reporting 0 for everything. I changed the log level to debug in cacti and there doesn't seem to be any errors. The values returned are all zero.
I haven't 5.5 U1.Can you send me snmpwalk of your ESXI 5.5 U1?
ksdjfh wrote: For the CPU, is there any way to get the % reported by the vmware client? I don't need to know the details of every core in my host, just want to see the % that is reported by vmware.
I didn't find this value :-(
ksdjfh wrote: Do you take requests for more fun stats? :)
Ok, send me your requests

ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

#12 Post by ksdjfh » Wed May 14, 2014 7:57 pm

macan wrote: I haven't 5.5 U1.Can you send me snmpwalk of your ESXI 5.5 U1?
Using your snmpwalk suggestion, the info in this thread and a little luck, I figured this one out myself. Like another user, when I did an snmpwalk, I got something like this:

snmpwalk -v2c -c public 10.2.100.100 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1746018"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "1"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "16"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 201313300
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 201313300
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 13
......

No 6876.2 which is what you're using to pull data. Originally I configured the /etc/vmware/snmp.conf file by hand which I guess ESXi didn't like.

To fix the problem I did:

esxcli system snmp set --reset
esxcli system snmp set --communities public
esxcli system snmp set --enable true

Then when I did an snmpwalk I got a lot more values and the graph started pulling data.
macan wrote: I didn't find this value :-(
I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/

I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
macan wrote: Ok, send me your requests
Does vmware expose anything from esxtop, specifically stuff from d (disk adapter) or u (disk device)? Maybe graph commands per disk adapter (I use software iSCSI so i only have one vmhba that gives me any data) or mb read/write? I tried to read the mib files and it seems like the answer might be no (I found this nagios page which seems to indicate I would have to go the api route to pull any more detailed info: http://exchange.nagios.org/directory/Pl ... pi/details

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#13 Post by macan » Thu May 15, 2014 2:29 am

ksdjfh wrote: No 6876.2 which is what you're using to pull data. Originally I configured the /etc/vmware/snmp.conf file by hand which I guess ESXi didn't like.

To fix the problem I did:

esxcli system snmp set --reset
esxcli system snmp set --communities public
esxcli system snmp set --enable true

Then when I did an snmpwalk I got a lot more values and the graph started pulling data.
Interesting

ksdjfh wrote: I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/
I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
Do you know http://docs.cacti.net/plugin:aggregate?

ksdjfh wrote: Does vmware expose anything from esxtop, specifically stuff from d (disk adapter) or u (disk device)? Maybe graph commands per disk adapter (I use software iSCSI so i only have one vmhba that gives me any data) or mb read/write? I tried to read the mib files and it seems like the answer might be no (I found this nagios page which seems to indicate I would have to go the api route to pull any more detailed info: http://exchange.nagios.org/directory/Pl ... pi/details
I think, that answer is no. It isn't posibble to use SNMP for this. You have to use another way. Maybe ssh key exchange on cacti and pull data via script like:
ssh [email protected] 'uptime' | cut -d " " -f 9
0.17,

ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

#14 Post by ksdjfh » Sat May 24, 2014 2:56 pm

macan wrote:
ksdjfh wrote: I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/
I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
Do you know http://docs.cacti.net/plugin:aggregate?
Do you know how to do this? I've been trying to get the graph I want but I'm going in circles. I can create a basic aggregate graph and convert the area to line graphs. My problem is I would like to see an extra line on there to show the average (or maybe even hide all the individual cpus and just show a line for the average). Also in the legend, I do not want to see CPU1, CPU2, CPU3, etc. It gets very long when you have 20+ cores. Just want to see the total average of all cpus.

macan
Cacti User
Posts: 138
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech
Contact:

Re: ESXi 5.x template - no perl SDK, pure snmp

#15 Post by macan » Fri Jun 06, 2014 1:54 am

ksdjfh wrote: Do you know how to do this? I've been trying to get the graph I want but I'm going in circles. I can create a basic aggregate graph and convert the area to line graphs. My problem is I would like to see an extra line on there to show the average (or maybe even hide all the individual cpus and just show a line for the average). Also in the legend, I do not want to see CPU1, CPU2, CPU3, etc. It gets very long when you have 20+ cores. Just want to see the total average of all cpus.
Hi, I prepared multicpu avg tempate. There is one line line - avg load for all cores.
I created new topic for this graph template:
http://forums.cacti.net/viewtopic.php?f=12&t=52884
Attachments
multicpu_avg.png
Screenshot of multicpu avg
multicpu_avg.png (22.34 KiB) Viewed 31295 times
multicpu_avg_01.tgz
Multicpu avg template
(25.02 KiB) Downloaded 1067 times

Post Reply