Visit Our UNIX and Linux User Community


Send statistical data via SNMP

 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Infrastructure Monitoring Send statistical data via SNMP
# 1  
Old 10-17-2011
Send statistical data via SNMP

I am working on a SunOS 5.10 Generic_142900-03 sun4v sparc SUNW,Netra-T2000
With this command: (Unix based cronjob)

Code:
tail -1 FSC-xxxxxxxxx.stat | nawk -F, '{print $2}'

I want to send the numeric output of this command from a statistical file which is updating constantly via SNMPv2 every 1 minute to a remote monitoring node. What is the best way to achieve this? Smilie
# 2  
Old 10-17-2011
What monitoring tool is on the remote box?

This is what you have to do - for net-snmp. Creating a trap is a way to do this, but setting the trap up in the monitor is not standard.

TUT:snmptrap - Net-SNMP Wiki

The other way means writing C code - MIB
# 3  
Old 10-18-2011
I am using Lithium Console for Server monitoring. My question is considering that there are the custom SUN SNMP MIBs currently configured can i not edit these to poll just this item of data. Where do i send the result of the
tail -1 FSC-xxxxxxxxx.stat | nawk -F, '{print $2}' command so that is can be send via snmpv2?
# 4  
Old 10-18-2011
I did not get what you wanted. Yes, just modify the MIB code - if it is custom.
Embed the tail - nawk one-liner into a C system() call. Why? you want to synchronize fresh data with the SNMP call.

I am assuming this is an important datum in monitoring and that you are going to change the MIB C.

Or, write the nawk output to a known place that the snmp process can read. Modify the C code to open and read the file. If this does not violate SNMP security policy. Known places are publicly accessible directories like /var/tmp, and /tmp. Be sure the permissions on the file coming out of tail -nawk allows world (other) read, and the directories in the path up to the place where the file lives are world execute.

Is this what you are asking?

BTW - for stuff like this we run an ssh connection to a special snmp-like user on the box in question, and then execute a script. A lot of the console monitoring apps support other protocols than SNMP, among them ftp and ssh. The custom MIB world is not worth it for something like this.

However - Lithium was totally MAC oriented when I saw it demoed. Dunno if the lithium -> lithium core bridge supports anything else like ssh.
# 5  
Old 10-18-2011
I would so very much want to modify existing MIBs. I am trying to figure out one file where snmp polls for its data say number of errors or some instances so that i can map the output of that command to this file. Are you aware of any file which is written to by any script and read from by the snmp agent?

Previous Thread | Next Thread
Test Your Knowledge in Computers #566
Difficulty: Easy
Many programming languages use two ampersands, a && b to denote the logical And operator.
True or False?

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need to transfer all kernel logs (var/log/messages) to the snmp listener as snmp trap

i am working with embedded system -Dell DCS management sub system. my question is as below: currently we are using linux kernel 2.6.30 build and we have a kernel logs stored to the /var/log/messages path. now we have to transfer all this logs to the specified SNMP target as a part of SNMP... (4 Replies)
Discussion started by: vipul_prajapati
4 Replies

2. Shell Programming and Scripting

Appending unix timestamp to every line of a statistical file

I have a statistical file populating every minute as below: 2011-11-11-1108 1955 891 2011-11-11-1109 2270 1049 2011-11-11-1110 1930 904 2011-11-11-1111 2030 931 2011-11-11-1112 1944 900 2011-11-11-1113 1922 875 Instead of having the date and time in the given format (2011-11-11-1113) I... (10 Replies)
Discussion started by: thinktank
10 Replies

3. Red Hat

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (1 Reply)
Discussion started by: prabakar4all
1 Replies

4. IP Networking

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (0 Replies)
Discussion started by: prabakar4all
0 Replies

5. Shell Programming and Scripting

send data with Perl

Hello! I want to sent data (pictures: pic.jpg or textfiles) to a server. The pictures should be stored in \my_pictures\beautiful_images. How can I do it with Perl? I think, that I should start with a socket?? Do you have a tutorial or a site, where I can read about it? I use the IDE Padre /... (1 Reply)
Discussion started by: la_dy82
1 Replies

6. Shell Programming and Scripting

bash: statistical properties

Hi A bash script, after some operations, return with an array. My goal is to calculate some statistical properties (hopefully still in bash) of that array, (like mean, variance, max_value and min_value). For the max, mean and the min it seems work, but for the variance the notation is... (1 Reply)
Discussion started by: Dedalus
1 Replies

7. IP Networking

Send A Snmp Trap

Hi, do you know the syntax to send a snmp trap to a server ? Many htanks. (2 Replies)
Discussion started by: big123456
2 Replies

8. Programming

Send flaged data ..

Hello ! I'm writing a chat program , and I have a curiozity. I'm curently using two ports ( sockets ) for client - server interconections. One socket is used for ordinary ( normal ) data ( Ex : data on main-chat ) , and the another ( two socket ) is used to send management data : ( Ex... (0 Replies)
Discussion started by: !_30
0 Replies

Featured Tech Videos